Tuesday, May 30, 2006

Nice Font Rendering on SUSE 10.1

Fonts on Linux/Xorg are something that people seem to go on about a lot. Usually complaining how bad they look. For years now I've had no problem with fonts - for a while it was because I recompiled freetype packages with the bytecode interpreter turned on, but then SUSE started turning that on anyway, and I had nice looking fonts right out of the box. I think part of the reason I liked my font rendering though was because I like subpixel antialiased fonts, and most Linux people seem to like jagged edges instead. However, something changed in version 10.1, and my once nice looking KDE desktop started to look ugly. I couldn't quite put my finger on what was different, but something had changed.

But now I have nice fonts again. How did I do it? I added David Turner's libXft patches to my system, and suddenly things look nice. It doesn't really make sense though, as SUSE 10.0 couldn't have had those patches as they hadn't been written.

The details of how I did it: I backed up the existing libraries. Then I installed the xorg-x11 source rpm on my machine, ran rpmbuild to extract the source and apply existing patches. Then I applied the libXft patch and ran make from the Xft directory. I then copied the compiled libs into place, restarted X, and it all worked nicely:

cp /usr/X11R6/lib/libXft.a ~/backup/
cp /usr/X11R6/lib/libXft.so.2.1.2 ~/backup/
rpm -ivh xorg-x11-6.9.0-48.src.rpm
cd /usr/src/packages/SPECS
rpmbuild -ba xorg-x11.spec
cd /usr/src/packages/BUILD/xc/lib/Xft
patch -p1 < ~/libXft-2.1.7-lcd_rendering.patch
./configure
make
cd .libs
sudo cp libXft.a /usr/X11R6/lib/
sudo cp libXft.so.2.1.1 /usr/X11R6/lib/libXft.so.2.1.2

Now, I'm not saying this is the right way to do it. I reckon there's a reasonable chance it'll crash my machine at some point. But so far it's working fine. Oh, and if you copy libXft.so.2.1.1 across while you're still running X, weird things happen!

Unrelated note: I'm now using Smart to manage packages and updates on my machine, and it's a wonderful piece of software.

3 comments:

Maxilys said...

I don't understand your problem. I've never seen such a beautiful font rendering as on SuSE 10.1. My config: no sub-pixel and a medium hinting. The texts are smooth, well defined, with evenly spaced characters. Absolutely wonderful!

Maybe you're trying too hard? ;-)

James Ots said...

You might not have seen such good font rendering as on SUSE 10.1, but I saw better rendering on 10.0. And I want sub-pixel hinting to be switched on. Because when it works properly (as it does now, with the patch), it looks better than without it.

Maxilys said...

My experience is just the opposite. Font rendering in 10.0 was good but when I saw the one of 10.1, I went wow.

Just to be sure, I tried the sub-pixel halo and I deactivated it immediately. X started to crawl and there was an ugly multicolored halo around the characters.

IMHO, YMMV. ;-)