Weird font hinting in Firefox 4

I know this a recurrent topic but I just can't find a decent solution--although I found one for Chrome.

Just take look at the following screenshots:

  • Chrome 9

    alt text

  • Firefox 4

    alt text

See the slight difference? I can't identify the exact difference but I can tell fonts in Chrome look smoother.

Here are my system preferences (prefer to show a screenshot as I don't know the exact translations in English):

alt text

Anyone got a solution? Thanks.

Update: from my point of view, it doesn't seem to actually be a hinting problem. I'd say Firefox uses subpixel rendering instead of grayscale rendering. (yet I can't find the setting in fontconfig) But this is a subjective opinion, can you confirm?


Firefox (correctly) uses fontconfig to determine the font properties based on a set of rules, and then falls back to the GNOME settings for any properties that were not determined by fontconfig. This allows you to configure things such as per-font hinting settings etc.

The issue is that we (incorrectly) ship the match-all rules in fontconfig for antialias and hinting settings. This means that the fontconfig settings always override the GNOME settings in Firefox, and is really a bug in our fontconfig package.

This looks like part of the problem that you are seeing.

To fix this, you can do the following:

sudo rm /etc/fonts/conf.d/10-*

Note that /etc/fonts/conf.d just contains a set of symlinks to the full set of configuration files in /etc/fonts/conf.avail. To restore the default configuration in Ubuntu, you can run:

cd /etc/fonts/conf.d
sudo ln -s /etc/fonts/conf.avail/10-antialias.conf
sudo ln -s /etc/fonts/conf.avail/10-hinting.conf
sudo ln -s /etc/fonts/conf.avail/10-hinting-slight.conf

Also, your fonts may look slightly different depending on which build of Firefox you use. The Ubuntu build of Firefox carries a cairo patch to turn on Freetype LCD filtering, which will make its fonts look similar to those of other applications and reduce colour fringing.

The official mozilla.org build does not have this patch, and its fonts will have noticeably more colour fringing compared to fonts in other applications.


The suggestion from previous threads (I think I have one lurking around somewhere) is Firefox doesn't look to Gnome for font hinting settings, it goes to fontconfig which isn't synced in.

So if you're using full-hinting, you want something like this:

cd /etc/fonts/conf.d/
sudo rm 10-hinting-slight.conf
sudo ln -s ../conf.avail/10-hinting-full.conf
sudo dpkg-reconfigure fontconfig

There are literally dozens of suggested fixes in this bug report though. I suggest you look for the saner looking ones, give them a try and if they don't work, have a go with the less sane looking ones.

I'll try and track down what fixed it for me. I remember it was ridiculously simple.


I had something like this problem a while back, and tried all the stuff suggested in those posts. What finally fixed it for me was simply removing ~/.fonts.conf (after a backup, of course).

The reason I think this works is because the system-wide config is in /etc/font/fonts.conf, and that file gets generated by fontconfig. I think my problematic ~/.fonts.conf was left over from a much older (Dapper Drake era) install.