Monday, January 28, 2013

Smooth Font Rendering on Fedora 18

Add following lines to the file /etc/fonts/local.conf or the file ~/.fonts.conf

<?xml version='1.0'?>
  <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
  <fontconfig>
    <!-- See: man 5 fonts-conf -->
    <!-- Antialias rules -->
    <match target="font">

      <edit name="autohint" mode="assign"> <bool>true</bool> </edit>
   
      <!--Subpixel smoothing: rgb, bgr, vrgb, vbgr, none-->
      <edit mode="assign" name="rgba"><const>vrgb</const></edit>
     
      <!-- Use hint? true/false. Usually true-->
      <edit mode="assign" name="hinting"><bool>true</bool></edit>
     
      <!-- Hint: hintfull, hintmedium, hintslight, hintnone -->
      <edit mode="assign" name="hintstyle"><const>hintmedium</const></edit>
     
      <!-- By default, apply antialias to all, filter on the following lines -->
      <edit mode="assign" name="antialias"><bool>true</bool></edit>
    </match>
   
    <!-- If fonts are smaller than X, then don't antialias-->
    <match target="font">
      <test compare="less" name="size" qual="any">
        <int>6</int>
      </test>
      <edit mode="assign" name="antialias">
        <bool>false</bool>
      </edit>
    </match>
   
    <!-- If BOLD fonts are smaller than Y, then don't antialias-->
    <match target="font">
      <test compare="more_eq" name="weight" qual="any">
        <const>medium</const>
      </test>
      <test compare="less" name="size" qual="any">
        <int>6</int>
      </test>
      <edit mode="assign" name="antialias">
        <bool>false</bool>
      </edit>
    </match>
   
    <!-- Firefox fix (it uses pixelsize, instead of size) -->
    <match target="font">
      <test compare="less" name="pixelsize" qual="any">
        <int>10</int>
      </test>
      <edit name="antialias" mode="assign">
        <bool>false</bool>
      </edit>
    </match>

    <!-- Firefox fix BOLD (it uses pixelsize, instead of size) -->
    <match target="font">
      <test compare="more_eq" name="weight" qual="any">
        <const>medium</const>
      </test>
      <test compare="less" name="pixelsize" qual="any">
        <int>10</int>
      </test>
      <edit name="antialias" mode="assign">
        <bool>false</bool>
      </edit>
    </match>
  </fontconfig>

No comments:

Post a Comment