Beautiful Font Hinting in Ubuntu 8.10 and 9.04

Even though I have an LCD monitor, I always have the subpixel hinting switched off because it is just painfully ugly to my eyes. Even when hinting is switched to maximum, the fonts are quite blurry (if you don’t believe me, type xmag and take a screenshot of your font. You can see red and blue linese everywhere). My eyes hurt when I see this.

Thanks to Johan Kivinemi I have just found out how to bring back the excellent legacy subpixel hinting engine. This has a much more crisp hinting, and uses subpixels only where it really is an improvement:

Just open these files in your home directory, and copy the content into them:

~/.fonts.conf

~/.Xresources

This should work in Ubuntu 8.04, 8.10, and 9.04 too, and makes all fonts much more crisp. Of course, your mileage may vary.

UPDATE: Comparison Screenshots

As promised on reddit, I got back from an awesome snowboard trip so I am able to put up extensive comparison screenshots of the two subpixel hinting engines. Move your mouse over the following images to see the differences. Watch especially out for letters like “m” where the spacing between the lines is very small. You might have to wait a bit for the image to load.

I have used all of the most important fonts that I usually use, and just for fun I have added “Dijkstra”, which just looks cool.

Sans Fonts

Mouse to see the same fonts with the legacy hinter.

 

Mono Fonts

Mouse to see the same fonts with the legacy hinter.

 

Zoomed Comparison Screenhots

Here is an excerpt with 400% magnifications. Mouse over the pictures to see the legacy hinter.

Zoomed Sans

 

Zoomed Mono

 

29 Comments on "Beautiful Font Hinting in Ubuntu 8.10 and 9.04"

Notify of

Guest
don
7 years 15 days ago

Screenshots?

Guest
7 years 15 days ago

Just a question/suggestion..after this little hack is in place does one need to restart X for it to work?

Guest
SrcnShooter
7 years 15 days ago

Before & after screenshots?

Guest
7 years 15 days ago

I’m sure it should be lcdlegacy and not lcdfilterlegacy…

Guest
ochs
7 years 15 days ago

The red and blue lines you get in xmag are a result of subpixel rendering… they look crappy if you magnify them, but better in normal resolution IF you have a LCD and the right subpixel ordering is configured.

http://en.wikipedia.org/wiki/Subpixel_rendering

Guest
7 years 13 days ago

Thanks James, I have fixed this.

Guest
Baughn
7 years 11 days ago

Thanks, this helped a lot!

But I wonder, why isn’t this the default?

Guest
7 years 5 days ago

ochs,

Translucent pixels or subpixels where they aren’t needed mean blurry text. Subpixel rendering or not, horizontal and vertical lines should only consist of 100% transparent and 100% opaque (sub)pixels.

Guest
krt
6 years 11 months ago

Look at the “x” in Verdana 11; it has faded lines which only get worse when you mouse over it . . . The fix helps in many cases, but I have noticed some instances on particular letters such as “k”, “x”, etc., where the diagonal lines actually fade worse when using the improved rendering scheme . . . ? The problem seems to varie tremendously depending on the font size and font type.

Guest
6 years 11 months ago

Hi krt, you are right it really looks as if the x is fading. I think it looks a bit better with the default renderer because it is more bold in general. I think the x looks so bad because the hinting information is not very good for this font size, so the font designer could have done a better job.

Guest
6 years 11 months ago

Hi there Martin,

I just got here and tried your instructions. They worked fine, although I tried something else I found here and I feel it works even better, here it is:
http://ubuntuforums.org/showpost.php?p=5024418&postcount=6

Maybe you can try that and see if you like it better.

Cheers
Felipe

Guest
Juamez
6 years 11 months ago

While lcdlegacy may make the fonts less blurry, the settings also makes the font “tingle” in a visual way. I have problem with it because to me the lcdlegacy setting makes the rgb subpixel hinting a lot more visible, with all sorts of weird colours appearing at the edges of fonts. This isn’t the case when I have it set to lcddefault. I’m using an LCD screen btw.

Another question: is there a way to force grayscale smoothing instead of rgb smoothing in .fonts.conf or .Xresources? I already googled for it some hours, but nothing ever shows up.

Guest
6 years 10 months ago

THANK YOU for the Tips!

:)

Guest
James
6 years 9 months ago

Happy (or shall I say disappointed) to say these tricks still work (and are required) in 9.04.

Thanks! I’m beginning to think some of the Ubuntu developers are typography blind.

Guest
Vlad
6 years 9 months ago

Doesn’t work in 9.04

Guest
6 years 7 months ago

By the way, KDE doesn’t like the above .fonts.conf file format, it wants all the edit-tags separately between their own match-tags, like this:

true

true

and so on.

I don’t know why KDE is nitpicking on this. The example file works if you don’t touch anything, but if you experiment with KDE Control Center font settings, the file gets overwritten if it isn’t already in the correct format. So, could you please ‘fix’ the example .fonts.conf file so it works with KDE without trouble?

Guest
6 years 7 months ago

Argh, the system tried to interpret the XML tags… Here’s an example without the arrows

match target=”font”
edit name=”antialias” mode=”assign”
bool true /bool
/edit
/match
match target=”font”
edit name=”hinting” mode=”assign”
bool true /bool
/edit
/match

Guest
6 years 7 months ago

another way to fix how the font looks is to calibrate lcd monitor. goto http://www.lagom.nl/lcd-test/ to calibrate and the fonts will look better after

Guest

[…] Here’s how you can change it, too. […]

Guest
6205
6 years 7 months ago

Thank you very much.. It has helped me a lot in Ubuntu 9.04

Guest
Paladin
6 years 6 months ago

Help me guys, it doesn’t work on my Ubuntu 9.04 :(

Guest
John
6 years 6 months ago

Thank you so much Martin for the past couple of days I have been straining my eyes trying to figure out how to fix my font. Everything was red green and blue. Ubuntu must have change something, or maybe it was my new Nvidia GTX 285 card. I’ve never had a problem like this before, fonts have always been super crisp on Ubuntu. Thanks a bunch.

Oh by the way I had a little trouble copying the code you had in this article. I had to go back and delete all the line numbers down the left side. You might want to change that especially if you post really long code on your site. It could be problematic in cases like that.

Guest
6 years 6 months ago

Hi John, to copy the code to the clipboard click on “copy to clipboard” :-)
Or, if this does not work, click “view plain” and copy the content from the popup window.

Guest
Josh S.
6 years 2 months ago

Thanks for your help, Martin. Your files worked for me with Ubuntu 9.04, but they don’t work in Ubuntu 9.10. I changed “lcdlegacy” to “lcdnone” in both files in Ubuntu 9.10, and now the font rendering seems to look like it did in Ubuntu 9.04 after I used your files.

Guest
YChao
5 years 11 months ago

Thanks a lot for the info. Just that it stops working after u/g to 9.10. Some how it’s always set to lcddefault when checked with “xrdb -query”. Would be great if this can be fixed.

Guest
5 years 7 months ago

Many Thanks Martin,

Works perfectly in Ubuntu 10.04.

Guest
5 years 6 months ago

[…] number of articles, forum posts and standard proposals definitely proves […]

Guest

[…] Font subpixel rendering in Ubuntu 8.10 More font subpixel in Ubuntu […]

Guest
MM
4 years 9 months ago

I had a feeling that my fonts in Ubuntu 10.10 are broken on my laptop. Your solution works greatly on my Ubuntu 10.10 . Thank YOU.

wpDiscuz