Bad font anti-aliasing in Ubuntu

31,521

Solution 1

There is an old trick to make fonts smoother on Ubuntu (and pretty much every distro running Gnome):

Open up .fonts.conf under your home directory (~/.fonts.conf) and paste this in:

<?xml version="1.0" ?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
   <fontconfig>
      <match target="font">
         <edit name="autohint" mode="assign">
            <bool>true</bool>
         </edit>
      </match>
</fontconfig>

Before:

alt text

After:

alt text

Solution 2

As John said it, the ~/.fonts.conf file is useful to tweak your font configuration.

I eventually figured out how it works after reading this article :

http://www.kilobitspersecond.com/2009/04/17/ubuntu-font-hinting-you-a-cautionary-tale/

Solution 3

Although not directly repsonsive to OP, the answer I came here looking for, and which would have saved me about 60 minutes was:

Don't forget to try turning down your monitor sharpness.

In Windows, I'd used its font-adjustment tool which somehow compensated for my monitor's overly-high sharpness setting. Switching to Ubuntu with the same monitor, I was like "bleagh why does everything look awful". All fonts looked terrible, and also made the color depth look low. Only after trying a wide variety of options, mostly within Ubuntu, did I just start trying every setting on my monitor, and reducing sharpness to zero that solved it.

Share:
31,521

Related videos on Youtube

Juliano
Author by

Juliano

Updated on September 17, 2022

Comments

  • Juliano
    Juliano over 1 year

    I'm switching from Fedora 8 to Ubuntu 9.04, and I can't seem to get it to get a good font anti-aliasing to work. It seems that Ubuntu's fontconfig tries to keep characters in integral pixel widths. This makes text more difficult to read, when 1 pixel is too thin and 2 pixels is too thick.

    Check the image below. In Fedora, when fontconfig anti-aliasing is enabled, fonts have their thickness proportional to the font size. Below, the thickness is different for 8, 9 and 10pt sizes. In Ubuntu, on the other hand, even when anti-aliasing is enabled, all 8, 9 and 10pt sizes have 1 pixel thickness. This makes reading larges amount of text difficult.

    Comparing Fedora 8 and Ubuntu 9.04 font anti-aliasing.

    I'm using the very same home directory, and I already checked that X resources are the same in both systems:

    ~% xrdb -query | grep Xft
    Xft.antialias:  1
    Xft.dpi:        96
    Xft.hinting:    1
    Xft.hintstyle:  hintfull
    Xft.rgba:       none
    

    GNOME settings:

    ~% gconftool-2 -a /desktop/gnome/font_rendering
     antialiasing = grayscale
     hinting = full
     dpi = 96
     rgba_order = rgb
    

    So, the question is: What should I change in the new box (Ubuntu) in order to get anti-aliasing like in the old box (Fedora)?

    • Yaba
      Yaba over 13 years
      Is it just me who thinks that the Ubuntu fonts are much sharper and readable than the Fedora fonts? The Fedora fonts look way too blurry IMHO.
    • Sasha Chedygov
      Sasha Chedygov over 13 years
      I actually like the one on the right more. The one on the left is way too blurry. To each his own, though. ;)
    • Sasha Chedygov
      Sasha Chedygov over 13 years
      @Yaba: Obviously not... You beat me by 17 seconds. :)
    • Juliano
      Juliano over 13 years
      @Yaba, @musicfreak: If you have CRT monitors or have a low resolution, the ones on the left may look too blurry. Otherwise, they better reflect the size of the font. Look at how the thickness of the lines in the right image suddenly jump from 1px to 3px as you increase the font size. This is also bad when it is being projected. The text doesn't become more readable as you increase the font size until it is too big (when it jumps to 3px).
    • Juliano
      Juliano over 13 years
      Also, in the Ubuntu sample, look at how there is a missing pixel in the "k" in "quick" in the third text line, making it look like it was two glyphs, a "|" and a "<".
    • Yaba
      Yaba over 13 years
      @Juliano Then I have the first available Laptop with a built in CRT monitor :-)
  • Juliano
    Juliano over 14 years
    EXACTLY what I was looking for! I played a lot with this file, with 'antialias', 'hinting', 'hintstyle', 'rgba' and 'lcdfilter' options, and nothing helped. 'autohint' did it! Just a note: you must have rgba=none for autohint to work correctly. Seems like autohint is enabled by default in Fedora, but not in Ubuntu.
  • spectro
    spectro over 14 years
    +1. Insane that this isn't surfaced in the font preferences in some way.
  • sml
    sml over 13 years
    Sad reflection on the GNOME philosophy that you even have to ask this question.
  • Juliano
    Juliano over 13 years
    Yes, the hinting option is already known. The "autohint" option, as mentioned by John T, is the option that is missing in that dialog, including in the latest version of Ubuntu.
  • Adam Byrtek
    Adam Byrtek almost 13 years
    @Juliano Auto-hinting works correctly with sub-pixel rendering, so there is no need for rgba=none.
  • Juliano
    Juliano almost 13 years
    @Adam: Are you talking about now or about when this question was asked, back in 2009 (Ubuntu 9.04)?
  • Adam Byrtek
    Adam Byrtek almost 13 years
    Now, I don't know how it was before.
  • bzim
    bzim about 7 years
    I'm using gnome on Debian 8 and doing this + restarting worked for me too. Thanks!
  • törzsmókus
    törzsmókus about 2 years
    thx a million, I was about to tinker a lot but resetting sharpness in OSD to default solved my issue