Linux系统下安装和配置中文字库的方法_操作系统
内容摘要
Linux的中文都很难看,那么我们如何在Linux下进行安装和配置中文字库呢?
Linux安装开源中文字体的方法
Linux安装开源中文字体的方法
文章正文
Linux的中文都很难看,那么我们如何在Linux下进行安装和配置中文字库呢?
Linux安装开源中文字体的方法
下面以Linux安装开源字库文泉驿为例:
C/C++ Code复制内容到剪贴板
- [inbi@debian ~]#aptitude install -y ttf-bitstream-vera ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy ttf-arphic-ukai ttf-arphic-uming
Linux安装Windows系统的字库
以上配置应该能够满足日常需要了,而且字型也足够美观大方。如果还是觉得不满意,非得偷盗 Windows 的字体才舒服的话,请将偷来的文件放到 $HOME/.fonts/ 目录下,然后运行 sudo fc-cache 即可。
- courbd.ttf
- courbi.ttf
- couri.ttf
- cour.ttf
- Yahei.ttf
- simsun.ttf
- tahomabd.ttf
- tahoma.ttf
- verdanab.ttf
- verdanai.ttf
- verdana.ttf
修改Linux字库配置文件
将以下内容存放到$HOME/.fonts.conf,就可以了。
HTML/XML Code复制内容到剪贴板
- <?xml version='1.0' encoding='utf-8'?>
- <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
- <fontconfig>
- <dir>~/.fonts</dir>
- <match target="font">
- <edit name="autohint"><bool>true</bool></edit>
- <edit name="hintstyle"><const>hintfull</const></edit>
- <edit name="antialias"><bool>true</bool></edit>
- <edit name="rgba" mode="assign"><const>none</const></edit>
- <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
- <edit name="embeddedbitmap" mode="assign"><bool>true</bool></edit>
- </match>
- <match target="font">
- <test name="family">
- <string>Microsoft Yahei</string>
- <string>Andale Mono</string>
- <string>Arial</string>
- <string>Comic Sans MS</string>
- <string>Georgia</string>
- <string>Impact</string>
- <string>Trebuchet MS</string>
- <string>Verdana</string>
- <string>Courier New</string>
- <string>Times New Roman</string>
- <string>Tahoma</string>
- <string>Webdings</string>
- <string>Albany AMT</string>
- <string>Thorndale AMT</string>
- <string>Cumberland AMT</string>
- <string>Andale Sans</string>
- <string>Andy MT</string>
- <string>Bell MT</string>
- <string>Monotype Sorts</string>
- <string>MingLiU</string>
- <string>PMingLiU</string>
- </test>
- <test name="pixelsize" compare="less_eq"><double>16</double></test>
- <edit name="autohint"><bool>false</bool></edit>
- <edit name="antialias"><bool>false</bool></edit>
- <edit name="hinting" mode="assign"><bool>true</bool></edit>
- <edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
- </match>
- <match name="family" target="pattern">
- <test name="family" qual="any">
- <string>Courier</string>
- <string>Courier New</string>
- </test>
- <edit name="lcdfilter" mode="assign"><const>lcdlegacy</const></edit>
- </match>
- <match target="font">
- <test target="pattern" name="lang" compare="contains">
- <string>zh</string>
- <string>ja</string>
- <string>ko</string>
- </test>
- <edit name="spacing"><const>proportional</const></edit>
- <edit name="globaladvance"><bool>false</bool></edit>
- </match>
- <match target="pattern">
- <test name="family" qual="any">
- <string>SimSun</string>
- <string>宋体</string>
- </test>
- <edit mode="assign" name="family">
- <string>WenQuanYi Bitmap Song</string>
- <string>Evermore Song</string>
- <string>AR PL ShanHeiSun Uni</string>
- </edit>
- </match>
- <match target="pattern">
- <test name="family" qual="any">
- <string>WenQuanYi Bitmap Song</string>
- <string>Evermore Song</string>
- <string>永中宋体</string>
- </test>
- <test compare="less" name="pixelsize" qual="any">
- <double>13</double>
- </test>
- <edit mode="assign" name="family">
- <string>WenQuanYi Zen Hei</string>
- </edit>
- </match>
- <match target="pattern">
- <test name="family" qual="any">
- <string>WenQuanYi Bitmap Song</string>
- </test>
- <test compare="more" name="pixelsize" qual="any">
- <double>16</double>
- </test>
- <edit mode="assign" name="family">
- <string>WenQuanYi Zen Hei</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>mono</string>
- </test>
- <edit name="family" mode="assign">
- <string>monospace</string>
- </edit>
- </match>
- <match target="pattern">
- <test qual="any" name="family">
- <string>sans serif</string>
- <string>sans</string>
- </test>
- <edit name="family" mode="assign">
- <string>sans-serif</string>
- </edit>
- </match>
- <match target="font">
- <test name="family" qual="any">
- <string>AR PL ShanHeiSun Uni</string>
- <string>AR PL New Sung</string>
- <string>NSimSun</string>
- <string>MingLiu</string>
- <string>PMingLiu</string>
- </test>
- <test name="pixelsize" compare="less_eq">
- <double>13</double>
- </test>
- <edit name="pixelsize" mode="assign">
- <double>13</double>
- </edit>
- </match>
- <alias>
- <family>serif</family>
- <prefer>
- <family>DejaVu Serif</family>
- <family>WenQuanYi Bitmap Song</family>
- <family>WenQuanYi Zen Hei Sharp</family>
- <family>Bitstream Vera Serif</family>
- <family>AR PL ShanHeiSun Uni</family>
- <family>AR PL UMing CN</family>
- <family>AR PL UMing TW</family>
- <family>AR PL SungtiL GB</family>
- <family>Evermore Song</family>
- <family>AR PL UMing TW</family>
- <family>Liberation Serif</family>
- <family>Bitstream Charter</family>
- <family>Droid Serif</family>
- <family>Luxi Serif</family>
- <family>FreeSerif</family>
- <family>Tahoma</family>
- <family>Verdana</family>
- <family>Arial</family>
- </prefer>
- </alias>
- <alias>
- <family>sans-serif</family>
- <prefer>
- <string>Microsoft Yahei</string>
- <string>WenQuanYi Micro Hei</string>
- <family>WenQuanYi Zen Hei</family>
- <family>DejaVu Sans</family>
- <family>Bitstream Vera Sans</family>
- <family>Droid Sans</family>
- <family>Luxi Sans</family>
- <family>Tahoma</family>
- <family>Verdana</family>
- <family>Arial</family>
- </prefer>
- </alias>
- <alias>
- <family>monospace</family>
- <prefer>
- <family>WenQuanYi Zen Hei Mono</family>
- <family>WenQuanYi Micro Hei Mono</family>
- <family>DejaVu Sans Mono</family>
- <family>Droid Sans Mono</family>
- <family>Bitstream Vera Sans Mono</family>
- <family>WenQuanYi Zen Hei Sharp</family>
- <family>Liberation Sans Mono</family>
- <family>Luxi Mono</family>
- <family>Nimbus Mono L</family>
- <family>Andale Mono</family>
- <family>FreeMono</family>
- <family>Tahoma</family>
- <family>Verdana</family>
- <family>Arial</family>
- </prefer>
- </alias>
- </fontconfig>
代码注释
[!--zhushi--]