Linux系统下安装和配置中文字库的方法

2011-09-01 18:40:43来源:ITwhy作者:

Linux的中文都很难看,那么我们如何在Linux下进行安装和配置中文字库呢?

Linux的中文都很难看,那么我们如何在Linux下进行安装和配置中文字库呢?

Linux安装开源中文字体的方法

下面以Linux安装开源字库文泉驿为例:

C/C++ Code复制内容到剪贴板
  1. [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复制内容到剪贴板
  1. <?xml version='1.0' encoding='utf-8'?>  
  2. <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>  
  3. <fontconfig>  
  4. <dir>~/.fonts</dir>  
  5. <match target="font">  
  6.     <edit name="autohint"><bool>true</bool></edit>  
  7.     <edit name="hintstyle"><const>hintfull</const></edit>  
  8.     <edit name="antialias"><bool>true</bool></edit>  
  9.     <edit name="rgba" mode="assign"><const>none</const></edit>  
  10.     <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>  
  11.     <edit name="embeddedbitmap" mode="assign"><bool>true</bool></edit>  
  12. </match>  
  13. <match target="font">  
  14.     <test name="family">  
  15.         <string>Microsoft Yahei</string>  
  16.         <string>Andale Mono</string>  
  17.         <string>Arial</string>  
  18.         <string>Comic Sans MS</string>  
  19.         <string>Georgia</string>  
  20.         <string>Impact</string>  
  21.         <string>Trebuchet MS</string>  
  22.         <string>Verdana</string>  
  23.         <string>Courier New</string>  
  24.         <string>Times New Roman</string>  
  25.         <string>Tahoma</string>  
  26.         <string>Webdings</string>  
  27.         <string>Albany AMT</string>  
  28.         <string>Thorndale AMT</string>  
  29.         <string>Cumberland AMT</string>  
  30.         <string>Andale Sans</string>  
  31.         <string>Andy MT</string>  
  32.         <string>Bell MT</string>  
  33.         <string>Monotype Sorts</string>  
  34.         <string>MingLiU</string>  
  35.         <string>PMingLiU</string>  
  36.     </test>  
  37.     <test name="pixelsize" compare="less_eq"><double>16</double></test>  
  38.     <edit name="autohint"><bool>false</bool></edit>  
  39.     <edit name="antialias"><bool>false</bool></edit>  
  40.     <edit name="hinting" mode="assign"><bool>true</bool></edit>  
  41.     <edit mode="assign" name="hintstyle"><const>hintslight</const></edit>  
  42. </match>  
  43. <match name="family" target="pattern">  
  44.     <test name="family" qual="any">  
  45.         <string>Courier</string>  
  46.         <string>Courier New</string>  
  47.     </test>  
  48.     <edit name="lcdfilter" mode="assign"><const>lcdlegacy</const></edit>  
  49. </match>  
  50. <match target="font">  
  51.     <test target="pattern" name="lang" compare="contains">  
  52.         <string>zh</string>  
  53.         <string>ja</string>  
  54.         <string>ko</string>  
  55.     </test>  
  56.     <edit name="spacing"><const>proportional</const></edit>  
  57.     <edit name="globaladvance"><bool>false</bool></edit>  
  58. </match>  
  59. <match target="pattern">  
  60.     <test name="family" qual="any">  
  61.         <string>SimSun</string>  
  62.         <string>宋体</string>  
  63.     </test>  
  64.     <edit mode="assign" name="family">  
  65.         <string>WenQuanYi Bitmap Song</string>  
  66.         <string>Evermore Song</string>  
  67.         <string>AR PL ShanHeiSun Uni</string>  
  68.     </edit>  
  69. </match>  
  70. <match target="pattern">  
  71.     <test name="family" qual="any">  
  72.         <string>WenQuanYi Bitmap Song</string>  
  73.         <string>Evermore Song</string>  
  74.         <string>永中宋体</string>  
  75.     </test>  
  76.     <test compare="less" name="pixelsize" qual="any">  
  77.         <double>13</double>  
  78.     </test>  
  79.     <edit mode="assign" name="family">  
  80.         <string>WenQuanYi Zen Hei</string>  
  81.     </edit>  
  82. </match>  
  83. <match target="pattern">  
  84.     <test name="family" qual="any">  
  85.         <string>WenQuanYi Bitmap Song</string>  
  86.     </test>  
  87.     <test compare="more" name="pixelsize" qual="any">  
  88.     <double>16</double>  
  89.     </test>  
  90.         <edit mode="assign" name="family">  
  91.     <string>WenQuanYi Zen Hei</string>  
  92.     </edit>  
  93. </match>  
  94. <match target="pattern">  
  95.     <test qual="any" name="family">  
  96.         <string>mono</string>  
  97.     </test>  
  98.     <edit name="family" mode="assign">  
  99.         <string>monospace</string>  
  100.     </edit>  
  101. </match>  
  102. <match target="pattern">  
  103.     <test qual="any" name="family">  
  104.         <string>sans serif</string>  
  105.         <string>sans</string>  
  106.     </test>  
  107.     <edit name="family" mode="assign">  
  108.         <string>sans-serif</string>  
  109.     </edit>  
  110. </match>  
  111. <match target="font">  
  112.     <test name="family" qual="any">  
  113.         <string>AR PL ShanHeiSun Uni</string>  
  114.         <string>AR PL New Sung</string>  
  115.         <string>NSimSun</string>  
  116.         <string>MingLiu</string>  
  117.         <string>PMingLiu</string>  
  118.     </test>  
  119.     <test name="pixelsize" compare="less_eq">  
  120.         <double>13</double>  
  121.     </test>  
  122.     <edit name="pixelsize" mode="assign">  
  123.         <double>13</double>  
  124.     </edit>  
  125. </match>  
  126. <alias>  
  127.     <family>serif</family>  
  128.     <prefer>  
  129.         <family>DejaVu Serif</family>  
  130.         <family>WenQuanYi Bitmap Song</family>  
  131.         <family>WenQuanYi Zen Hei Sharp</family>  
  132.         <family>Bitstream Vera Serif</family>  
  133.         <family>AR PL ShanHeiSun Uni</family>  
  134.         <family>AR PL UMing CN</family>  
  135.         <family>AR PL UMing TW</family>  
  136.         <family>AR PL SungtiL GB</family>  
  137.         <family>Evermore Song</family>  
  138.         <family>AR PL UMing TW</family>  
  139.         <family>Liberation Serif</family>  
  140.         <family>Bitstream Charter</family>  
  141.         <family>Droid Serif</family>  
  142.         <family>Luxi Serif</family>  
  143.         <family>FreeSerif</family>  
  144.         <family>Tahoma</family>  
  145.         <family>Verdana</family>  
  146.         <family>Arial</family>  
  147.     </prefer>  
  148. </alias>  
  149. <alias>  
  150.     <family>sans-serif</family>  
  151.     <prefer>  
  152.         <string>Microsoft Yahei</string>  
  153.         <string>WenQuanYi Micro Hei</string>  
  154.         <family>WenQuanYi Zen Hei</family>  
  155.         <family>DejaVu Sans</family>  
  156.         <family>Bitstream Vera Sans</family>  
  157.         <family>Droid Sans</family>  
  158.         <family>Luxi Sans</family>  
  159.         <family>Tahoma</family>  
  160.         <family>Verdana</family>  
  161.         <family>Arial</family>  
  162.     </prefer>  
  163. </alias>  
  164. <alias>  
  165.     <family>monospace</family>  
  166.     <prefer>  
  167.         <family>WenQuanYi Zen Hei Mono</family>  
  168.         <family>WenQuanYi Micro Hei Mono</family>  
  169.         <family>DejaVu Sans Mono</family>  
  170.         <family>Droid Sans Mono</family>  
  171.         <family>Bitstream Vera Sans Mono</family>  
  172.         <family>WenQuanYi Zen Hei Sharp</family>  
  173.         <family>Liberation Sans Mono</family>  
  174.         <family>Luxi Mono</family>  
  175.         <family>Nimbus Mono L</family>  
  176.         <family>Andale Mono</family>  
  177.         <family>FreeMono</family>  
  178.         <family>Tahoma</family>  
  179.         <family>Verdana</family>  
  180.         <family>Arial</family>  
  181.     </prefer>  
  182. </alias>  
  183. </fontconfig>  

 

关键词:Linux字库

赞助商链接: