Installing fonts in XFree86 is a two step process. First, you need to create a font directory that contains all the relevant font files as well as some index files. You then need to inform the X server of the existence of this new directory by including it in the font path.
The XFree86 server can use bitmap fonts in both the cross-platform BDF format and the somewhat more efficient binary PCF format. (XFree86 also supports the obsolete SNF format.)
Bitmap fonts are normally distributed in the BDF format. Before
installing such fonts, it is desirable (but not absolutely necessary)
to convert the font files to the PCF format. This is done by using the
You may then want to compress the resulting PCF font files:
$ bdftopcf courier12.bdf
$ gzip courier12.pcf
After the fonts have been converted, you should copy all the font
files that you wish to make available into a arbitrary directory, say
/usr/local/share/fonts/bitmap/'. You should then create the
index file `
fonts.dir' by running the command `
(please see the
mkfontdir(1) manual page for more information):
$ mkdir /usr/local/share/fonts/bitmap $ cp *.pcf.gz /usr/local/share/fonts/bitmap $ cd /usr/local/share/fonts/bitmap $ mkfontdir
All that remains is to tell the X server about the existence of the new font directory; see Section Setting the server font path.
The XFree86 server supports scalable fonts in four formats: Type 1, Speedo, TrueType and CIDFont. This section only applies to the former three; for information on CIDFonts, please see Section Installing CIDFonts later in this document.
Installing scalable fonts is very similar to installing bitmap fonts:
you create a directory with the font files, and run `
to create an index file called `
There is, however, a big difference: `
automatically recognise scalable font files. For that reason, you
must first index all the font files in a file called
fonts.scale'. This file has the same format as a
fonts.dir' file, and typically looks as follows:
The first line indicates the number of entries in the file. Each line after the first consists of two fields separated by a space; the first field is the name of the font file, and the second one is the name under which the font will appear to the server. This name should obey the X Logical Font Description conventions (see Section The X Logical Font Description). The format of this file is fully described in the
4 cour.pfa -adobe-courier-medium-r-normal-0-0-0-0-p-0-iso8859-1 cour.pfa -adobe-courier-medium-r-normal-0-0-0-0-p-0-iso8859-2 couri.pfa -adobe-courier-medium-i-normal-0-0-0-0-p-0-iso8859-1 couri.pfa -adobe-courier-medium-i-normal-0-0-0-0-p-0-iso8859-2
mkfontdir(1) manual page.
Note that multiple lines may point at the same font file. This is most commonly done in order to make a single font available under multiple encodings; please see Section Fonts and internationalisation.
While it is possible to create the `
fonts.scale' file by hand, it
is simpler and more convenient to have it generated automatically.
Utilities to perform this task are available, but are not currently
included with XFree86. For Type 1 fonts, you may use a utility
type1inst' which is available from
standard Free Software repositories throughout the world.
For TrueType fonts, you may use `
ttmkfdir', available from
Joerg Pommnitz's xfsft page.
After the `
fonts.scale' is created, you may run `
above; this time, however, you need to create an index of encoding
files called `
encodings.dir' in addition to the
fonts.dir' file. This is done by using `
For more information, please see the
$ cd /usr/local/share/fonts/Type1 $ mkfontdir -e /usr/X11R6/lib/font/encodings
mkfontdir(1) manual page and Section Fonts and internationalisation later in this document.
The CID-keyed font format was designed by Adobe Systems for fonts with large character sets. A CID-keyed font, or CIDFont for short, contains a collection of glyphs indexed by character ID (CID).
Adobe make some sample CIDFonts and a complete set of CMaps available from O'Reilly's FTP site.
In order to map such glyphs to meaningful indices, Adobe provide a set
of CMap files. The PostScript name of a font generated from a
CIDFont consists of the name of the CIDFont and the name of the CMap
separated by two dashes. For example, the font generated from the
Munhwa-Regular' using the CMap `
The CIDFont support in XFree86 requires a very rigid directory
structure. The main directory must be called `
CID' (its location
defaults to `
/usr/X11R6/lib/X11/fonts/CID' but it may be
located anywhere), and it should contain a subdirectory for every CID
collection. Every subdirectory must contain subdirectories
CIDFont (containing the actual CIDFont files),
(containing all the needed CMaps),
AFM (containing the font
metric files) and
CFM (initially empty). For example, in the
case of the font
Munhwa-Regular that uses the CID collection
Adobe-Korea1-0, the directory structure should be as follows:
CID/Adobe-Korea1/CIDFont/Munhwa-Regular CID/Adobe-Korea1/CMap/UniKS-UCS2-H CID/Adobe-Korea1/AFM/Munhwa-Regular.afm CID/Adobe-Korea1/CFM/ CID/fonts.dir CID/fonts.scale
After creating this directory structure and copying the relevant
files, you should create a <`tt/fonts.scale/' file. This file has the
same format as in the case of (non-CID) scalable fonts, except that
its first column contains PostScript font names with the extension
.cid' appended rather than actual filenames:
(both names on the same line). As above, running `
1 Adobe-Korea1/Munhwa-Regular--UniKS-UCS2-H.cid \ -adobe-munhwa-medium-r-normal--0-0-0-0-p-0-iso10646-1
mkfontdir' creates the `
$ cd /usr/local/share/fonts/CID $ mkfontdir
Finally, you should create the font metrics summary files in the
CFM' by running the command `
If no CFM files are available, the server will still be able to use the CID fonts but querying them will take a long time. You should run `
$ mkcfm /usr/local/share/fonts/CID
mkcfm' again whenever a change is made to any of the CID-keyed fonts, or when the CID-keyed fonts are copied to a machine with a different architecture.
The list of directories where the server looks for fonts is known as the font path. Informing the server of the existence of a new font directory consists in putting it on the font path.
The font path is an ordered list; if a client's request matches multiple fonts, the first one in the font path is the one that gets used. When matching fonts, the server makes two passes over the font path: during the first pass, it searches for an exact match; during the second, it searches for fonts suitable for scaling.
For best results, scalable fonts should appear in the font path before
the bitmap fonts; this way, the server will prefer bitmap fonts to
scalable fonts when an exact match is possible, but will avoid scaling
bitmap fonts when a scalable font can be used. (The `
hack, while still supported, should no longer be necessary in XFree86
4.0 and later.)
You may check the font path of the running server by typing the command
$ xset q
xset' utility may be used to modify the font path for the
current session. The font path is set with the command
a new element is added to the front with
xset +fp, and added to
the end with
xset fp+. For example,
$ xset +fp /usr/local/fonts/Type1 $ xset fp+ /usr/local/fonts/bitmap
Conversely, an element may be removed from the front of the font path
xset -fp', and removed from the end with `
For more information, please consult the
xset(1) manual page.
The default font path (the one used just after server startup) is
specified in the X server's `
XF86Config' file. It is computed by
appending all the directories mentioned in the `
of the `
Files' section in the order in which they appear.
FontPath "/usr/local/fonts/Type1" ... FontPath "/usr/local/fonts/bitmap"
For more information, please consult the `
If you seem to be unable to use some of the fonts you have
installed, the first thing to check is that the `
are correct and that they are readable by the server. If this doesn't
help, it is quite possible that you are trying to use a font in a
format that is not supported by your server.
XFree86 supports the BDF, PCF, SNF, Type 1, Speedo, TrueType and CIDFont font formats. However, not all XFree86 servers come with all the font backends configured in.
On most platforms, the XFree86 servers are modular: the font
backends are included in modules that are loaded at runtime. The
modules to be loaded are specified in the `
XF86Config' file using
If you have trouble installing fonts in a specific format, you may want to check the server's log file in order to see whether the relevant modules are properly loaded. The list of font modules distributed with XFree86 is as follows:
"bitmap": bitmap fonts (`
*.pcf' and `
"Type1": Type 1 fonts (`
*.pfa' and `
*.pfb') and CIDFonts;
"Speedo": Bitstream Speedo fonts (`
"freetype": TrueType fonts (`
*.ttf' and `
"xtt": alternate TrueType backend (`
*.ttf' and `