Fixing ugly fonts on GNU/Linux

XFCE

Some months ago when I replaced my Ubuntu 10.10 (Maverick Merkat) by Debian 6.0 (Squeeze) XFCE, on my work computer, it happened that the font rendering were very ugly, the desktop in general looked ugly then I found some interesting trick at the Arch Linux wiki, after reading: Font Configuration, I execute the following steps:

Enable RGB sub-pixel rendering

$ mkdir ~/.fonts.conf.d
$ ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf ~/.fonts.conf.d

Create $HOME/.fonts.conf

$ touch .fonts.conf

.fonts.conf is an xml file with the following format

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <!-- settings go here -->
</fontconfig>

Enable Anti-aliasing

 <match target="font">
    <edit name="antialias" mode="assign">
      <bool>true</bool>
    </edit>
  </match>

Use normal hinting

  <match target="font">
    <edit name="hinting" mode="assign">
      <bool>true</bool>
    </edit>
  </match>

Set the hinting style

  <match target="font">
    <edit name="hintstyle" mode="assign">
      <const>hintfull</const>
    </edit>
  </match>

Set LCD filter

 <match target="font">
    <edit mode="assign" name="lcdfilter">
      <const>lcddefault</const>
    </edit>
  </match>

After I executed above steps on my Debian XFCE fonts look very sharp, here my .fonts.conf and a screenshot

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

  <!-- settings go here -->
  <match target="font">
    <edit name="antialias" mode="assign">
      <bool>true</bool>
    </edit>
  </match>
  <match target="font">
    <edit name="hinting" mode="assign">
      <bool>true</bool>
    </edit>
  </match>
  <match target="font">
    <edit name="hintstyle" mode="assign">
      <const>hintfull</const>
    </edit>
  </match>
  <match target="font">
    <edit mode="assign" name="lcdfilter">
      <const>lcddefault</const>
    </edit>
  </match>
</fontconfig>
Debian XFCE  (mousepad, iceweasel, thunar)
Debian XFCE (mousepad, iceweasel, thunar)

Further reading

* Font Configuration

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.