You too can have beautiful Linux fonts

Last Thursday, when I wrote my blog post, I was so irritated about Ubuntu's bad font rendering I didn't know what to do. The TrueType bytecode interpreter patents have expired since long ago and I'm using mostly the same fonts on Linux and Windows so there was no way to explain Windows superior font rendering other than that it actually does a better job.

That, I cannot stand. Linux should work at least as well as Windows on everything, especially when it comes to something as crucial as font rendering.

I set out on a deep diving quest into Linux font rendering infrastructure trying to find out exactly what was wrong with it. Turns out I wasn't the only one dissatisfied with the way fonts looked. I prefer Window 7's font rendering which, to my eyes, appear much crisper and slender than how fonts look in Linux.

Take a look at the screenshots with the Georgia font below, first how it is rendered in Windows 7:

And how it looks in Ubuntu:

The difference is considerable. To my eyes, Ubuntu's version is much to thick. While both systems use almost the same technology to render the glyps, the reason for the big difference in appearance becomes clear when you zoom up:

Ubuntu's rendering is on the left and Windows on the right. Both use subpixel anti-aliasing, but Windows variant is much lighter. And since I prefer the Windows rendering, I set out to find what configuration knob you can tweak in Ubuntu to get the same appearance. Turns out there is none. Using KDE's font configuration GUI, you can change the true type hinting from medium or full to slight which gives ligher glyphs but distorts their shape to much. Especially Verdana and Arial seem to be dependent on lots of hinting to render properly. You can also edit your ~/.fonts.conf file and change the LCD filtering style FreeType uses. Unfortunately, it seems like that setting doesn't work correctly, because setting it to something other than lcdnone or lcddefault has no effect. lcdnone disables LCD filtering entirely so you get severe color fringes around the text.

Then I tried hacking the FreeType sources which was easier done than expected because the only thing I had to change was few lines like it is described on this wiki page. It didn't provide the results I desired though it just made the text more gray than black, not crispier like in Windows.

Then I luckily found a site called infinality.net on which someone had already published patches to FreeType and Fontconfig to improve font rendering. After twiddling with them a bit and adding a PPA repository I got some really impressive results:

This is with USE_STYLE = "WINDOWS7LIGHT". Infinality has many other font rendering modes, but this is the one I like the most. It is not exactly how it looks on Windows 7, but very close. I suspect the remaining differences is caused by subpixel glyph positioning which Windows 7 uses but Xorg doesn't support. The difference is even greater when it comes to smaller sans serif fonts, which are used for desktop GUI elements. Often they are rendered as black on gray background.

Ubuntu's default on the left and Infinality's Windows 7 Light rendering on the right. I think the improvement in readability is huge here. There is no blur nor extraneous thickness in the menu or address field. The glyphs are well balanced so that no character looks heavier than the other.

So use the Infinality patches! They are great and you will be very pleased with the result.

A major face lift for my blog

I guess I just got tired of the extremely simple design I previously used. The biggest change is the switch from the sans serif font Verdana to Georgia. In a way, that has rejuvenated my interest in writing because reading Georgia tastes much better. The original reason why I choose Verdana many years ago is a little embarrassing. It was the only font that rendered well without anti-aliasing on my Linux machine. :-) Hopefully Georgia will look decent too. It certainly does on Windows and mobile devices. The next thing on my list of things to fix on my blog is to somehow figure out how I can post using Markdown. It is a real pain to try and write well structured html on a phone. That's why I seldom bother to insert paragraph breaks.

Update: Georgia still doesn't render well with or without anti-aliasing on Linux. I'm trying to not get frustrated and investigate what the cause may be.

Host host

All sitter och snörvlar, hostar och baksuger in snoret i munhålan runt omkring mig. Vidrigt är det. Jag hatar verkligen att åka tunnelbana den här tiden på året. Folk har inte vett på att stanna hemma utan självskt utsätter alla andra för deras smittsamma sjukdomar.

Fy fan vad svårt det är att banta

Jag har den senaste tiden blivit mycket mer seriös i mitt försök att bli smal. Gissningsvis ligger jag ungefär fem sex kilo över min idealvikt. Så mycket mer väger jag i alla fall än mma fighters som är lika långa som mig

Nu kom jag av mig... Det tar hur mycket tid som helst att rätta en felstavning när man författar ett blogginlägg på tunnelbanan på väg hem från jobbet. Så här knepigt ska det inte vara, det måste finnas ett bättre sätt....


Bra jobbat Björn!

Klockan är nu 23:23 och jag har promenerat samma sträcka som Stockholm Halvmaraton sedan klockan sju. Jag sitter på ett ölställe vid Södra Station och skriver det här samtidigt som jag smittar på en öl. 18,5 kilometer avklarade, 2,5 kvar. Det här varit jobbigt men snart är det avklarat och det kommer kännas hur skönt dom helst. Nej, nu måste jag slänga i mig ölen och fortsätta! Annars kanske jag blir sittande.

Sänkt bolagsskatt - så påverkas du

Så lyder Metros rubrik och jag tänker att idioterna måste fan skoja med mig. Jag äger inga bolag och har ingenting att tjäna på det. Själv drabbas jag först när sl återigen bestämmer sig för att chockhöja priset på sl-kortet för att de har för lite pengar. Metro får vinkla saker bäst fan de vill, men den här nyheten handlar bara om att ta från det offentliga och ge till bolagsägare.

Innocence of Muslims

Det är helt makalöst att idioter kan få för sig att mörda för en så illa producerad och tafatt film. Vem som helst med en sketen kamera och en vilja att trolla muslimer kan tydligen sätta världen i brand. Gör en film som påstår att muslimer är våldsamma idioter, få en massa muslimer att beté sig som våldsamma idioter. Mission accomplished. Dock synd om kopterna i Egypten som beskylls för att ligga bakom filmen.

Bloggarkiv