Manjaro比ubuntu对中文的支持还要差劲,虽然设置为中文,但默认显示的却是日文字体,丑到爆。
首先,安装自己喜欢的字体,找到这个字体名(如,系统设置 - 字体,在修改字体的时候能看到安装的字体名是什么)。
我安装了方正悠宋和锤黑体,默认字体为锤黑。等宽字体安装了Manaco。
创建fontconfig目录
mkdir ~/.config/fontconfig
创建fonts.conf文件
vim .config/fontconfig/fonts.conf
将下面的配置文件复制进去(请选跟据自己安装的字体进行修改):
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Manjaro Font Config</description>
<!-- Font directory list -->
<dir>/usr/share/fonts</dir>
<dir>/usr/local/share/fonts</dir>
<dir prefix="xdg">fonts</dir>
<dir>~/.fonts</dir> <!-- this line will be removed in the future -->
<!-- 自动微调 微调 抗锯齿 内嵌点阵字体 -->
<match target="font">
<edit name="autohint"> <bool>false</bool> </edit>
<edit name="hinting"> <bool>true</bool> </edit>
<edit name="antialias"> <bool>true</bool> </edit>
<edit name="embeddedbitmap" mode="assign"> <bool>false</bool> </edit>
</match>
<!-- 英文默认字体使用 Roboto 和 Noto Serif ,等宽字体使用 Monaco。第二行为缺省字体,如果第一个字体没有某字符,则使用第二个字体 -->
<match>
<test qual="any" name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Noto Serif</string>
<string>方正悠宋 GBK</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Roboto</string>
<string>Smartisan Compact CNS</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Monaco</string>
</edit>
</match>
<!-- 中文默认字体使用锤黑,不使用 Noto Sans CJK SC 是因为这个字体会在特定情况下显示片假字. -->
<match>
<test name="lang" compare="contains">
<string>zh</string>
</test>
<test name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend">
<string>方正悠宋 GBK</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>Smartisan Compact CNS</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>Monaco</string>
<string>Smartisan Compact CNS</string>
</edit>
</match>
<!-- 把Linux没有的中文字体映射到已有字体,这样当这些字体未安装时会有替代字体 -->
<match target="pattern">
<test qual="any" name="family">
<string>SimHei</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>Smartisan Compact CNS</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>SimSun</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>Smartisan Compact CNS</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>SimSun-18030</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>Smartisan Compact CNS</string>
</edit>
</match>
<!--
<match target="pattern">
<test qual="any" name="family">
<string>Smartisan Compact CNS</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>Smartisan Compact CNS</string>
</edit>
</match>
-->
<!-- Load local system customization file -->
<include ignore_missing="yes">conf.d</include>
<!-- Font cache directory list -->
<cachedir>/var/cache/fontconfig</cachedir>
<cachedir prefix="xdg">fontconfig</cachedir>
<!-- will be removed in the future -->
<cachedir>~/.fontconfig</cachedir>
<config>
<!-- Rescan in every 30s when FcFontSetList is called -->
<rescan> <int>30</int> </rescan>
</config>
</fontconfig>
重启电脑即可生效。
网友评论