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>
<string>Microsoft Yahei</string>
</test>
<edit mode="assign">
<bool>false</bool>
</edit>
</match>
<!-- forced chinese fonts substitution -->
<match target="pattern">
<test>
<string>Simsun</string>
</test>
<edit>
<string>Microsoft Yahei</string>
</edit>
</match>
<!-- forced english fonts substitution -->
<match target="pattern">
<test qual="any">
<string>Arial</string>
</test>
<edit method="assign">
<string>DejaVu Sans Serif</string>
</edit>
</match>
<match target="pattern">
<test qual="any">
<string>Times</string>
</test>
<edit method="assign">
<string>DejaVu Sans Serif</string>
</edit>
</match>
<match target="pattern">
<test qual="any">
<string>Courier</string>
</test>
<edit method="assign">
<string>DejaVu Sans Mono</string>
</edit>
</match>
<match target="pattern">
<test qual="any">
<string>Helvetica</string>
</test>
<edit method="assign">
<string>DejaVu Sans Serif</string>
</edit>
</match>
<!-- Make sure the DejaVu font matches-->
<match target="pattern">
<test compare="contains">
<string>zh</string>
</test>
<edit 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 mode="assign">
<const>rgb</const>
</edit>
<edit mode="assign">
<bool>true</bool>
</edit>
<edit mode="assign">
<bool>false</bool>
</edit>
<edit mode="assign">
<bool>true</bool>
</edit>
<edit mode="assign">
<const>hintfull</const>
</edit>
</match>
<!-- Turn off embolden for YaHei, as it already has bold face-->
<match target="font">
<test>
<string>Microsoft Yahei</string>
</test>
<edit mode="assign">
<bool>false</bool>
</edit>
</match>
<!-- forced chinese fonts substitution -->
<match target="pattern">
<test>
<string>Simsun</string>
</test>
<edit>
<string>Microsoft Yahei</string>
</edit>
</match>
<!-- forced english fonts substitution -->
<match target="pattern">
<test qual="any">
<string>Arial</string>
</test>
<edit method="assign">
<string>DejaVu Sans Serif</string>
</edit>
</match>
<match target="pattern">
<test qual="any">
<string>Times</string>
</test>
<edit method="assign">
<string>DejaVu Sans Serif</string>
</edit>
</match>
<match target="pattern">
<test qual="any">
<string>Courier</string>
</test>
<edit method="assign">
<string>DejaVu Sans Mono</string>
</edit>
</match>
<match target="pattern">
<test qual="any">
<string>Helvetica</string>
</test>
<edit method="assign">
<string>DejaVu Sans Serif</string>
</edit>
</match>
<!-- Make sure the DejaVu font matches-->
<match target="pattern">
<test compare="contains">
<string>zh</string>
</test>
<edit 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,刷新字体缓存。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/0a24fc1a35d8375cdaac59adbc7a7245.html