Search This Blog

Ubuntu 中文字体美化方案大全 (6): 使用免费文泉驿正黑字体

首先,下载安装文泉驿正黑字体,做好准备工作
然后,编辑下面4个文件:



1. /etc/fonts/conf.d/69-language-selector-zh-cn.conf
<fontconfig>

 <match target="pattern">
  <test name="family" qual="any">
   <string>serif</string>
  </test>
  <edit binding="strong" mode="prepend" name="family">
   <string>Liberation Serif</string>
   <string>WenQuanYi Zen Hei</string>
   <string>WenQuanYi Bitmap Song</string>
  </edit>
 </match> 
 <match target="pattern">
  <test name="family" qual="any">
   <string>sans-serif</string>
  </test>
  <edit binding="strong" mode="prepend" name="family">
   <string>Liberation Sans</string>
   <string>WenQuanYi Zen Hei</string>
   <string>WenQuanYi Bitmap Song</string>
  </edit>
 </match> 
 <match target="pattern">
  <test name="family" qual="any">
   <string>monospace</string>
  </test>
  <edit binding="strong" mode="prepend" name="family">
   <string>Liberation Mono</string>
   <string>WenQuanYi Zen Hei</string>
   <string>WenQuanYi Bitmap Song</string>
  </edit>
 </match> 

</fontconfig>


2. /etc/fonts/conf.d/99-language-selector-zh.conf
<fontconfig>

 
        <match target="font">
                <test compare="contains" name="family">
                        <string>Song</string>
                        <string>Sun</string>
                        <string>Kai</string>
                        <string>Ming</string>
                        <string>Hei</string>
                        <string>LiSu</string>
                </test>
                
                <test compare="less_eq" name="weight">
                        <int>100</int>
                </test>
                <test compare="more_eq" name="weight" target="pattern">
                        <int>180</int>
                </test>
                <edit mode="assign" name="embolden">
                        <bool>true</bool>
                </edit>
        </match>

 
 <selectfont>
  <rejectfont>
   <pattern><patelt name="family"><string>SimSun</string></patelt></pattern>
  </rejectfont>
 </selectfont>
 <alias>
  <family>SimSun</family>
  <prefer>
   <family>WenQuanYi Zen Hei</family>
  </prefer>
 </alias>

</fontconfig>


3. /etc/fonts/conf.avail/44-wqy-zenhei.conf


<fontconfig>
  
  <match target="font">
        <test name="family" qual="any">
                <string>WenQuanYi Zen Hei</string>
                <string>文泉驿正黑</string>
                <string>文泉驛正黑</string>
        </test> 
        <edit name="globaladvance"><bool>false</bool></edit>
        <edit name="spacing"><int>0</int></edit>
        <edit mode="assign" name="antialias"><bool>true</bool></edit>
        <edit mode="assign" name="hinting"><bool>true</bool></edit>
        <edit mode="assign" name="hintstyle"><const>hintnone</const></edit>
        <edit mode="assign" name="autohint"><bool>false</bool></edit>
        <edit mode="assign" name="rh_prefer_bitmaps"><bool>false</bool></edit>
        <edit mode="assign" name="rgba"><const>none</const></edit>
        <edit name="embeddedbitmap"><bool>false</bool></edit>
  </match>
  <alias>
      <family>WenQuanYi Zen Hei</family>
      <default><family>sans-serif</family></default>
  </alias>
</fontconfig>


4. /etc/fonts/conf.avail/66-wqy-zenhei-sharp.conf
<fontconfig>
   <match target="font">
        <test name="family" qual="any">
                <string>WenQuanYi Zen Hei</string>
                <string>文泉驿正黑</string>
                <string>文泉驛正黑</string>
        </test>
        <test compare="less_eq" name="pixelsize"><double>17</double></test>
        <edit mode="assign" name="antialias"><bool>false</bool></edit>
        <edit mode="assign" name="embeddedbitmap"><bool>true</bool></edit>
        <edit mode="assign" name="hinting"><bool>false</bool></edit>
  </match>
  <match target="font">
        <test name="family" qual="any">
                <string>WenQuanYi Zen Hei</string>
                <string>文泉驿正黑</string>
                <string>文泉驛正黑</string>
        </test>
        <test compare="less_eq" name="pixelsize"><double>12</double></test>
        <edit mode="assign" name="pixelsize"><double>12</double></edit>
  </match>
  <match target="font">
        <test name="family" qual="any">
                <string>WenQuanYi Zen Hei</string>
                <string>文泉驿正黑</string>
                <string>文泉驛正黑</string>
        </test>
        <test compare="more" name="pixelsize"><double>12</double></test>
        <test compare="less_eq" name="pixelsize"><double>17</double></test>
        <edit mode="assign" name="pixelsize"><double>15</double></edit>
  </match>
</fontconfig>

最后,重启XWindow
  • Log out
  • Ctrl + Alt + Backspace 重启XWindow, 使配置生效

[参考文献]

























No comments:

Post a Comment