Johan Kiviniemi’s series of tubes

Fixing the font rendering in Ubuntu


News: Martin Ankerl posted screenshots comparing the font renderers.

If you’re like me and hate the blurry font rendering used by default in Ubuntu since 8.04 (hardy), you might want to install the following config files:


Since the filename begins with 99, these settings override pretty much everything else.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
  <match target="font">
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
    <edit name="hinting" mode="assign"><bool>true</bool></edit>
    <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
    <edit name="lcdfilter" mode="assign"><const>lcdlegacy</const></edit>
    <edit name="rgba" mode="assign"><const>rgb</const></edit>

Change lcdlegacy to lcdfilterlegacy if you’re running 8.04.


As of this writing, cairo is unable to read the settings from fontconfig, so let’s add the equivalent X resources for cairo applications to obey.

Xft.antialias:  true
Xft.hinting:    true
Xft.hintstyle:  hintfull
Xft.lcdfilter:  lcdlegacy
Xft.rgba:       rgb

Again, change lcdlegacy to lcdfilterlegacy if you’re running 8.04.

Explanation of my issue with the default font rendering

The default font renderer draws translucent subpixels – a.k.a. blur – around vertical lines. That makes text less readable.

The legacy renderer draws all horizontal and vertical lines without any translucent pixels/subpixels. Only oblique lines and curves are rendered with antialiasing. That means the text is as sharp as possible with the display technology.

© 2011 Johan Kiviniemi

The image of a giraffe is from Wikimedia Commons