Qt and Fontconfig

Posted on 04 September 2010  •  Permalink  •  Category ubuntu

After upgrading to Lucid Lynx I found that all Qt based applications would not have anti-aliased fonts anymore. For example Skype would look awful with these pixelated fonts. Unfortunately Google didn’t help me out, so I started a little research of my own into this issue. I was previously able to tweak font settings using ~/.fonts.conf so I thought to start there.

To make a very long story a whole lot shorter; assigning pixelsize turns off font hinting for Qt apps. I wasn’t able to figure out why, but I did find a solution for my particular setup, resulting in the following ~/.fonts.conf:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <match target="font">
    <test qual="all" name="family" compare="eq"><string>Arial</string></test>
    <test qual="all" name="pixelsize" compare="eq"><double>12</double></test>
    <edit name="pixelsize" mode="assign"><double>13</double></edit>
  </match>
</fontconfig>

You really have to look carefully to notice the difference with the original: it’s the qual="all" attribute in both test nodes. That did the trick for me.