Available monospace Font gets ignored and falls back to the 3rd font on font-family font stack
Categories
(Core :: Layout: Text and Fonts, defect)
Tracking
()
People
(Reporter: lin.subscriber, Unassigned)
Details
(Keywords: fonts)
Attachments
(3 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0
Steps to reproduce:
On GitHub page, the code block is styled with
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;
I have SFMono installed on the system, however, Liberation Mono is used instead.
If I update the CSS value to
font-family: SF Mono;
Or
font-family: SF Mono,Consolas,Liberation Mono,Menlo,Courier,monospace;
It would work properly.
What is wrong with my setup?
Below are 2 command outputs:
$ fc-match -s 'SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace' | head -2
SFMono-Regular.otf: "SF Mono" "Regular"
DroidSans.ttf: "Droid Sans" "Regular"
$ fc-match -s 'SFMono-Regular' | head -2
SFMono-Regular.otf: "SF Mono" "Regular"
DroidSans.ttf: "Droid Sans" "Regular"
Actual results:
Liberation Mono is used instead.
Expected results:
SF Mono-Regular should be used in this case.
Reporter | ||
Comment 1•6 years ago
|
||
Reporter | ||
Comment 2•6 years ago
|
||
Reporter | ||
Comment 3•6 years ago
|
||
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 4•6 years ago
|
||
Add the config below makes it work.
<alias>
<family>SFMono-Regular</family>
<prefer><family>SF Mono</family>
</prefer>
</alias>
Is this really neccessary?
Comment 5•6 years ago
|
||
I cannot reproduce this issue on Ubuntu 16.04 x64, with standard font packs and no tweaks I remember of. Could you please add the OS version you are experiencing this issue on?
It would be also be useful to do a quick check on a different browser in order to verify if the problem is indeed Firefox related or system related.
Let's triage this issue for now to Core::Layout::text and fonts in order to get somebody with a better understanding of this involved.
Comment 6•6 years ago
|
||
(In reply to lin.subscriber from comment #0)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0
Steps to reproduce:
On GitHub page, the code block is styled with
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;
SFMono-Regular is not a valid font-family name; it's the PostScript name of an individual font face. The CSS font-family
property expects font family names, not font face names.[1]
(Note that some browsers behave incorrectly here, e.g. https://bugs.chromium.org/p/chromium/issues/detail?id=641861.)
The correct CSS would be font-family: "SF Mono", Consolas, ...
.
The fontconfig tweak (comment 4) works around the incorrect CSS by aliasing the font-family name, but the correct solution is to fix the CSS.
So not a Firefox bug.
Description
•