SEARCH

How-To Geek

Enable Smooth fonts on Ubuntu Linux

Ubuntu Linux has an option for font smoothing that isn’t turned on by default for some strange reason. This makes fonts significantly smoother, enough to be very noticable.

To enable this option, you need to edit the .fonts.conf file in your home directory. To create and open the file, run this command and paste in the xml data below it.

gedit ~/.fonts.conf

Paste in this text:

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

You’ll have to log out and back in to see the difference.

Here’s an image of the before:

And here’s an image of the after:

Definitely looks smoother, and is much more readable on my laptop screen.

Tested on: Ubuntu Dapper and Ubuntu Edgy.

Update: Some angry people on digg have pointed out that the original source for this was this Ubuntu Forums post. While I didn’t find it there, I’m going to link back to it, just to be fair.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 10/13/06

Comments (28)

  1. Brent

    Yes, that “strange reason” you are wondering about is that Apple has a patent on what it called “subpixel font-hinting”, i.e. basically the use of RGB colors to create smooth gradients across areas the size of a fraction of a pixel. Linux distros, including Ubuntu, turn this technology off by default because distributing it in the US with it turned on would violate Apple’s intellectual property.

  2. The Geek

    Brent, thanks for the info… I wasn’t aware of that. Good to know.

  3. Diego

    Does it works on Debian unstable? (i don’t wanna try :P)

  4. ScottE

    I call BS. It’s not disabled due to patents – if that was they case, they could not have that function at all.

    I don’t know about for gnome, but for KDE it can be enabled in the settings…

  5. Andrei

    What about:
    dpkg-reconfigure fontconfig-config? It creates/links the proper configuration files in /etc/fonts/conf.d, making it system-wide.

  6. amir

    ScottE
    US software patents are very wierd. Basically you can patent concepts. The upshot is that sophisticated technologies cannot ‘officially’ be used to do particular things that they’re easily capable of. Software patents are BS!!

  7. silencer

    Gnome lets you enable and configure the type of antialias. In fact, it comes enabled by default.

  8. nate

    You are going to have to come up with a link backing up what your saying, because I don’t beleive you either that it’s patents.

    It wouldn’t be present in the software I figure. If it’s aviable optionally it would be a compile time option and would require you recompile the library to enable it. That is generally how these things are done.

    It may be disabled because of performance reasons, or it hurts readability on low-resolution displays or something like that. Or it can be disabled ‘just because’ that is how it’s shipped from the upstream programmer and that’s it.

  9. Riddian

    Just in case anyone wants to make this mod apply to all users I place this file in /etc/fonts/local.conf

    This also fixes any problems that might occur when programs run as root fail to pick up the font settings.

  10. nationofgreg

    If publishing it were due to patents, they wouldn’t be able to use it – period. Someone else would be able to provide it, but by simply shipping it IN their technology, they’d be violating the patent.

  11. Bob

    It’s not that difficult and it’s not a patent thing, it’s just easier for them to use normal anti-aliasing by default instead of detecting whether or not the user has an LCD and which color order that LCD uses … System > Preferences > Font. In the Font Preferences window, click on the “Details…” button to use sub-pixel instead of just standard anti-aliasing.

  12. yo momma

    not much difference , but a good way to start improving the defaults

    linux needs a huge face lift so it can catch up to windows , not to mention mac, (looks wise)

    gnome is leading the way but when you compare it to osx interface, it looks outdated,

    KDE is ok but trailing behind gnome ,it still has that 1995 feel to it , i don’t like it ,

  13. zorg

    Have you ever used Beryl-Compiz? It blows Vista away.

  14. Joe User

    not much difference

  15. Hank Heathen

    @ ScottE, nate, nationofgreg, and Bob:

    http://www.freetype.org/patents.html

    Try Googling freetype + patents

    A 2 word websearch could have prevented your pointless posts.

  16. Fred

    If you had read that page you would have realized that it has nothing to do with font smoothing. The two patents that Apple holds are on OpenType-specific hinting embedded in font files. Enabling use of the data is a compile-time option in FreeType. FreeType will also guess based on the glyph shapes in other fonts that lack the data, and in OpenType fonts if the support is compiled-out. I’d bet a dollar Ubuntu ships it “free”.

    It has nothing to do with smoothing or sub-pixel hinting AT ALL.

  17. Troodon

    AFAIK, freetype has it’s own hinting method that is supposed to replace the Apple hinting algorithm. They say the freetype algorithm is getting better all the time but upon enabling the Apple hinting method in CentOS (by editing a confi file and rebuilding the frretype package) I noticed a huge difference, i.e, fonts looked much better with hinting turned on.

  18. Troodon

    [continued] On the other hand, the SuSE fonts don’t seem to suffer from this limitation. The SuSE fonts look great in SuSE 9 w/o hinting enabled. Go figure.

  19. Vadim P.

    System – Preferences – Appearance, Fonts, and enable smoothing there… no need to tinker with the terminal.

  20. Vole

    The closing quote in is a right-double-quote not a standard quotation mark.

    Anyone copying-and-pasting will need to fix that otherwise the xml will not be valid and this won’t work (should be ).

  21. RobK

    Brent at al — Yes, Apple does have a patent relating to the use of a Byte Code Interpreter for TrueType Fonts. Most TrueType Fonts contain additional information in the form of byte code that a good Byte Code Interpreter can use to better render fonts at small sizes. Rendering Fonts using the Byte Code Interpreter is often also called “native hinting”.

    And yes, most distros do disable the byte code interpreter found in freetype. BUT NOT UBUNTU IN HARDY HERON. For some reason, Ubuntu intentionally activates the patented Byte Code Interpreter. You can easily see this yourself. Run the following command:

    sudo apt-get install build-essential
    apt-get source libfreetype6

    You can now review the source and patches. One of the patch activates the byte code interpreter. If you are worried about Patent Infringement, you must recompile the libfreetype6 package with the patch removed.

    To get around patents, it is my understanding that the freetype group developed the “auto hinter”. You can use EITHER the patented byte code interpreter or the autohinter but not both. To use autohinting, use the hint in this post, or just run the following command:

    sudo dpkg-reconfigure fontconfig-config

    then choose “autohinter”, then choose “always”, then choose “no”

    Some fonts may look better using the patented byte code interpreter, Other fonts look better using the autohinter.

    After reading other posts on the net, I get the impression that David Turner, one of the main freetype developers, prefers the use of the autohinter over the patented bytecode interpreter. But I suspect it boils down to personal preference. see http://www.osnews.com/story/18166/Interview-with-David-Turner-of-Freetype/

  22. LS

    My fonts are already excellent in Ubuntu 8.04 using slight hinting from settings. No reason for anything better. Way better than Windows too.

  23. RobK

    A great resource is the “Comprehensive Ubuntu Font Configuration Guide: Gutsy 7.10 edition”. The guide is also relevant to Hardy Heron.

    See http://www.ubuntutips.net/node/35

  24. John

    Subpixel hinting looks horrible on CRT. That is why it is not turned on by default. It is only good for LCD. On a CRT you should use antialiasing without subpixel hinting, otherwise the edge of the fonts will be colored.

  25. James

    Hi dude,
    Thank you. I tried your tip and it worked like a charm. Now my fonts look really very good.

  26. Tim

    Just in case anyone reads this far… AFAIK:

    There are no patents on subpixel antialiasing (i.e. using the RGB pattern to get higher horizontal resolution), and this can easily be enabled.

    The problem is when you want to use ‘hinting’ which tries to align the letters to the pixels so they look sharper. Fonts contain hinting programs that say how to do this, but it breaks some annoying patent to use it so instead freetype uses an auto-hinter. I.e. it guesses. This doesn’t work so well and leads to things like letters touching each other, and weird bold letters that shouldn’t be.

    Freetype *can* use the hinting programs (ignoring the patent) but it is disabled in ubuntu. This is pretty annoying, especially for people who don’t live in the US.

  27. Andrzej

    Tim et al. Hinting is enabled by default on Ubuntu. You are also confusing two things: 1) hinting and 2) the bytecode interpreter. These are two separate things which you can turn on and off separately. The config file turns off the bytecode interpreter only. The bytecode interpreter is patented by Apple, but it is ENABLED by default on Ubuntu. The config file on this page turns it off enabling the Autohinter instead which does a better job for some fonts.

  28. Suzer

    I’m afraid many people are very confused regarding this issue; here’s the final word on it:

    Potential Apple Patent FUD: Bytecode Interpreter
    OpenType/Truetype byte-code interpreter (where the font pixel hinting has been stored in the font file and is later ‘interpreted’ by a bytcode-interpreter prior to font rendering [based on the internally stored info(byte-code) on how to best render this font]) is partially patented by the proprietary-minded and elitist ‘people’ at Apple

    Potential Microsoft Patent FUD: RGB Antialiasing
    RGB antialiasing; where the horizontal resolution of a display is tripled for fonts at their edges and boundaries. Using each individual Red Green and Blue ‘subpixel’ of a standard pixel as individual pixels to antialias the font edges, obliques and curves of the rendered fonts. The disadvantage of this approach is that the individually lit up red,green and blue pixels will show up at the edges of each glyph (i.e. the rendered letter) and appear as disgusting color bleed. Also, RGB anti-aliased fonts will not render the true shape of the font, sacrificing shape accuracy for increasing perceived sharpness; i.e. RGB anti-aliased fonts tend to be warped and distorted in order to give the sharpest and darkest strokes to the font. This in turn leads to improper kerning for proportional fonts. The last 2 reasons are the main reasons Steve Jobs would not allow full RGB anti-aliasing for fonts on Apple machines (even though Apple had the full right to use this functionality), Mr. Jobs appears to be a bit of a calligraphy fanatic (which is a good thing) hence font accuracy and quality is sacrosanct to him and therefore Apple. Whereas our friends at M$-microsoft fully implemented RGB antialiasing to give the ‘sharpest’ and darkest font rendering possible, at the expense of font and kerning accuracy: i.e. the stuff known as ‘Cleartype’ in M$-Windows; this should not surprise anyone, since MicroShaft’s philosophy seems to emphasize perception over everything else, i.e. with almost no regard to quality and accuracy.

    That said, these software patents are total bullshit because telling people that they cannot turn or off individual pixel elements on the screen THEY OWN is so utterly stupid and unenforceable that it will continue make the US patent regime the laughing-stock of the world, making it less relevant as time progresses (as well the continued rise of China, India, Brazil and the EU). In addition, because of the pathetic artificial hurdle created by the weak, short-sight, bloated and insecure proprietary companies (i.e the kind feel the need to file bogus patents to restrict competition and slow down the computer industry because they don’t have to confidence to compete on their own merits); such companies inadvertently dig their own graves by forcing the open-source community to innovate and create new way of doing things that the proprietary idiot never thought of. A great example is the auto-hinter which does a far better job than the outdated byt-code interpreter. Another example is the newest ‘enhanced’ grey anti-aliasing that provides sub-pixel antialiasing without any color bleed and WITH font shape accuracy and kerning maintained. The 1st major distros to offer this appears to be Suse (11.2) and Gentoo; the font rendering is fantastic now (in the latest versions of these distros), and certainly superior to ‘Cleartype’ style RGB anti-aliasing. I’m sure the next release of ubuntu will also incorporate this improvements.

Enter Your Email Here to Get Access for Free:

Go check your email!