标签:dbi bitmap lan family live pac 匹配 mic contains
fontconfig会优先读 $XDG_CONFIG_HOME/fontconfig/fonts.conf
的配置,因此自定义配置优先级更高。没有才会读 /etc/fonts/fonts.conf
之前使用texlive将textlive的字体做为系统字体后,系统的字体显示就变的混乱了,chrome网页中同一段文本既有黑体,又有宋体,因此需要重新设置字体配置。
fc-match -a <字体名>
查询字体名对应的字体文件,会出来一大堆,一般会用第一个。目前猜测是如果第一个中没有所要字形,就会顺序用第二个,依次类推,直到字形被渲染。应该就是网页中同一段部分字体是楷体,部分是黑体的原因。
一般重点是sans-serif
,serif
和monospace
三类字体,自己写fonts.conf
把系统中已有字体加到匹配列表最前面。
修改完fonts.conf后,需要运行 fc-cache -fv
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "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>Source Han Serif SC</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Source Han Sans CN</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Source Han Mono SC</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>Source Han Sans CN</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>Source Han Sans CN</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>Source Han Mono SC</string>
</edit>
</match>
<!--WenQuanYi Zen Hei -> WenQuanYi Micro Hei -->
<match target="pattern">
<test qual="any" name="family">
<string>WenQuanYi Zen Hei</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>WenQuanYi Micro Hei</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>WenQuanYi Zen Hei Lite</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>WenQuanYi Micro Hei Lite</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>WenQuanYi Zen Hei Mono</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>WenQuanYi Micro Hei Mono</string>
</edit>
</match>
<!--Microsoft YaHei, SimHei, SimSun -> WenQuanYi Micro Hei -->
<match target="pattern">
<test qual="any" name="family">
<string>Microsoft YaHei</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>WenQuanYi Micro Hei</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>SimHei</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>WenQuanYi Micro Hei</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>SimSun</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>WenQuanYi Micro Hei</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>SimSun-18030</string>
</test>
<edit name="family" mode="assign" binding="same">
<string>WenQuanYi Micro Hei</string>
</edit>
</match>
</fontconfig>
标签:dbi bitmap lan family live pac 匹配 mic contains
原文地址:https://www.cnblogs.com/wxxr/p/13890401.html