FS#80103 - [noto-fonts-cjk] lack of font scan rules

Attached to Project: Arch Linux
Opened by rather not to say (escape0707) - Monday, 30 October 2023, 05:18 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:26 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Antonio Rojas (arojas)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

In other distros I've tried, they will include a fontconfig file to control the font cache scan procedure, like this: https://src.fedoraproject.org/rpms/google-noto-sans-cjk-vf-fonts/blob/rawhide/f/65-google-noto-sans-cjk-vf-fonts.conf

With this rule included, the scanned font families won't be recognized by fontconfig as they support the language that other families are designed for. Say, if I use `fc-match sans:lang=ja` then `Noto Sans CJK SC` won't be recognized as supports Japanese language.

But currently this Arch package lacks of this config file. This make user config harder to make. For example, I'm using Japanese locale, but I want to prefer "Noto Sans CJK SC" whenever the document/application doesn't hint a `lang` attribute, so I define:

```
<match target="pattern">
<test name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend">
<string>Noto Sans CJK SC</string>
<string>Noto Color Emoji</string>
</edit>
</match>
```

But this won't work for my previous `fc-match sans:lang=ja` example again, as `Noto Sans CJK SC` will be treated as a font family that can display `ja` language. Thus effectively forcing me to read `SC` fonts everywhere. This won't happen in a Fedora linux system.

Additional info:
* package version(s): noto-fonts-cjk 20230817-1 (any)
* config and/or log files etc.: https://src.fedoraproject.org/rpms/google-noto-sans-cjk-vf-fonts/blob/rawhide/f/65-google-noto-sans-cjk-vf-fonts.conf
* link to upstream bug report, if any

Steps to reproduce:

Query `fc-match sans:lang=ja` when setting `Noto Sans CJK SC` as a weak prefer over `sans-serif`.
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:26 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/noto-fonts-cjk/issues/ 1
Comment by rather not to say (escape0707) - Monday, 30 October 2023, 05:40 GMT
The user font config I'm using with the Fedora conf file and works:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="family">
<string>serif</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>sans-serif</string>
</edit>
</match>

<match target="pattern">
<test name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Noto Sans</string>
</edit>
<edit name="family" mode="prepend">
<string>Noto Sans CJK SC</string>
<string>Noto Color Emoji</string>
</edit>
</match>


<match target="pattern">
<test name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Fira Code</string>
<string>Noto Sans Mono</string>
</edit>
<edit name="family" mode="prepend">
<string>Noto Sans Mono CJK SC</string>
<string>Noto Color Emoji</string>
</edit>
</match>
</fontconfig>
Comment by Toolybird (Toolybird) - Monday, 30 October 2023, 19:58 GMT
Thanks for the ticket...but a couple of comments:

1. Arch is not Fedora. Arch has a different philosophy [1] and you very much need to configure stuff yourself.
2. What you are requesting looks basically like configuration. So...just configure it?
3. There is no "lack" of anything which makes this a Feature Request and not a Bug Report

But let's see what the PM thinks..

[1] https://wiki.archlinux.org/title/Arch_Linux#Simplicity
Comment by rather not to say (escape0707) - Thursday, 02 November 2023, 22:46 GMT
Sorry for the late reply. I don't know why I didn't get any email notification for replies even if I "watched" this report. And I don't know that I can't edit the original post after submitting it.

Anyway, let me explain the necessity of a scan rules config further in this reply. The config file currently installed with the package does lack the ability to scan Noto CJK font families and setting their `langset` according to what they should support/are designed for. This renders the fontconfig "weak binding prefer lang matching first" mechanism useless for Noto CJK users, displays wrong glyphs in other CJK variant, and creates surprises for Linux newcomers when figuring how to write their own fontconfig preferences. Plus, the way the proposed config used to solve this issue is not well documented in both Arch Wiki and fontconfig's website. Finally, since the scanning of system-wide installed fonts could only be tweaked by putting a scan rules config in /etc/fonts/conf.d rather than ~/.config/fontconfig, I think it's better to let package managers to handle this config file.

Nowadays, experienced CN Arch Linux community members fall back to suggest people to use single-file Adobe Source Sans CJK, which defeated the original goal to provide a No Tofu font family for CJK users by publishing Noto CJK. Thus, I think the proper fix should be the scan rules way. (And the Source Sans CJK trick doesn't solve my problem, either. It will always default to the locale lang when no lang hint is provided, but I want to prefer a CJK family other than my system locale as I often read contents in that language.)

When thinking about whether this is a lack of a normal function or a feature request, I have to say that I don't know why Noto Sans CJK (upstream?) makes all the font families supports all the langsets, and I believe that showing the correct glyph for the text should be an essential function of a font. But you are right, I'm not experienced in the font distributing topic.

I acknowledge that the config file mentioned above only appeared in Fedora/Rocky Linux series distros. In Debian repo, I can only see the 70-.....conf, too. If distributing the config through packaging is not a preferable way to solve the issue, then maybe I'll then fall back to editing the Arch Wiki about Noto CJK fonts to notice the users, although I prefer this to be out of the box for everyone.

Loading...