My Fontconfig

~/.config/fontconfig/fonts.conf:

< ?xml version='1.0'?>
< !DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <dir>~/.fonts</dir>
 <alias>
  <family>serif</family>
  <prefer>
   <family>Bitstream Vera Serif</family>
   <family>DejaVu Serif</family>
   <family>FreeSerif</family>
   <family>Liberation Serif</family>
   <family>WenQuanYi Micro Hei</family>
  </prefer>
 </alias>
 <alias>
  <family>sans-serif</family>
  <prefer>
   <family>Bitstream Vera Sans</family>
   <family>DejaVu Sans</family>
   <family>FreeSans</family>
   <family>Liberation Sans</family>
   <family>WenQuanYi Micro Hei</family>
  </prefer>
 </alias>
 <alias>
  <family>monospace</family>
  <prefer>
   <family>Bitstream Vera Sans Mono</family>
   <family>DejaVu Sans Mono</family>
   <family>FreeMono</family>
   <family>Liberation Mono</family>
   <family>WenQuanYi Micro Hei Mono</family>
  </prefer>
 </alias>
 <!-- general configurations -->
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
  <edit mode="assign" name="lcdfilter">
   <const>lcdlegacy</const>
  </edit>
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
  <edit mode="assign" name="hinting">
   <bool>false</bool>
  </edit>
  <edit mode="assign" name="hintstyle">
   <const>hintnone</const>
  </edit>
  <edit mode="assign" name="autohint">
   <bool>false</bool>
  </edit>
 </match>
 <!-- For not Chinese fonts -->
 <match target="font">
  <test compare="not_contains" name="lang">
   <string>zh</string>
  </test>
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
  <edit mode="assign" name="lcdfilter">
   <const>lcdlight</const>
  </edit>
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
  <edit mode="assign" name="autohint">
   <bool>false</bool>
  </edit>
 </match>
 <!-- WenQuanYi Micro Hei -->
 <match target="font">
  <test compare="eq" name="family">
   <string>WenQuanYi Micro Hei</string>
  </test>
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
  <edit mode="assign" name="lcdfilter">
   <const>lcdnone</const>
  </edit>
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
  <edit mode="assign" name="autohint">
   <bool>false</bool>
  </edit>
 </match>
 <match target="font">
  <test compare="eq" name="family">
   <string>WenQuanYi Micro Hei Mono</string>
  </test>
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
  <edit mode="assign" name="lcdfilter">
   <const>lcdnone</const>
  </edit>
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
  <edit mode="assign" name="autohint">
   <bool>false</bool>
  </edit>
 </match>
 <!--換掉文泉驛的英文部份,subpixel rendering 比較好看-->
 <match target="pattern">
  <test compare="eq" name="family">
   <string>WenQuanYi Micro Hei</string>
  </test>
  <edit binding="strong" mode="prepend" name="family">
   <string>Bitstream Vera Sans</string>
  </edit>
 </match>
 <match target="pattern">
  <test compare="eq" name="family">
   <string>WenQuanYi Micro Hei Mono</string>
  </test>
  <edit binding="strong" mode="prepend" name="family">
   <string>Bitstream Vera Sans Mono</string>
  </edit>
 </match>
 <!-- specific config -->
 <!-- bold fonts -->
 <match target="font">
  <test target="pattern" compare="more_eq" name="weight">
   <!--<test compare="more_eq" name="weight">-->
   <!--<int>180-->
   <const>semibold</const>
  </test>
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
  <edit mode="assign" name="lcdfilter">
   <const>lcddefault</const>
  </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>hintmedium</const>
  </edit>
  <edit mode="assign" name="autohint">
   <bool>false</bool>
  </edit>
 </match>
 <!-- very small fonts -->
 <match target="font">
  <test compare="less_eq" name="pixelsize">
   <double>12</double>
  </test>
  <!--設定字型最小尺寸-->
  <!--<edit mode="assign" name="pixelsize">-->
  <!--<double>12-->
  <!--</edit>-->
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
 </match>
</fontconfig>

這應該是我能調整的最終型態了,能讓 KDE (Qt) 與 GNOME (Gtk+) 底下的程式都有接近的、清晰的筆畫顯示品質,同時考慮到中、英文字型的 rendering 差異、大字小字、普通與粗體等。

CC BY-SA 4.0 This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *