I'm migrating from a Chromium based browser to Firefox. The goal is to set all missing fonts' fallback to what is set for sans-serif (for the sake of this post and better visibility it's now Ubuntu).

Desired behavior on the left (Chrome), FF on the right for comparison:

    <p style="font-family: Arial">hello world (Arial)</p>
    <p style="font-family: Helvetica">hello world (Helvetica)</p>
    <p style="font-family: Arial, Helvetica, sans-serif">hello world (Arial, Helvetica, sans-serif)</p>
    <p style="font-family: sans-serif">hello world (sans-serif)</p>

enter image description here

Firefox default fonts seem to be derived from fontconfig: enter image description here

What they are matching:

$ fc-match Arial
NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
$ fc-match Helvetica
NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
$ fc-match sans-serif
Ubuntu-R.ttf: "Ubuntu" "Regular"
$ fc-match serif
Bookerly-Regular.ttf: "Bookerly" "Regular"

gfx.font_rendering.fontconfig.max_generic_substitutions is set to 10, but I think it is irrelevant in this example.

The secondary problem is that the fallback Nimbus has a vertical offset that causes visibility issues on most pages. At this point I don't quite understand the fallback behavior. Arial seems to be replaced with the default serif, while Helvetica falls back to what it matches with fc-match. And the third example with the multiple definitions is just weird.

Is there any way I can achieve the Chromium behavior either via FF settings or fontconfig that doesn't require setting an alias for all of these fonts?

Similar issues (possibly): link1, link2

Edit: checked the rendered fonts in dev tools, and they are Bookerly, Nimbus, Nimbus and Ubuntu for each line respectively

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.