Adventures in fontconfig on the Mac

Like some in the Mac community, I have grown picky about the way text appears on the screen. Opinions on font rendering can be a very personal and deeply held. To each his own. I use a cross platform financial package called Gnucash that runs under X11. For a long time, I had tolerated the ugly way text was displayed on the screen. Now I have finally found a combination of settings that makes text look about as good as X applications in Linux, if not quite as good as “native” Mac applications.

The magic formula for me was to turn off hinting in my .fonts.conf file. Subpixel rendering is a toss-up.

Hinting messes with the shape and spacing of letter to increase contrast, and in the opinion of some, readability. However, between my vision and the high resolution of the display, it just makes text look ugly and uneven to me.

Subpixel rendering takes advantage of the construction of LCD panels to make text appear sharper. I am undecided about which setting is better for X applications, but at least now I know how to change it.

Another big help was to change the default font of GTK applications. I like the Liberation font these days, and it looks pretty nice as the application font. I simply created a .gtkrc-2.0 file in my home directory with the contents:

gtk-font-name = "Liberation Sans 10"

The contents of the new .fonts.conf in my home directory are below. Changing the rgba section from rgb to none turns off subpixel rendering.

<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font" >
  <edit mode="assign" name="hinting" >
    <bool>false</bool>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="rgba" >
    <const>rgb</const>
  </edit>
</match>
<match target="font" >
  <edit mode="assign" name="antialias" >
    <bool>true</bool>
  </edit>
</match>
</fontconfig>

The pictures below show a before (left) and after (right) look at the improvement. It’s not world peace or anything, but it is more pleasant to look at than before.

font-fix

Leave a Reply