You are not logged in.
Proof:archlinux use Japanese font to render Chinese character by default.
Create a new folder named "增" after new installation and fcitx ,fcitx-pinyin,it will be shown as below,it is the Japanese font "vlgothic".:
The character shown with "Microsoft YaHei"
The os always to render Chinese character with some kind of Japanese font such as "vlgothic",if i delete the font ,i have not chance to watch Japan webpage with it,in order to fix it,i set the fonts.conf according to V1del suggestion in the "https://bbs.archlinux.org/viewtopic.php?id=281091",at first show the fonts.conf in my arch:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<!-- $XDG_CONFIG_HOME/fontconfig/fonts.conf for per-user font configuration -->
<fontconfig>
<dir prefix="xdg">fonts</dir>
<match target="font">
<edit name="rgba" mode="assign"><const>rgb</const></edit>
</match>
<match>
<test name="lang" compare="eq">
<string>en</string>
</test>
<edit name="family" mode="assign">
<string>Hack</string>
</edit>
<edit name="family" mode="append">
<string>Microsoft YaHei</string>
</edit>
</match>
<match>
<test name="lang" compare="eq">
<string>zh</string>
</test>
<edit name="family" mode="assign">
<string>Microsoft YaHei</string>
</edit>
</match>
<alias>
<family>serif</family>
<prefer>
<family>Microsoft YaHei</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Microsoft YaHei</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Microsoft YaHei</family>
</prefer>
</alias>
</fontconfig>Now new issue arise after reboot,all the Chinese characters are rendered with "Microsoft YaHei",you can't call any other fonts!
Here is a simple html file:
<html>
<style>
p.s1{
font-family:Microfost YaHei;
font-size:60px;
}
p.s2{
font-family:KaiTi;
font-size:60px;
}
p.s3{
font-family:FangSong;
font-size:60px;
}
p.s4{
font-family:NSimSun;
font-size:60px;
}
</style>
<!-- mean test -->
<p class="s1">测试</p>
<p class="s2">测试</p>
<p class="s3">测试</p>
<p class="s4">测试</p>
</html>In my windows system ,it is shown as below by firefox:
The fonts are so large that anyone can see the difference between the four fonts--Microsoft YaHei,KaiTi,FangSong,NSimSun.
It is time to prove my observation in arch ,i open the html file with same browser "firefox" in arch:
How can set the fonts.conf properly to achieve my target?
1.not always call Japanese font "vlgothic" to render Chinese character(already solved)
2.allow browser call different font setting in the html file's style (unsolved)
All the four fonts are in my os:
fc-list :lang=zh | rg -e "Microsoft YaHei" -e "KaiTi" -e "FangSong" -e "NSimSun" |sort | tail -n 4
/usr/share/fonts/msfonts/msyh.ttc: Microsoft YaHei,微软雅黑:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/msfonts/simfang.ttf: FangSong,仿宋:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/msfonts/simkai.ttf: KaiTi,楷体:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/msfonts/simsun.ttc: NSimSun,新宋体:style=Regular,常规It is a not good idea to remove all Japanese fonts to solve the issue.
fc-list :lang=ja |rg -o '([^:]+):([^:]+):(.+)' -r '$1' |xargs sudo rm -f {}Last edited by luofeiyu (2022-11-19 14:21:14)
Offline
<match>
<test name="lang" compare="eq">
<string>zh</string>
</test>
<edit name="family" mode="assign">
<string>Microsoft YaHei</string>
</edit>
</match>Makes every chinese marked text use MS YaHei all the time.
You may want to have a prefer list there instead or prepend the font(s), https://wiki.archlinux.org/title/Font_c … es#Chinese
Offline
It can't solve anyone of the two problems.
With your setting:
1.chinese character rendered by Japanese font.
2.the browser only call Microsoft YaHei to render ,no matter what you specify font in the html's style.
With my setting :
<match>
<test name="lang" compare="eq">
<string>en</string>
</test>
<edit name="family" mode="assign">
<string>Hack</string>
</edit>
<edit name="family" mode="append">
<string>Microsoft YaHei</string>
</edit>
</match>1.All English character rendered with "Hack" font.
2.All Chinese character rendered with "Microsoft YaHei" font.
3.No matter what font specified in the html's style ,the os still call "Microsoft YaHei" font to render.
The key important points are :
1.To make the Chinese character not rendered by Japanese font in os.
As i pointed out by posted image here ,that the os call Japanese font to show Chinese character by default,it is un-natural for me to read all these Chinese characters in Japanese format!!!
In our street no character displayed such way,they are absolutely different from our daylife scene.If a new font created ,you can't distinguish from "9" and "q" ,how do you feel?
I can remove it by force in my os and do not write anything in the "fonts.conf" to solve all the two problems,but i want to let it display Japanese character when i read some Japanese webpage.
2.To make the browser not be affected by the setting in "fonts.conf"?
How to make the browser not be affected by the setting in "fonts.conf"?
It is clear that the setting in "fonts.conf" control browser to display character ,browser will not call fonts according to html's style setting.
To make my target more clear:
Location:
In os' folder name and filename in desktop ,file manager,terminal's ui.
Fonts in above location:
All English character in these location shown by "Hack" font,all Chinese character in these location shown by "Microsoft YaHei".
Browser:
The browser can call fonts freely according to style setting "font-family:xxxxx" in html file.
Last edited by luofeiyu (2022-11-19 11:56:07)
Offline
It can't solve anyone of the two problems.
The posted snippet cannot solve anything - it's in your config and the problem and the reason that ll chinese text is rendered in "Microsoft YaHei" - you're rewriting the font resolution and the rule that you are *currently* using says "if this is chinese text, assign the font family to "Microsoft YaHei""
Offline
No,seth,i don't agree with you.It solve the problem at the same time new issue arise with my setting.Now the problem is how to solve the problem without any new bad effect.
Offline
I don't care whether you agree - this isn't an opion contest.
The snippet I quoted i #2 is thre reason why every chinese text uses "Microsoft YaHei" - whether you "agree" with that or not.
Edit: do you speak english or are we communicating via google translate?
Last edited by seth (2022-11-19 14:10:13)
Offline
Thank to seth's link,i solved it with "https://wiki.archlinux.org/title/Font_c … es#Chinese".
It is no matter to use "noto cjk" or "YaHei",i remove all Microsoft fonts and install noto with:
sudo pacman -S fonts-noto-cjkMy fonts.conf:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<match target="font">
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
</match>
<match>
<test qual="any" name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Noto Serif</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Noto Sans</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Noto Sans Mono</string>
</edit>
</match>
<match>
<test name="lang" compare="contains">
<string>zh</string>
</test>
<test name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend">
<string>Noto Serif CJK SC</string>
</edit>
</match>
<match>
<test name="lang" compare="contains">
<string>zh</string>
</test>
<test name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend">
<string>Noto Sans CJK SC</string>
</edit>
</match>
<match>
<test name="lang" compare="contains">
<string>zh</string>
</test>
<test name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend">
<string>Noto Sans Mono CJK SC</string>
</edit>
</match>
</fontconfig>Done,all target achieved.
Last edited by luofeiyu (2022-11-19 14:32:30)
Offline
This has nothing to do w/ Noto.
The problem in your original snippet is
<match>
<test name="lang" compare="eq">
<string>zh</string>
</test>
<edit name="family" mode="assign">
<string>Microsoft YaHei</string>
</edit>
</match>This will resolve "Microsoft YaHei" for *any* chinese text.
What you wanted instead is eg.
<match>
<test name="lang" compare="eq">
<string>zh</string>
</test>
<edit name="family" mode="prepend">
<string>Microsoft YaHei</string>
</edit>
</match>What would *prefer* "Microsoft YaHei" for any chinese text, but not prevent the explicit resolution of existing fonts.
You will find that pattern in the fonts.conf you copied from the wiki - the example uses Noto, but it can be applied to any other font you desire.
Offline
Almost can't speak English,no chance to speak with native speaker,we are communicating via web translater ,so sometimes i can't grasp what expert say,please write simple sentence and simple word.
Last edited by luofeiyu (2022-11-19 14:51:59)
Offline