Depending on the particular brand of Linux you use ("distribution" or "distro"), you may notice fonts do not display quite as nicely as they should. This would be especially true of TrueType fonts you get from that commercial operating system. Why? Because the very best way to improve and sharpen fonts display on most hardware requires using a technology which may be patented. Some distros build it in anyway, and some do not. That's because they are afraid to run the risk of being sued for doing this for you.
Most of my experience with this problem was when running SUSE, which uses the RPM system for managing packages. If you run a distribution that is RPM-based, you can probably get the source RPM package and make a few minor modifications, then rebuild and install as normal. Debian is not a commercial company, so anything based on Debian is unlikely to be crippled like that. Distros that use neither RPMs nor DEBs are varied on this, and the method for them is shown in the second part below.
Most notably starting with SUSE 9.2, the font display through Xft is truly improved. SUSE has added some very nice enhancements to their version of freetype2. However, just try one time an application that does not use Xft and all your TTFs are ugly still. Here's the fix.
First, you'll need the source RPM (for SUSE 9.2: freetype2-2.1.9-3.src.rpm; later versions use newer versions of freetype). Install the RPM as is. Then, navigate to the SPEC file:
cd /usr/src/packages/SPECS
There you will find a "spec file" -- freetype2.spec. At
the top of the file is a complete list of every package dependency for
compiling it. The one thing I found annoying is that the list calls for
two packages which are for some reason missing from my set of SUSE 9.2
Pro: texinfo and gdbm-devel. If you find this
laborious to check each library, then just try to compile it first, and
you'll be told what's missing. It works that way for most source
RPMs.
Open the spec file in your favorite editor. We want to keep all the other enhancements, but add one more. Go down to about line 74, looking for this line:
#%%patch100 -p 1 -b .bytecode
Simply remove the # sign and save the file. Then, run
the command:
rpmbuild -bb freetype2.spec
This is the point where you find out if you are missing any packages. When build is finished and the command prompt comes back, navigate to the RPMs you just built and install:
cd /usr/src/packages/RPM rpm -Uvh --force free*.rpm
This should give you both the runtime and development packages. Restart X and you should see an immediate difference anywhere that Xft is not used.
My thanks on this section to Jo Schulze posting on a.o.l.s with this information.
In order for this to make any difference, there are several things you have to do.
1. Make sure to install freetype2 and freetype2-devel packages for your distro.
2. Download the latest version of freetype2 from SourceForge
http://sourceforge.net/project/showfiles.php?group_id=3157
or your favorite mirror. Be sure to scroll down to the actual package listing, below the freetype1, freetype demos, and freetype docs. Current version is 2.1.10.
3. Make two changes in the options before compiling:
a. Go to xx/freetype-2.1.10/include/freetype/config and load the file ftoption.h in your favorite text editor. Go down to about line 380 and look for this:
/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */Change it to look like this:
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETERand make sure the whole line is flush with the left margin. Save and close.
b. Return the to the top directory and run configure:
./configure --prefix=/usrto insure that installing it will replace the bundled binaries with the new ones on most distros. Check beforehand for your particular flavor of Linux.
Then do the make and let it compile. There will be some
warnings, but I've never known them to make any difference in the past
4 versions I've compiled.
Finally, run make install.
When you are ready to see the difference, log out of your window manager, which will usually cause the X server to restart, picking up the new freetype libs you just built.
You should notice a significant difference in the appearance of TTFs, but especially if you don't use Anit-aliasing. It will make some small difference even with Anti-aliasing.
Two last items. One, when trying to compile XFce 3.8.18, I kept getting an error via the header for Xft (/usr/X11R6/include/X11/Xft/Xft.h) calling for the freetype header file (freetype.h). I made several attempts at putting a link to the file where the script was looking. Finally, this is what did the trick:
# ln -s /usr/include/freetype2/freetype /usr/X11R6/include/freetype
I won't even pretend to understand why this particular link was necessary, but you may run into this yourself sometime.
Two, there's another problem you may have with that
Xft.h file when you compile against freetype2, as it has
required a special script be included since freetype version 2.1.6.
Backup your Xft.h with something like this:
cp Xft.h bak.Xft.h
Then open the file in a text editor and make some changes. Somewhere around line 35, look for these two lines:
#include <freetype/freetype.h> #include <fontconfig/fontconfig.h>
and replace the first line with these two lines:
#include <ft2build.h> #include FT_FREETYPE_H
Save the changes and close the file. I cannot guarantee this is exactly correct, but it has worked for me so far.
Ed Hurst, updated 20 December 2005
This document is released into the Public Domain.