this post was submitted on 29 Apr 2025
11 points (86.7% liked)

Linux

3189 readers
12 users here now

founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Coelacanthus 1 points 1 day ago (1 children)

So when they will change this horrible hardcode font fallback list with "normal" font fallback mechanism like Fontconfig?

https://github.com/pop-os/cosmic-text/blob/main/src/font/fallback/unix.rs

[–] vga@sopuli.xyz 1 points 20 hours ago (1 children)

That's a pretty specific nitpick. Did this cause you grief?

[–] Coelacanthus 1 points 46 minutes ago

Because not all language and all users requirements is simple.

For example in CJK, we have too many characters (over 97k) to packed in one font. And we have many font style. So when put them together, we need to modify the font fallback list by user so users can make font at the right place to avoid some characters are sans-serif (Heiti), some are serif (Songti/Mingti), some are Kaiti and some are Fangsong. And in CJK, for same characters, it have different glyph in zh-CN, zh-TW, zh-HK, ko and ja. So we need different fallback list for different locale.

In Arabic and Urdu, the situation is worse. They use almost same characters, Arabic alphabet, but use different style: Arabic use Naskh, Urdu use Nastaliq. These two styles are very different if you only learned one it's hard to read another. So you must specify different font fallback list for different locale.

And it's not the end. Persian use Persian alphebet which is basically Arabic alphabet but plus 4 new alphabets. Unlike Arabic and Urdu only use one style, they use Nasteliq for poetry and Naskh for others. So just depends on locale is not enough for Persian, users need a way to customize font fallback list per UI elements, like CSS in HTML. Of course, it's so difficult to implement that only a few application support it. I write here here just to tell you the font fallback is a complex thing and it's impossible just using a simple per script list.

And the last issue is for all language users: it's hardcode, so you can't choose your favorite one. They said it's TODO to implement configurable default, but there is still no code, and I can't image the deal time of the configurable fallback list, and of further font fallback mechanism with font replacement features and font OpenType control features and so on. If they choose use wide-used Fontconfig instead of re-invent a square wheel, they can gain all these features with only a few code.

https://github.com/pop-os/cosmic-text/blob/f7033bb0433f6a9ba109007027781ba46ea9ba27/src/font/system.rs#L156