mkfontdir Command

Purpose

Creates a fonts.dir file from a directory of font files.

Syntax

mkfontdir [ DirectoryName ... ]

Description

The mkfontdir command creates a fonts.dir file from a directory of font files. For each directory argument, the mkfontdir command reads all of the bitmapped font files in the directory, searching for properties named FONT or the name of the file stripped of its suffix. These are used as font names, which are written to the fonts.dir file in the directory along with the name of the font file. The fonts.dir file is then used by the X server and the Font server to determine which fonts are available.

The kinds of font files read by the mkfontdir command depend upon the configuration parameters and typically include the following formats:

Item Description
Portable Compile Format (suffix .pcf)
Compressed PCF (suffix .pcf.Z)
Server Natural Format (suffix .snf)
Compressed SNF (suffix .snf.Z)
Bitmap Distribution Format (suffix .bdf)
Compressed BDF (suffix .bdf.Z)

If a font exists in multiple formats, the most efficient format is used (PCF format before SNF then BDF formats).

Scalable fonts are not automatically recognized by mkfontdir. You can contruct a fonts.scale file (the format is identical to that in the fonts.dir file) containing entries for scalable fonts. Then, when you run mkfontdir on a directory, it copies entries from the fonts.scale file in that directory into the fonts.dir file it constructs in that directory.

You can create the fonts.alias file, which can be put in any directory of the font path, to map new names to existing fonts. This file should be edited by hand. The format is two columns separated by white space, with the first column containing aliases and the second column containing font-name patterns.

When a font alias is used by an X client, the X server searches for the name it references by looking through each font directory in turn. Therefore, the aliases and the font files do not need to be in the same directory.

To embed white space in aliases or font-name patterns, enclose them in double-quotation marks. To embed double-quotation marks, or any other characters, precede each character with a \ (backslash).

"magic-alias with spaces" "\"font\name\"with quotes"
regular-alias                   fixed

If the character string FILE_NAMES_ALIASES stands alone on a line, each file name in the directory when stripped of its suffix (such as .pcf or .pcf.Z) is used as an alias for that font.

The X server and the Font Server look for fonts.dir and fonts.alias files in each directory in the font path each time the font path is set.

Examples

To create a fonts.dir file from a directory of font files, enter:

mkfontdir DirectoryName

If no directory name is specified, the mkfontdir command reads the current directory.

Files

Item Description
/usr/lib/X11/fonts Is the directory containing font files, fonts.dir and fonts.alias files.