As you can see, both the FreeType and FreeType2 libraries are installed on
my server. This is a fairly common result for a RedHat 7.2 or higher machine,
as FreeType has been integrated in the X environment to provide support for
high-quality TrueType rendering.

If FreeType is not installed on your system, all you need to do is download
it, compile it, and install it. You will, however, have to make a decision as
to whether you want to compile your version of FreeType with the hinting code
that infringes on Apple's patents (for which you will need to buy a license
from Apple itself) or not. If you decide to exclude these features, first edit
the file ft_conf.h in the FreeType source tree's main directory.
In version 1.3.1 of the library, line 98 of that file contains the
following:

/* #undef TT_CONFIG_OPTION_NO_INTERPRETER */

To disable the patent-sensitive functionality and save yourself from having
to buy a license, change it as follows:

#define TT_CONFIG_OPTION_NO_INTERPRETER */

Save the file, and proceed with the configuration and compilation of the
library as you would normally:

Once FreeType is installed on your system, the PHP configuration script will
automatically determine its location. Enabling the built-in TrueType GD
functionality only requires the use of a simple switch:

Depending on the exact version of PHP that you have, the configuration
script may not be able to correctly identify the last switch because of a
misspelling that existed in its code at some point (and that was fixed a while
ago). If --enable-gd-native-ttf fails, try
--enable-gd-native-tt instead (without the final
f).

If you'd rather use the FreeType library without taking advantage of the
built-in TrueType functions, use the following configuration switches:

The installation of support for the FreeType2 library works in a very
similar way--you can, in fact, compile both libraries in the GD extension at
the same time. This can be useful if some of your older scripts still use
FreeType, but you want to use FreeType2 with the new ones, or if you are a
hosting provider and want to let your customers use both.

Like its predecessor, FreeType2 is easy to configure and install. Since it
does not use any of the patented code from Apple, you don't even have to change
any of its source files:

Compiling Support for Type1 Fonts

The T1Lib library is used by the GD extension to provide support for
PostScript Type1 fonts. This format, very popular among professional
typesetters, provides the highest output quality, although the fonts that use
it are often expensive. (The X Window System includes a handful of free
Type1 fonts.)

As with TrueType, the best way to compile T1Lib into your PHP interpreter is
to first verify whether it's already available on your system:

/marcot/code# locate t1lib.h
/usr/include/t1lib.h

If this doesn't work for you, you will need to download and compile it.
There are no special requirements for this task. The process is quite
straightforward:

Putting It All Together

Having covered all of the different options that can be compiled into the GD
extension, it's time to compile everything together and test that it works. A
complete installation of the GD extension will look similar to the
following:

This should result in a complete recompilation and installation of your PHP
interpreter with support for GD and all of its ancillary technologies. You can
test its functionality through this simple script: