https://bugzilla.redhat.com/show_bug.cgi?id=2013083
Bug ID: 2013083 Summary: 31-cantarell.conf causes inconsistent font choice for numerals and symbols when the system locale is zh-* Product: Fedora Version: 35 Status: NEW Component: abattis-cantarell-fonts Assignee: klember@redhat.com Reporter: vtq-gnome@outlook.com QA Contact: extras-qa@fedoraproject.org CC: cosimo.cecchi@gmail.com, fonts-bugs@lists.fedoraproject.org, klember@redhat.com, mark@net-c.com, me@fale.io, tagoh@redhat.com Target Milestone: --- Link ID: GNOME Gitlab GNOME/gnome-shell/-/issues/4683 Classification: Fedora
Created attachment 1832054 --> https://bugzilla.redhat.com/attachment.cgi?id=1832054&action=edit Inconsistent font for numerals and symbols in Nautilus
Description of problem:
In Fedora Workstation, the GNOME desktop is using Cantarell as its main font. However, the following section in /etc/fonts/conf.d/31-cantarell.conf, which comes from Fedora's abattis-cantarell-fonts package, allows the font choice to be overridden:
<match target="pattern"> <test qual="any" name="family"> <string>Cantarell</string> </test> <edit name="family" mode="assign" binding="weak"> <string>Cantarell</string> </edit> </match>
$ env LANG=en_US.utf8 fc-match Cantarell Cantarell-Regular.otf: "Cantarell" "Regular" $ env LANG=zh_CN.utf8 fc-match Cantarell NotoSansCJK-Regular.ttc: "Noto Sans CJK SC" "Regular"
GTK/Pango seems to select a font based on the language of the text, and the decision is affected by the context. When the text is only numerals and symbols it will assume the language from the locale. This kind of decisions seems to be reasonable too. So for example, Latin script will still be displayed with Cantarell. "1234567890" will be displayed with Noto Sans CJK while "1234567890 GNOME" will be displayed with Cantarell (see screenshot): $ env LANG=zh_CN.utf8 pango-view --markup -t '<span face="Cantarell" font_features="tnum" size="xx-large">1234567890</span>' $ env LANG=zh_CN.utf8 pango-view --markup -t '<span face="Cantarell" font_features="tnum" size="xx-large">1234567890 GNOME</span>'
As a result, numerals and symbols in the GNOME UI are sometimes displayed with Cantarell and sometimes displayed with Noto Sans CJK (see screenshots). The inconsistency makes the UI appear broken. This is especially noticeable for time in various places of the UI, because time is displayed in Noto Sans CJK and the separator between hour and minute (a ratio symbol, which is a full-width glyth in Noto Sans CJK and many other CJK fonts) has extra blank space around it. (See https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4683)
Version-Release number of selected component (if applicable):
0.301-3.fc35
How reproducible:
Always
Steps to Reproduce:
1. In GNOME desktop, choose "中文 臺灣", "中文 香港", or "汉语 中国" in "Settings" – "Region & Language" – "Language". 2. Log out & log in.
Actual results:
Numerals and symbols in the GNOME UI are sometimes displayed with Cantarell and sometimes displayed with Noto Sans CJK (see screenshots).
Expected results:
Numerals and symbols should be consistently displayed with the same font, ideally the same as the Latin alphabet. Since GNOME explicitly requests Cantarell as UI font, Cantarell should be used here. Noto Sans CJK would only be used as fallback for Chinese characters which are not covered by Cantarell.
Note that other common Latin fonts in the system are not overridden by Noto Sans CJK like Cantarell is: $ env LANG=zh_CN.utf8 fc-match "DejaVu Sans" DejaVuSans.ttf: "DejaVu Sans" "Regular" $ env LANG=zh_CN.utf8 fc-match "Liberation Sans" LiberationSans-Regular.ttf: "Liberation Sans" "Regular" $ env LANG=zh_CN.utf8 fc-match "Nimbus Sans" NimbusSans-Regular.otf: "Nimbus Sans" "Regular"
Generally in mixed use of Latin and Chinese fonts, it is common to use the selected Latin font for numbers and symbols and only fallback to the Chinese font for glyths not covered. This is seen in word processors (e.g. LibreOffice), Flatpak apps (because the Freedesktop runtime doesn't have font config similar to the 31-cantarell.conf), as well as other OS (e.g. MacOS, Android).
By deleting the previously mentioned fontconfig section in 31-cantarell.conf, the expected results can be achieved (see screenshots).
env LANG=zh_CN.utf8 fc-match Cantarell Cantarell-Regular.otf: "Cantarell" "Regular"
Additional info:
In my test without the relevant fontconfig section everything seems to be working very well and I've not noticed any adverse effect. But I'm not aware of why it was originally included in the package.
An alternative solution is to use Noto Sans CJK for everything if the locale is zh-*. But this is less favorable because it's against upstream choice of Cantarell and needs a change in gsettings-desktop-schemas for these locales. The clock separator issue would additionally need workarounds in Nautilus and in GNOME translations to fix.