Open Bug 1336049 Opened 9 years ago Updated 2 years ago

Fontconfig match ignored for fonts that are not installed on the system

Categories

(Core :: Layout: Text and Fonts, defect, P3)

51 Branch
x86_64
Unspecified
defect

Tracking

()

UNCONFIRMED

People

(Reporter: andrei, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0 Build ID: 20170125094131 Steps to reproduce: Arch Linux, pristine configuration from fontconfig 2.12.1-4. No Microsoft fonts are installed on the system. I enter this URL: data:text/html,<body style="font-family: Arial">test Actual results: Firefox displays the text in DejaVu Serif. This seems consistent with the default font, which is set to serif in Preferences. Expected results: The result of fc-match is: $ fc-match -s Arial NimbusSans-Regular.otf: "Nimbus Sans" "Regular" DejaVuSans.ttf: "DejaVu Sans" "Book" DejaVuSans-Bold.ttf: "DejaVu Sans" "Bold" DejaVuSans-Oblique.ttf: "DejaVu Sans" "Oblique" DejaVuSans-BoldOblique.ttf: "DejaVu Sans" "Bold Oblique" DejaVuMathTeXGyre.ttf: "DejaVu Math TeX Gyre" "Regular" DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book" DejaVuSerif.ttf: "DejaVu Serif" "Book" D050000L.otf: "D050000L" "Regular" SyrCOMAdiabene.otf: "East Syriac Adiabene" "Regular" SyrCOMKharput.otf: "Serto Kharput" "Regular" GohaTibebZemen.otf: "Goha-Tibeb Zemen" "Regular" DejaVuSansMono-Bold.ttf: "DejaVu Sans Mono" "Bold" DejaVuSerif-Bold.ttf: "DejaVu Serif" "Bold" DejaVuSerif-Italic.ttf: "DejaVu Serif" "Italic" 7x13-ISO8859-1.pcf.gz: "Misc Fixed" "Regular" 7x13.pcf.gz: "Misc Fixed" "Regular" 8x13.pcf.gz: "Misc Fixed" "Regular" 12x13ja.pcf.gz: "Misc Fixed Wide" "ja" 6x12.pcf.gz: "Misc Fixed" "SemiCondensed" 6x13.pcf.gz: "Misc Fixed" "SemiCondensed" 9x15.pcf.gz: "Misc Fixed" "Regular" cu12.pcf.gz: "MUTT ClearlyU Wide" "Regular" cu-alt12.pcf.gz: "MUTT ClearlyU Alternate Glyphs Wide" "Regular" cu-pua12.pcf.gz: "MUTT ClearlyU PUA" "Regular" 18x18ja.pcf.gz: "Misc Fixed Wide" "ja" 10x20.pcf.gz: "Misc Fixed" "Regular" I had expected Firefox to use Nimbus Sans to display the text. The font is installed on the system and it works (in the sense that if I set font-family to Nimbus Sans, the text is rendered as expected).
I can reproduce the problem in Firefox 45.0.1, too.
Hardware: Unspecified → x86_64
Component: Untriaged → Layout: Text
Product: Firefox → Core
Priority: -- → P3
Okay, firefox seems to ignore all the fontconfig preferences altogether since 57.

I do agree it is not a firefox* problem, but when I see firefox -headless --safe-mode with strace stuck in infinite loop of waiting for FUTEXes and rescanning over and over the same dir to see if same fonts exists (-CreateProfile is buggy, no?), then I beg to differ.

The solution could be : for each fc-match test if font exists before loading it.

PS font-family FiraGO in your CSS for bugzilla prevents me from having my dyslexic font appearing, and it is not covered in the issue I opened

It would be great if someone could have a look at this. Firefox is still ignoring my fontconfig matches.

E.g. data:text/html,<body style="font-family: Montserrat">test is shown in Noto Serif Regular, but I would expect Noto Sans Regular since:

estan@edison:$ fc-match Montserrat
NotoSans-Regular.ttf: "Noto Sans" "Regular"
estan@edison:
$

Using FF 96 on Ubuntu 20.04.

(In reply to Elvis Stansvik from comment #4)

It would be great if someone could have a look at this. Firefox is still ignoring my fontconfig matches.

E.g. data:text/html,<body style="font-family: Montserrat">test is shown in Noto Serif Regular, but I would expect Noto Sans Regular since:

estan@edison:$ fc-match Montserrat
NotoSans-Regular.ttf: "Noto Sans" "Regular"
estan@edison:
$

Using FF 96 on Ubuntu 20.04.

Is there some kind of fontconfig rule (alias?) that explicitly says "Montserrat" should be replaced with "Noto Sans", or is that simply the default you're getting in response to an unrecognized font name?

(What does fc-match SomeOtherRandomUnknownName return? Also "Noto Sans"?)

In general, if the CSS has simply font-family: Monserrat (without any generic fallback specified), and Montserrat is not available, I'd expect the browser's default generic to be used, which is normally serif. So I suspect that's what you're seeing, and you could reconfigure it to sans-serif if desired using the Firefox preferences.

Ah true, that is what my fontconfig falls back to if nothing else matches. I just thought that Firefox would adhere to that behavior as well, but I see now that it makes more sense it would have its own fallback to what you configure in preferences.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: