mkfontdir – create an index of X font files in a directory  – combines fonts.scale with fonts.dir

mkfontdir [-n] [-x suffix] [-r] [-p prefix] [-e encoding-directory-name] … [] [directory-name … ]

For each directory argument, mkfontdir reads all of the font files in the directory searching for properties named “FONT”, or (failing that) the name of the file stripped of its suffix. These are converted to lower case and used as font names, and, along with the name of the font file, are written out to the file “fonts.dir” in the directory. The X server and font server use “fonts.dir” to find font files.

The kinds of font files read by mkfontdir depend on configuration parameters, but typically include PCF (suffix “.pcf”), SNF (suffix “.snf”) and BDF (suffix “.bdf”). If a font exists in multiple formats, mkfontdir will first choose PCF, then SNF and finally BDF.

The first line of fonts.dir gives the number of fonts in the file. The remaining lines list the fonts themselves, one per line, in two fields. First is the name of the font file, followed by a space and the name of the font.