Request for font fallback list setting
Categories
(Core :: Layout: Text and Fonts, enhancement)
Tracking
()
People
(Reporter: Bobo_alcazar, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0
Steps to reproduce:
- I open a web page where there’re some characters in BMP while some out of BMP such as “𰙫”, “𰅵” and so on.
- since most non-BMP characters are not included in usual fonts, I have installed some specifically designed fonts in my Windows OS for my work. some are normal fonts, and some are only prepared for certain scenario.
- In detail, for example, some fonts cover CJKV extension A, B, and some cover C, D, E; some are serif, and some are sans-serif. Besides, I even have some pop fonts for graphic design, and some ancient script fonts for my studying paleography and writing relative essays.
Actual results:
Some non-BMP characters are fallbacked to my local fonts totally randomly, though many fonts are absolutely not installed for web display.
More ridiculously, some characters were fallbacked to Oracle bone script or Warring States scripts, which completely messes up normal web page rendering.
Recently, I can’t reproduce such ridiculous phenomenon, but it can still not be fallbacked correctly. Some bugs still happen such as serif text are display by sans-serif fonts, though I’ve installed serif fonts covering it.
Expected results:
expected results:
- sans-serif textare fallbacked to other sans-serif fonts first, and then considering serif fonts. The same for serif text.
- some specifically designed fonts are not used for display.
Since FireFox doesn't know in advance which fonts are installed on user's computer, it can only fallback in a random order, and randomness must cause problem. I searched about:config
and just found a font.cjk_pref_fallback_order
. This is too coarse-grained to have any effect for this problem. And the font setting in about:preferences
allow to set only one font for each writing system and each style. That means user can only set the first font in font prioritized list, and the fallback order is random.
Allowing users themselves to set font fallback list is the only way to fix this problem.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Text and Fonts' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•2 years ago
|
||
And the font setting in about:preferences allow to set only one font for each writing system and each style. That means user can only set the first font in font prioritized list, and the fallback order is random
The font settings in about:preferences map to preferences named font.name.<style>.<lang>
(where <style>
is the CSS generic, i.e. serif
, sans-serif
, etc, and <lang>
is an internal "language group" or "writing system" code -- some of these match standard language codes, while others, in particular x-western
for Latin script and x-unicode
for "none of the above", are legacy Firefox quirks that I hope we'll update some day.
If you look in about:config, however, you'll find that in addition to the font.name.<style>.<lang>
preferences (which are generally empty by default), there are a parallel set of ``font.name-list.<style>.<lang>` preferences. These are not exposed in the Preferences UI, but can be manually edited in about:config. And -- as their name implies -- these can hold not just a single font name but a (comma-separated) list of font families.
So for your case, I suspect that putting the fonts you want to prioritize into the font.name-list.serif.x-unicode
and font.name-list.sans-serif.x-unicode
prefs might be a way forward.
Reporter | ||
Comment 3•2 years ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #2)
So for your case, I suspect that putting the fonts you want to prioritize into the
font.name-list.serif.x-unicode
andfont.name-list.sans-serif.x-unicode
prefs might be a way forward.
Thanks very much, I'll try it!
Reporter | ||
Comment 4•2 years ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #2)
I have some another questions.
First, Can I think, just now, the font.name.<style>.<lang>
are prior than font.name-list.<style>.<lang>
?
Another question is, I tried to add font entry for some languages which are not included in advance, but it may didn't work. I wonder in FireFox can I add font.name-list.<style>.<lang>
entries for new language tags out of default settings? Thanks!
And I faced another problem about font. Since I think it's a bug, I'll propose a new report later.
Comment 5•2 years ago
|
||
Yes, if there's a setting for font.name.<style>.<lang>
that will be used ahead of the font(s) listed in font.name-list.<style>.<lang>
. The font.name.*
pref is what will appear in the Preferences dialog; if it is blank, it will show as "Default", which means using the font.name-list.*
pref.
Unfortunately, you can't currently add settings for languages (or writing systems/scripts) that aren't in the list of known <lang>
values; that is a fixed set. (Some day, I hope this will change so that the font preferences are more flexible and extensible.)
Description
•