感谢支持
我们一直在努力

ubuntu7.10下使用雅黑字体

1.得到雅黑字体,并且拷贝到/usr/share/fonts/zh_CN下面,如果没有zh_CN,就自己新建一个。


接着(很重要),修改字体的权限,改为755或者干脆777


2.在/usr/share/fonts/zh_CN下面运行
sudo mkfontscale
sudo mkfontdir


3.将配置文件拷贝到/etc/fonts/conf.avail/99-myfonts.conf


针对液晶和纯平配置文件略又不同。具体如下:


纯平:


CODE:<?xml version=”1.0″ encoding=”utf-8″?>
<!DOCTYPE fontconfig SYSTEM “fonts.dtd”>
<fontconfig>
<!– fonts preference –>
<alias>
<family>serif</family>
<prefer>
<family>DejaVu Serif</family>
<family>Microsoft YaHei</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>DejaVu Sans</family>
<family>Microsoft YaHei</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>DejaVu Sans Mono</family>
<family>Microsoft YaHei</family>
</prefer>
</alias>
<!– Turn off embolden for YaHei, as it already has bold face–>
<match target=”font”>
<test name=”family”>
<string>Microsoft Yahei</string>
</test>
<edit name=”embolden” mode=”assign”>
<bool>false</bool>
</edit>
</match>
<!– forced chinese fonts substitution –>
<match target=”pattern”>
<test name=”family”>
<string>Simsun</string>
</test>
<edit name=”family”>
<string>Microsoft Yahei</string>
</edit>
</match>
<!– forced english fonts substitution –>
<match target=”pattern”>
<test name=”family” qual=”any”>
<string>Arial</string>
</test>
<edit name=”family” method=”assign”>
<string>DejaVu Sans Serif</string>
</edit>
</match>
<match target=”pattern”>
<test name=”family” qual=”any”>
<string>Times</string>
</test>
<edit name=”family” method=”assign”>
<string>DejaVu Sans Serif</string>
</edit>
</match>
<match target=”pattern”>
<test name=”family” qual=”any”>
<string>Courier</string>
</test>
<edit name=”family” method=”assign”>
<string>DejaVu Sans Mono</string>
</edit>
</match>
<match target=”pattern”>
<test name=”family” qual=”any”>
<string>Helvetica</string>
</test>
<edit name=”family” method=”assign”>
<string>DejaVu Sans Serif</string>
</edit>
</match>
<!– Make sure the DejaVu font matches–>
<match target=”pattern”>
<test name=”lang” compare=”contains”>
<string>zh</string>
</test>
<edit name=”lang” method=”assign”>
<string>en</string>
</edit>
</match>
</fontconfig>



液晶:


CODE:<?xml version=”1.0″ encoding=”utf-8″?>
<!DOCTYPE fontconfig SYSTEM “fonts.dtd”>
<fontconfig>
<!– fonts preference –>
<alias>
<family>serif</family>
<prefer>
<family>DejaVu Serif</family>
<family>Microsoft YaHei</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>DejaVu Sans</family>
<family>Microsoft YaHei</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>DejaVu Sans Mono</family>
<family>Microsoft YaHei</family>
</prefer>
</alias>
<!– global setting, using hint –>
<match target=”font”>
<edit name=”rgba” mode=”assign”>
<const>rgb</const>
</edit>
<edit name=”antialias” mode=”assign”>
<bool>true</bool>
</edit>
<edit name=”autohint” mode=”assign”>
<bool>false</bool>
</edit>
<edit name=”hinting” mode=”assign”>
<bool>true</bool>
</edit>
<edit name=”hintstyle” mode=”assign”>
<const>hintfull</const>
</edit>
</match>
<!– Turn off embolden for YaHei, as it already has bold face–>
<match target=”font”>
<test name=”family”>
<string>Microsoft Yahei</string>
</test>
<edit name=”embolden” mode=”assign”>
<bool>false</bool>
</edit>
</match>
<!– forced chinese fonts substitution –>
<match target=”pattern”>
<test name=”family”>
<string>Simsun</string>
</test>
<edit name=”family”>
<string>Microsoft Yahei</string>
</edit>
</match>
<!– forced english fonts substitution –>
<match target=”pattern”>
<test name=”family” qual=”any”>
<string>Arial</string>
</test>
<edit name=”family” method=”assign”>
<string>DejaVu Sans Serif</string>
</edit>
</match>
<match target=”pattern”>
<test name=”family” qual=”any”>
<string>Times</string>
</test>
<edit name=”family” method=”assign”>
<string>DejaVu Sans Serif</string>
</edit>
</match>
<match target=”pattern”>
<test name=”family” qual=”any”>
<string>Courier</string>
</test>
<edit name=”family” method=”assign”>
<string>DejaVu Sans Mono</string>
</edit>
</match>
<match target=”pattern”>
<test name=”family” qual=”any”>
<string>Helvetica</string>
</test>
<edit name=”family” method=”assign”>
<string>DejaVu Sans Serif</string>
</edit>
</match>
<!– Make sure the DejaVu font matches–>
<match target=”pattern”>
<test name=”lang” compare=”contains”>
<string>zh</string>
</test>
<edit name=”lang” method=”assign”>
<string>en</string>
</edit>
</match>
</fontconfig>



4.在/etc/fonts/目录下,首先删除language-selector.conf,然后新建一个指向99-myfont.conf的软链接。


sudo ln -s /etc/fonts/conf.avail/99-myfont.conf language-selector.conf


原来的那个language-selector.conf指向/usr/share/language-selector/fontconfig/zh_CN,如果修改出来问题,可以还原一下。


5.运行 sudo fc-cache -fv,刷新字体缓存。

赞(0) 打赏
转载请注明出处:服务器评测 » ubuntu7.10下使用雅黑字体
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏