7

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?

1
  • Subpixel rendering is used on both screenshots, you can see color pixels around the edges on black letters when you zoom in. On the other hand hinting is in fact slightly different. Mar 17, 2011 at 22:21

5 Answers 5

9

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.

3

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.

1
  • 1
    Thank you. I've tried this, and as I'm not using hinting I linked 10-unhinted.conf. It works for Chrome, but no for Firefox.
    – seriousdev
    Mar 10, 2011 at 21:30
1

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.

1
  • At the beginning I didn't have this file. Therefore that couldn't be the problem.
    – seriousdev
    Mar 13, 2011 at 20:00
0
+100

I realized this problem too; but instead of solving it only for Firefox, I generally turned off the Subpixel rendering. Read more about it at:

http://www.smashingmagazine.com/2009/11/02/the-ails-of-typographic-anti-aliasing/ .

You can make the changes here (System > Preferences > Appearance):
http://dl.dropbox.com/u/3008404/Font_settings_v2.png

With this setting you can avoid the ugly color deformations at the edges of characters (it used to annoy me a lot after I realized them). In the other end - you'll pay with the legibility of those really tiny characters (Font Hinting helps at this point).

To me, this seemed to be the only possible way; i can't stand those color-misbehaviours.

1
  • Yes, I ended up with this solution. I think it's the best we can get obviously.
    – seriousdev
    Mar 18, 2011 at 19:08
0

If I remember right, Firefox uses the file ~/.fonts.conf to get his font-settings. If it doesn't exist, just create it with the following content:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
  </match>
  <match target="font">
    <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
  </match>
</fontconfig>
1
  • Already tried this will all the possible combinations. Unfortunately, the two fonts don't match.
    – seriousdev
    Mar 13, 2011 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .