Font utilities


3.4 Font searching

These programs use the same environment variables and algorithms for finding font files as does (the Unix port of) TeX and its friends.

You specify the default paths in the top-level Makefile. The environment variables TEXFONTS, PKFONTS, TEXPKS, and GFFONTS override those paths. Both the default paths and the environment variable values should consist of a colon-separated list of directories.

Specifically, a TFM file is looked for along the path specified by TEXFONTS; a GF file along GFFONTS, then TEXFONTS; a PK file along PKFONTS, then TEXPKS, then TEXFONTS.

A leading or trailing colon in an environment variable value is replaced by the default path.

A leading `~' or `~user' in a path component is replaced by the current home directory or user's home directory, respectively.

If a directory in a path does not exist, it is simply ignored.

In either the default value or the environment variable value, if a component directory d ends with two slashes, all subdirectories of d are searched: first those subdirectories directly under d, then the subsubdirectories under those, and so on. At each level, the order in which the directories are searched is unspecified.

The subdirectory searching has one known deficiency, for which we know of no good solution. If a directory d being searched for subdirectories contains plain files and symbolic links to other directories, but no real subdirectories, d will be considered a leaf directory, i.e., the symbolic links will not be followed. The only way we know of to fix this is to invoke stat (an expensive system call) on every directory entry. Since font directories often contain hundreds of files, this would make the startup time unacceptably slow.

A directory d explicitly named with two trailing slashes, however, is always searched for subdirectories, even if it is a "leaf". We do this since presumably you would not have asked d to be searched for subdirectories if you didn't want it to be, and therefore you don't have hundreds of files in d.

For example, the following value for an environment variable says to search the following: all subdirectories of the current user's `fonts' directory in his or her home directory, then the directory `fonts' in the user `karl's home directory, and finally the system default directories specified at compilation time.

