This patch makes Freetype's (http://www.freetype.org) Truetype interpreter render fonts similarly to MS Cleartype. It is not perfect, and needs some work on certain fonts, however, in my opinion it renders much, much better than the bi-level Freetype hinting does when doing subpixel rendering. Anything previous to this that I've worked on is simply a hack. This is the real thing finally.
This patch is different than all previous so-called "cleartype fixes" for Linux. The reason is that the MS truetype interpreter does subpixel filtering, but also subpixel hinting, which has never been done before in Freetype. ("Subpixel hinting" means that the outlines of the letters are rounded to subpixel boundaries instead of pixel boundaries. "Subpixel filtering" means that the part of the renderer that chooses which pixels to light up does so with the idea of subpixel boundaries instead of pixel boundaries.) The Freetype library has hitherto only done subpixel filtering, and WHOLE pixel hinting. This looks great when using non-antialised fonts (circa Win98), but looks bad on legacy fonts when doing antialiasing and subpixel filtering, because the legacy fonts were designed with the idea of bi-level (monochrome) hinting in mind, not subpixel (antialiased) hinting. The MS TT interpreter in Windows XP and later works around this by ignoring certain Truetype instructions contained in the font. This patch attempts to duplicate that functionality. Modern free fonts like Liberation and DejaVu also look good with this too, because they were designed with subpixel hinting in mind.
Another benefit to this is that this is modifying the default (native) hinter of Freetype, which all programs should use by default. This means that oo.org, WINE, Xft, Qt and just about everything else will be using this by default. In other words, almost all programs will render fonts the same good way.
Please feel free to make suggestions and criticisms of the approach and implementation. My goal is to make this patch quality and accurate, and get it into the freetype tree if possible. There are plenty of improvements that can still be made, in features and implementation. This is an all-in-one patch that should cleanly patch freetype-2.4.2, enable LCD filtering, subpixel rendering, and the new subpixel hinting.
Latest Versions (2010-09-06)
- x86_64 - http://www.infinality.net/fedora/linux/13/x86_64/
- i386 - http://www.infinality.net/fedora/linux/13/i386/
- Patch - http://www.infinality.net/files/subpixel-hinting-20100903-1.patch
I strongly recommended to:
- Use this /etc/fonts/local.conf (or know what you are doing otherwise)
- Remove/disable your ~/.fonts.conf
- Use cairo and libXft packages that make use of LCD FIR filtering (such as the ones here: http://www.infinality.net/blog/?p=5 )
Please make sure you have done these things before asking why something isn't working. Here is a good resource that explains how to set up and modify a /etc/fonts/local.conf to your personal taste:
http://wiki.archlinux.org/index.php/Font_Configuration
(Updated 2010-09-06) PACKAGE UPDATE – This update fixes the LD_PRELOAD issues in the recent packages. Let me know if problems continue! Also, I will soon have an updated patch that will be cleaner, allow enabling / disabling with a #define macro, and some additional features, including the ability to tweak the hinting on specific fonts, sizes, and glyphs. I will then see about submitting it to Freetype.
(Updated 2010-09-03) PACKAGE AND PATCH UPDATE – This version includes updates that the Gentoo people did for 2.4.2 (http://forums.gentoo.org/viewtopic-p-6350322.html#6350322), as well as a tweak that I made on the synthetic emboldening that Freetype does. This should make synthetically emboldend fonts look spectacular compared to the default. Basically, it disables emboldening in the Y direction, which was causing a lot of smeary looking fonts. Here is a sample of this enhacement, using Andale Mono, which has no bold version available:

http://www.infinality.net/fedora/linux/13/x86_64/freetype-subpixel-2.4.2-2.fc13.x86_64.rpm
http://www.infinality.net/fedora/linux/13/i386/freetype-subpixel-2.4.2-2.fc13.i386.rpm
http://www.infinality.net/files/subpixel-hinting-20100903-1.patch
(Updated 2010-06-17) http://www.infinality.net/fedora/linux/13/x86_64/freetype-subpixel-2.3.12-3.fc13.rpm Also…. It's strongly recommended to use this /etc/fonts/local.conf, and to remove/disable your ~/.fonts.conf, not to mention using the cairo and libXft packages available at that link.
(Updated 2010-04-24) http://www.infinality.net/files/subpixel-hinting-20100424-1.patch
There are a few more tweaks I need to make the patch acceptable for inclusion into Freetype. In the meantime here are the Fedora 13 RPMS. They safely install alongside the system freetype, and use LD_PRELOAD to override system libraries. You may get LD_PRELOAD warnings / errors when running from command-line. These will go away eventually once this patch is in freetype.
Here is a DejaVu Sans sample, rendered with Freetype, using this patch:

Here is a Tahoma sample, rendered with Freetype, using this patch:

Here is an Arial sample, rendered with Freetype, using this patch:

Here is a Liberation Sans sample, rendered with Freetype, using this patch:


