Cleartype LCD patch on Mandriva Linux 2007

My biggest gripe on any GNU operating system is the poor font rendering. Because of patents held by biggies like Microsoft and Apple, many interesting font rendering technologies cannot be applied on Linux without the chance of getting sued.

Perhaps the best patch available for font rendering is the LCD cleartype patch from Freetype maintainer David Turner. Though this patch is no longer available from Turner, you can download it from several places on the internet. I have shared one of them here. Let us see how we can apply this patch on Mandriva 2007. Ubuntu users, please refer to my another interesting howto here.

We need the following 3 files:

Extract all the packages to a folder:

$ tar -xzvf filename.tar.gz

Now we need to apply the patches for individual packages.
For freetype, there is no patch, but we can edit the file manually. Go to your freetype source folder, and open the file aflatin.c:

$ vim ./src/autofit/aflatin.c

Search for the term FT_RENDER_MODE_MONO. You will find two instances. Remove the OR statement that follows this in both cases. It will read like the following once you edit it:

if ( mode == FT_RENDER_MODE_MONO )
other_flags |= AF_LATIN_HINTS_VERT_SNAP;

You are done patching freetype.

Now go to the xft folder and run:

patch -p1 < path/to/your/libXft-2.1.10-etcpatchfile

Go to the cairo folder and run:

patch -p1 < /path/to/your/cairo_patch

You are done with all the patching. Now, go to individual folders for these packages and run:

$ ./configure --prefix=/usr
$ make

Now login as root and:

$ su
# make install
# exit

This will overwrite the default libraries that shipped with your system. Repeat the same for all the other packages.

Go to font preferenes and select sub-pixel font rendering.

Just restart X (Ctrl+Alt+Backspace) and enjoy your new beautiful Mandriva!

Sample:

After patching

Acknowledgements: This guide is based on a thread in Ubuntu forums.


		

29 thoughts on “Cleartype LCD patch on Mandriva Linux 2007

  1. I am just wondering about the command “patch” I’m currently running mandriva 2007 but as far as I can tell “patch” is not a command.

    Thanks for the help.

    -Steve

  2. @Steve,
    Did you install all the development tools? You can open MCC and check the Development tools section so that all relevant software like gcc, patch etc., are installed.

  3. I tried everything here exactly as you coded, but two problems occured… first off, when I went to do the ./make and ./make install commands inside each of the source folders, it said that it was an invalid command. But if I just typed make and make install it worked, or at least I thought it did. However, upon restarting X, there wa

  4. oops, sorry, got cut off for some reason…

    Upon restarting X, there was no difference at all in the fonts. I don’t know if it’s because of the make and make install commands or something else that is causing this not to work.

    Any ideas what the problem might be? Thanks for the help, I’d really like to get this working!

  5. @Eo Nomine,

    Oops. You found a some errors in this post!! I corrected them.
    After running
    ./Configure and
    make

    you must then login as root run make install (because it will install files in /usr folder)

    Let me know if it works. (It should)

  6. Awesome, it works, although the fonts didn’t actually change until I turned subpixel smoothing on and adjusted the hinting, even after running the patches. (I have an LCD laptop screen) It was stuck on either monochrome or grayscale before, can’t remember which one.

    I can’t believe how friggin gorgeous the fonts look now, my biggest hate about linux is now resolved… thanks a lot for this article and the help!!🙂

    While I have your attention, one other quick question. Can this be applied to any distro, or is it Mandriva specific? I also run FC6 and openSUSE right now and would like to apply it to them as well.

    Thanks again,

    -EN

  7. Good news, I tried this with FC 6, and everything worked perfectly, so it’s safe to assume that this isn’t distro-centric, and will work with anything. Probably a good idea to keep an eye on what packages you’re getting when updating though, just in case one of these libraries gets updated and you lose the changes you made. Although patching it isn’t difficult, so really it would onlly be an inconvenience.

    Thanks again,

    -EN

  8. I tried this on openSuSE 10.2-64, but nothing changed.
    ‘Subpixel order’ setting still has no effect,
    i still have the ‘ugly’ b/w antialiasing.
    BTW: Firefox did not start after this, it claimed
    errors ‘wrong library typ ELFCLASS64’ or something. The ‘make install’ seems to overwrite the 32bit libraries with the 64bit versions.
    I used yast to reinstall (update unconditionally)
    the libs, and firefox worked again.

  9. Some remarks to your description:
    In ‘patch -p1’ it is not very clear, that this is
    -p and not -p
    Difficult to read, depends on the font.🙂
    The ‘./configure –prefix=/user’ line ist missing a line break. This hit me even beeing an experienced user.

  10. Sorry, but I can’t figure out where to get the XFT and Cairo patch files. Are these supposed to be on http://www.megaupload.com/? To get them from that site it appears you need at least a filename to search for. Or am I missing something in your text?

  11. Alternatively, to use the rpms, the instructions say to “Download and replace these rpms for fc6.” In FC6, where in the file system are the originals I need to replace?

  12. I’m sorry for the running commentary, but perhaps it will help others. I finally figured out that’s not a search box at http://www.megaupload.com/, but a capcha – you have to enter the three letters to the left of the box and then wait about a minute, then you can download the file.

    So I have the patches. When I enter the patch command, the terminal takes it without error messages, but I don’t get control of the terminal back. Both patch commands appear to hang until I control-c out of them. What would cause this?

  13. @Tom,

    You dont need to manually replace them. Once you have copied these to a respective folder, do:

    rpm -ivh *.rpm

    This will replace your current ones with the downloaded ones.

  14. Thank you for another great write-up. Exactly where else could anyone get that type of data in these a ideal way of writing? I have a presentation next week, and I am to the look for this kind of information and facts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s