[CrunchBang]中文字体美化

时间:2022-10-27 11:17:32

安装必要的字体包

sudo apt-get install ttf-droid ttf-wqy-zenhei xfonts-wqy ttf-wqy-microhei ttf-arphic-ukai ttf-arphic-uming

修改字体配置文件

将以下内容写到存放到你的home目录下,命名为 .fonts.conf,就可以了。

<?xmlversion='1.0'encoding='utf-8'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<alias>
<family>serif</family>
<prefer>
<family>DejaVu Serif</family>
<family>Bitstream Vera Serif</family>
<family>Evermore Song</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL UMing CN</family>
<family>AR PL ShanHeiSun Uni</family>
<family>Droid Sans Fallback</family>
<family>WenQuanYi Micro Hei</family>
<family>WenQuanYi Zen Hei</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>DejaVu Sans</family>
<family>Bitstream Vera Sans</family>
<family>Evermore Song</family>
<family>Droid Sans Fallback</family>
<family>WenQuanYi Micro Hei</family>
<family>WenQuanYi Bitmap Song</family>
<family>WenQuanYi Zen Hei</family>
<family>AR PL UMing CN</family>
<family>AR PL ShanHeiSun Uni</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>DejaVu Sans Mono</family>
<family>Bitstream Vera Sans Mono</family>
<family>Evermore Song</family>
<family>WenQuanYi Micro Hei Mono</family>
<family>WenQuanYi Zen Hei Mono</family>
<family>Droid Sans Fallback</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL UMing CN</family>
<family>AR PL ShanHeiSun Uni</family>
</prefer>
</alias>
<!-- Default Alias -->
<alias>
<family>DejaVu Sans</family>
<default>
<family>sans-serif</family>
</default>
</alias>
<!-- Generic font families -->
<matchtarget="pattern">
<testname="family"qual="any">
<string>serif</string>
</test>
<editbinding="strong"mode="prepend"name="family">
<string>DejaVu Serif</string>
</edit>
</match>
<matchtarget="pattern">
<testname="family"qual="any">
<string>sans-serif</string>
</test>
<editbinding="strong"mode="prepend"name="family">
<string>DejaVu Sans</string>
</edit>
</match>
<matchtarget="pattern">
<testname="family"qual="any">
<string>monospace</string>
</test>
<editbinding="strong"mode="prepend"name="family">
<string>DejaVu Sans Mono</string>
</edit>
</match>
<!-- Anti-alias -->
<matchtarget="font">
<editname="embeddedbitmap">
<bool>false</bool>
</edit>
</match>
<!-- WenQuanYi Bitmap Song -->
<selectfont>
<acceptfont>
<pattern>
<pateltname="family">
<string>WenQuanYi Bitmap Song</string>
</patelt>
</pattern>
</acceptfont>
</selectfont>
<matchtarget="pattern">
<testname="family"qual="any">
<string>WenQuanYi Bitmap Song</string>
</test>
<testcompare="less"name="pixelsize"qual="any">
<double>12</double>
</test>
<editmode="assign"name="family">
<string>WenQuanYi Micro Hei</string>
</edit>
</match>
<matchtarget="pattern">
<testname="family"qual="any">
<string>WenQuanYi Bitmap Song</string>
</test>
<testcompare="more"name="pixelsize"qual="any">
<double>16</double>
</test>
<editmode="assign"name="family">
<string>AR PL ShanHeiSun</string>
</edit>
</match>
<!-- Alias -->
<alias>
<family>SimSun</family>
<family>宋体</family>
<accept>
<family>Evermore Song</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ShanHeiSun Uni</family>
</accept>
<default>
<family>serif</family>
</default>
</alias>
<alias>
<family>SimHei</family>
<family>黑体</family>
<accept>
<family>WenQuanYi Micro Hei</family>
<family>WenQuanYi Zen Hei</family>
</accept>
<default>
<family>sans-serif</family>
</default>
</alias>
<alias>
<family>微软雅黑</family>
<family>Microsoft YaHei</family>
<accept>
<family>WenQuanYi Micro Hei</family>
<family>WenQuanYi Zen Hei</family>
</accept>
<default>
<family>sans-serif</family>
</default>
</alias>
<!-- End -->
<matchtarget="font">
<editmode="assign"name="rgba">
<const>rgb</const>
</edit>
</match>
<matchtarget="font">
<editmode="assign"name="hinting">
<bool>true</bool>
</edit>
</match>
<matchtarget="font">
<editmode="assign"name="hintstyle">
<const>hintfull</const>
</edit>
</match>
<matchtarget="font">
<editmode="assign"name="antialias">
<bool>true</bool>
</edit>
</match>
<dir>~/.fonts</dir>
</fontconfig>

Konsole 字体

Konsole 下还是坚持使用 DejaVu Sans Mono 字体,那个字体更适合工作。

Chrome

Chrome 的字体渲染原则很奇怪,如果我们直接使用默认配置的话,它会选择一个很奇怪的日文字体来渲染中文,对于日文字体里不存在的中文文字,它又会 Fallback 到另外一个奇怪的中文字体上。滇狐目前没太多时间和精力来详细调查这个现象,

解决这个问题最简单的方法就是把 Chrome 里的默认字体和 Sans 字体全都强制指定“Droid Sans Fallback”上,效果还不错。至于 Serif 字体,我们可以使用“Droid Serif”,Monospace 字体就用“Droid Sans Mono”,这样风格比较统一。