Closed Bug 1728086 Opened 3 years ago Closed 3 years ago

`system-ui` doesn't use Gnome settings, only fontconfig

Categories

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

Desktop
Linux
defect

Tracking

()

VERIFIED FIXED
93 Branch
Tracking Status
firefox92 --- verified
firefox93 --- verified

People

(Reporter: julienw, Assigned: emilio)

References

Details

Attachments

(4 files)

Since the support of system-ui, some websites changed their appearance, which is expected. But the right font doesn't seem to be selected on my system.

This is happening especially on Github: DejaVu Sans is used according to the devtools.
This is inconsistent with the rest of my system, because in my Gnome, Cantarell is configured instead.

BTW I double-checked in Chrome and I think they select Cantarell indeed (this is especially visible with the # sign).

Here is an real-life page: https://github.com/firefox-devtools/profiler/pulls

Another test page is https://bl.ocks.org/nolanlawson/b72a9e2b9be8710ef0668b7cb968afe3
(from https://nolanlawson.com/2020/05/02/customizing-fonts-in-firefox-on-linux/ which is 1 year old but discuss a similar problem from before we supported system-ui, I believe).

Attached image Github in Chrome stable
Attachment #9238470 - Attachment description: Github in Chrome → Github in Chrome stable
Attachment #9238469 - Attachment description: Github in Firefox → Github in Firefox 93 (20210826213950)

So if you do something like <span style="font: menu">, does cantarell get used? If so I'm not sure what might be going on as we're supposed to just use that font family.

Flags: needinfo?(felash)

What distro are you using, so I can try to repro? On Fedora at least it seems to use the gnome-settings font.

I see this on Debian Testing, in GNOME Shell and Wayland.

data:text/html,<span style="font-family:system-ui">hello

...renders in Bitstream Vera Sans.

data:text/html,<span style="font:menu">hello

...renders in my UI font.

I use Debian stable (the new one: bullseye), recently installed. I didn't configure anything fancy about fonts (yet).

Here:

data:text/html,<span style="font-family:system-ui">hello

gives DejaVu Sans (the fontconfig default font).

data:text/html,<span style="font:menu">hello

gives Cantarell (the Gnome default font).

I'm not sure how Gnome configures the default font. It doesn't look like it does so using fontconfig's configuration files. So it might be a fontconfig / Debian / Gnome issue in the end (?). But it would be nice to understand the underlying issue, and possibly write documentation on support.mozilla.org if we decide it's not an issue on our end.

Flags: needinfo?(felash)

I am experiencing the same behavior with the latest Nightly, on my Ubuntu 21.04 running GNOME shell (wayland): font-family: system-ui gives me DejaVu Sans, font: menu gives me Ubuntu (the default font configured through GNOME).

Ok, I'll try to dig a bit into this on an Ubuntu or Debian VM.

Flags: needinfo?(emilio)
Assignee: nobody → emilio
Status: NEW → ASSIGNED

Comment on attachment 9238663 [details]
Bug 1728086 - Fix system-ui support on Linux distros where Gnome settings aren't mapped to fontconfig. r=jfkthame

Beta/Release Uplift Approval Request

  • User impact if declined: system-ui won't work properly in common distros like Debian and Ubuntu.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Very simple change to use the common code-path for the system-ui generic.
  • String changes made/needed: none
Flags: needinfo?(emilio)
Attachment #9238663 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/df6b2d7ac580 Fix system-ui support on Linux distros where Gnome settings aren't mapped to fontconfig. r=jfkthame

Comment on attachment 9238663 [details]
Bug 1728086 - Fix system-ui support on Linux distros where Gnome settings aren't mapped to fontconfig. r=jfkthame

92 is on release now

Attachment #9238663 - Flags: approval-mozilla-beta? → approval-mozilla-release?

Backed out for failures on system-ui-ar.html

[task 2021-08-31T14:23:51.031Z] 14:23:51     INFO - TEST-START | /css/css-fonts/system-ui-ar.html
[task 2021-08-31T14:23:51.032Z] 14:23:51     INFO - PID 8417 | 1630419831025	Marionette	INFO	Testing http://web-platform.test:8000/css/css-fonts/system-ui-ar.html != http://web-platform.test:8000/css/css-fonts/system-ui-ar-notref.html
[task 2021-08-31T14:23:51.215Z] 14:23:51     INFO - PID 8417 | 1630419831214	Marionette	INFO	No differences allowed
[task 2021-08-31T14:23:51.254Z] 14:23:51     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/system-ui-ar.html | Testing http://web-platform.test:8000/css/css-fonts/system-ui-ar.html != http://web-platform.test:8000/css/css-fonts/system-ui-ar-notref.html
[task 2021-08-31T14:23:51.254Z] 14:23:51     INFO - mismatch reftest has no differences
Flags: needinfo?(emilio)

So I couldn't repro these failures even on a clean Ubuntu 18.04 install, which is what automation supposedly uses. Applying something like this fixes the tests as expected (because we add both the menu family and the fontconfig families to the family list).

Jonathan, does a fixup like that seem reasonable to you? I think the machines on automation just don't have the relevant UI fonts installed...

Flags: needinfo?(emilio) → needinfo?(jfkthame)

Yeah, that looks like it would be OK for now; r=me to update your patch & reland.

(Really, I think we handle system font names at the wrong level altogether, but that's a bigger issue for another bug and another day.)

Flags: needinfo?(jfkthame)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6d1a446c453b Fix system-ui support on Linux distros where Gnome settings aren't mapped to fontconfig. r=jfkthame
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
QA Whiteboard: [qa-triaged]

I have managed to reproduce this issue on Ubuntu 20 (with gnome) in Nightly v93.0a1 from 2021-08-30 and verify the fix in Nightly v93.0a1 2021-08-31 as different fonts are being displayed.
It does not occur in Beta v92.0(RC) so I'm not sure whether an uplift is necessary.

Leaving the qe-verify+ tag until it's certain whether an uplift should be verified.

OS: Unspecified → Linux
Hardware: Unspecified → Desktop

Comment on attachment 9238663 [details]
Bug 1728086 - Fix system-ui support on Linux distros where Gnome settings aren't mapped to fontconfig. r=jfkthame

Approved for 92.0rc2.

Attachment #9238663 - Flags: approval-mozilla-release? → approval-mozilla-release+

I can confirm this is fixed in Nightly, and that I can see the problem in latest beta v92.

I can't seem to reproduce the issue in the Beta channel on the same system with newly downloaded firefox instances of v92.0b8, v92.0b9, v92.0(build1) and neither on v92.0(build2). As I can not reproduce it reliably in Beta channel (weirdly not the case for Nightly channel), I can not verify the uplift.

Julien, could you please verify this uplift considering you're reproduced it?
Any idea why my system will only reproduce it in Nightly?

Flags: needinfo?(felash)

beta v92 20210830174627: KO
beta v92 20210901142158: verified fixed

I don't know why it wouldn't reproduce for you in beta if this reproduces in Nightly :/

Flags: needinfo?(felash)

For anyone coming here wondering how to change the font on Linux, gnome has a tool called "gnome-tweaks" where you can change the default fonts. In firefox you'll need to open a new tab for changes to apply.

Setting as verified based on the comments above.
I will check whether my system has any fonts applied.
Thank you for verification in FF92, Julien!

Status: RESOLVED → VERIFIED
Flags: qe-verify+

(In reply to Natalia Csoregi [:nataliaCs] from comment #14)

Backed out for failures on system-ui-ar.html

[task 2021-08-31T14:23:51.031Z] 14:23:51     INFO - TEST-START | /css/css-fonts/system-ui-ar.html
[task 2021-08-31T14:23:51.032Z] 14:23:51     INFO - PID 8417 | 1630419831025	Marionette	INFO	Testing http://web-platform.test:8000/css/css-fonts/system-ui-ar.html != http://web-platform.test:8000/css/css-fonts/system-ui-ar-notref.html
[task 2021-08-31T14:23:51.215Z] 14:23:51     INFO - PID 8417 | 1630419831214	Marionette	INFO	No differences allowed
[task 2021-08-31T14:23:51.254Z] 14:23:51     INFO - TEST-UNEXPECTED-FAIL | /css/css-fonts/system-ui-ar.html | Testing http://web-platform.test:8000/css/css-fonts/system-ui-ar.html != http://web-platform.test:8000/css/css-fonts/system-ui-ar-notref.html
[task 2021-08-31T14:23:51.254Z] 14:23:51     INFO - mismatch reftest has no differences

== Change summary for alert #31102 (as of Thu, 02 Sep 2021 01:07:11 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
7% amazon FirstVisualChange macosx1014-64-shippable-qr cold webrender 1,169.23 -> 1,083.33
7% amazon dcf macosx1014-64-shippable-qr cold webrender 991.93 -> 921.54
7% amazon fcp macosx1014-64-shippable-qr cold webrender 1,012.57 -> 941.33
7% amazon fnbpaint macosx1014-64-shippable-qr cold webrender 1,024.04 -> 952.17

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=31102

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: