* Fix Arabic falling back to Nastaliq in Chromium and Electron apps * Cover the widened patterns too, and leave Urdu in Nastaliq The weak binding only won the last-resort race for patterns fontconfig had not widened. Anything whose family expands through the latin and nonlatin alias chains -- Arial, Helvetica, Verdana, sans-serif, and so the bulk of real CSS -- still resolved Arabic to Kufi, a display face that suits body text no better than Nastaliq did. A strong binding wins those too. Charset matching outranks family matching either way, so a font that does not cover the codepoint still cannot be pulled in: Latin, monospace, emoji, Nerd Font glyphs and CJK all resolve as before. The untargeted rule also captured Urdu, which #6322 had deliberately left alone by scoping itself to lang=ar. Urdu is conventionally set in Nastaliq, so name it for lang=ur ahead of the Naskh append. Appended rather than prepended, or it would displace the family the app asked for and render Latin text in an Urdu locale as Nastaliq. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mb1gPTJ6s7QyQZck7Z6F9v --------- Co-authored-by: David Heinemeier Hansson <david@hey.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
127 lines
3.4 KiB
XML
127 lines
3.4 KiB
XML
<?xml version="1.0"?>
|
|
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
|
<fontconfig>
|
|
<match target="pattern">
|
|
<test name="family" qual="any">
|
|
<string>sans-serif</string>
|
|
</test>
|
|
<edit name="family" mode="assign" binding="strong">
|
|
<string>Liberation Sans</string>
|
|
</edit>
|
|
</match>
|
|
|
|
<match target="pattern">
|
|
<test name="family" qual="any">
|
|
<string>serif</string>
|
|
</test>
|
|
<edit name="family" mode="assign" binding="strong">
|
|
<string>Liberation Serif</string>
|
|
</edit>
|
|
</match>
|
|
|
|
<match target="pattern">
|
|
<test name="family" qual="any">
|
|
<string>monospace</string>
|
|
</test>
|
|
<edit name="family" mode="assign" binding="strong">
|
|
<string>JetBrainsMono Nerd Font</string>
|
|
</edit>
|
|
</match>
|
|
|
|
<!-- Arabic: prefer Naskh (standard Arabic) over Nastaliq (Urdu style) -->
|
|
<match target="pattern">
|
|
<test name="lang" compare="contains">
|
|
<string>ar</string>
|
|
</test>
|
|
<edit name="family" mode="prepend" binding="strong">
|
|
<string>Noto Naskh Arabic</string>
|
|
</edit>
|
|
</match>
|
|
|
|
<!-- Urdu is conventionally set in Nastaliq, so keep it there. Without this
|
|
the untargeted Naskh rule below would capture Urdu too. Appended rather
|
|
than prepended so it only wins the last-resort race against that rule
|
|
and never displaces the family the app actually asked for. -->
|
|
<match target="pattern">
|
|
<test name="lang" compare="contains">
|
|
<string>ur</string>
|
|
</test>
|
|
<edit name="family" mode="append" binding="strong">
|
|
<string>Noto Nastaliq Urdu</string>
|
|
</edit>
|
|
</match>
|
|
|
|
<!-- Chromium and Electron resolve missing glyphs one character at a time
|
|
without lang on the pattern, so the rules above never fire for them and
|
|
fontconfig falls through to a raw charset scan that lands on Nastaliq
|
|
(or on Kufi, once the latin alias chains have widened the pattern).
|
|
Naming Naskh as a last-resort family covers that path. Appending keeps
|
|
it behind every family the app actually asked for, and charset matching
|
|
outranks family matching, so a font that does not cover the codepoint
|
|
can never be pulled in: Latin, monospace, emoji, Nerd Font glyphs and
|
|
CJK all resolve exactly as before. -->
|
|
<match target="pattern">
|
|
<edit name="family" mode="append" binding="strong">
|
|
<string>Noto Naskh Arabic</string>
|
|
</edit>
|
|
</match>
|
|
|
|
<alias>
|
|
<family>system-ui</family>
|
|
<prefer>
|
|
<family>Liberation Sans</family>
|
|
</prefer>
|
|
</alias>
|
|
|
|
<alias>
|
|
<family>ui-monospace</family>
|
|
<default>
|
|
<family>monospace</family>
|
|
</default>
|
|
</alias>
|
|
|
|
<alias>
|
|
<family>-apple-system</family>
|
|
<prefer>
|
|
<family>Liberation Sans</family>
|
|
</prefer>
|
|
</alias>
|
|
|
|
<alias>
|
|
<family>BlinkMacSystemFont</family>
|
|
<prefer>
|
|
<family>Liberation Sans</family>
|
|
</prefer>
|
|
</alias>
|
|
|
|
<alias>
|
|
<family>Liberation Sans</family>
|
|
<accept>
|
|
<family>JetBrainsMono Nerd Font</family>
|
|
<family>Noto Color Emoji</family>
|
|
</accept>
|
|
</alias>
|
|
|
|
<alias>
|
|
<family>sans-serif</family>
|
|
<accept>
|
|
<family>JetBrainsMono Nerd Font</family>
|
|
<family>Noto Color Emoji</family>
|
|
</accept>
|
|
</alias>
|
|
|
|
<alias>
|
|
<family>serif</family>
|
|
<accept>
|
|
<family>Noto Color Emoji</family>
|
|
</accept>
|
|
</alias>
|
|
|
|
<alias>
|
|
<family>monospace</family>
|
|
<accept>
|
|
<family>Noto Color Emoji</family>
|
|
</accept>
|
|
</alias>
|
|
</fontconfig>
|