Skip to content

Fontconfig not respecting font.conf family preference order for zh locale.

Hello,

This is my local font config: https://pastebin.com/BQjnH16Q

My current LANG is zh_CN.UTF-8 (the same value also applies to all variables in the output of $ locale (except LC_ALL is empty)

Problem

My terminal shows monospace using Noto Sans CJK for LANG = zh_CN.UTF-8.

$ fc-match -s sans returns Noto on top and no Code New Roman in the list.

NotoSansCJK-Regular.ttc: "Noto Sans CJK SC" "Regular"
Delicious-Roman.otf: "Delicious" "Roman"
Delicious-Italic.otf: "Delicious" "Italic"
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"
DejaVuSans.ttf: "DejaVu Sans" "Book"
....

For LANG=en_US.UTF8 everything is fine, I see monospace with Code New Roman with fallbacks working as the order in the file.

$ fc-match -s sans returns Code New Roman on the top.

Code New Roman.otf: "Code New Roman" "Regular"
NotoSansCJK-Regular.ttc: "Noto Sans CJK SC" "Regular"
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
NimbusMonoPS-Regular.otf: "Nimbus Mono PS" "Regular"
...

If it matters, to find the languages Code New Roman supports, I issued the following command fc-list : family : style : lang | grep -i 'code new roman' and it turns out [1] that it doesn't support zh. Although none of the fonts in my system, except Noto, support zh but some of them still appear in fc-match -s for zh-CN.UTF8 so not sure if this indeed the issue.

What I want is to have Code New Roman as the default font for mono. How can I achieve this?

[1] Code New Roman:style=Regular:lang=aa|ab|af|ast|av|ay|az-az|ba|bm|be|bg|bi|bin|br|bs|bua|ca|ce|ch|chm|co|cs|cu|cv|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|ff|fur|fy|ga|gd|gl|gn|gv|ha|haw|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|kaa|ki|kk|kl|kum|kv|kw|ky|la|lb|lez|ln|lt|lv|mg|mh|mi|mk|mo|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ro|ru|sah|sco|se|sel|sh|shs|sk|sl|sm|sma|smj|smn|sms|so|sq|sr|ss|st|sv|sw|tg|tk|tl|tn|to|tr|ts|tt|tw|tyv|uk|uz|ve|vi|vo|vot|wa|wen|wo|xh|yap|yo|zu|ak|an|ber-dz|crh|csb|ee|fat|fil|hsb|ht|hz|jv|kab|kj|kr|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|nv|pap-an|pap-aw|qu|quz|rn|rw|sc|sg|sn|su|ty|za

Edited 11 Apr 2019. We only hold this version.

7 points2 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
7 · 100% up
Kind
Text
ID
bbwkau

Author

11
posts
56
comments
1
media
View profile

2 comments

try this for zh monospace and let me know:

​

<match target="pattern">
<test name="lang" compare="contains">
<string>zh</string>
</test>
<test name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Code New Roman</string>
</edit>
</match>
2 points

This worked, thank you!

I know I'm asking for too much but it seems a bit of a hack to my almost-completely-not-knowledgeable mind.

My line of thought is why should I need to prepend when I already mention a preference list.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.