info > (kpathsea)Glyph lookup

πŸ“– NAME

Glyph lookup – How Kpathsea searches for a bitmap font in GF or PK format given a font name and resolution.

πŸš€ Quick Reference

Use CaseCommand / VariableDescription
πŸ”Ž Find existing bitmap fontkpathsea_find_glyphSearch for a font file NAME.DPIFORMAT or dpiDPI/NAME.FORMAT
πŸ”— Look up font aliastexfonts.map via TEXFONTMAPSMap alternate names to actual font files
βš™οΈ Generate missing fontmktexpkRun external program to create the font bitmap
πŸ”„ Fallback resolutionDVIPSSIZES, TEXSIZES, default_texsizesTry scaled sizes when exact DPI is not found
πŸ†˜ Last-resort fontcmr10 (fallback)Use a standard fallback font if all else fails

πŸ” 6.3 Glyph lookup

This section describes how Kpathsea searches for a bitmap font in GF or PK format (or either) given a font name (e.g., cmr10) and a resolution (e.g., 600).

πŸ”Ž Here is an outline of the search strategy (details in the sections below) for a file NAME at resolution DPI. The search stops at the first successful lookup.
This is implemented in kpathsea_find_glyph in kpathsea/tex-glyph.c.

πŸ” 6.3.1 Basic glyph lookup

When Kpathsea looks for a bitmap font NAME at resolution DPI in a format FORMAT, it first checks each directory in the search path for a file NAME.DPIFORMAT; for example, cmr10.600pk. Kpathsea looks for a PK file first, then a GF file.

πŸ”— 6.3.2 Fontmap

If a bitmap font or metric file is not found with the original name (see the previous section), Kpathsea looks through any β€œfontmap” files for an β€œalias” for the original font name. These files are named texfonts.map and searched for along the TEXFONTMAPS environment/config file variable. All texfonts.map files that are found are read; earlier definitions override later ones.

This feature is intended to help in two respects:

  1. πŸ“ An alias name is limited in length only by available memory, not by your filesystem. Therefore, if you want to ask for Times-Roman instead of ptmr, you can (you get ptmr8r).
  2. πŸ”„ A few fonts have historically had multiple names: specifically, LaTeX’s β€œcircle font” has variously been known as circle10, lcircle10, and lcirc10. Aliases can make all the names equivalent, so that it no longer matters what the name of the installed file is; TeX documents will find their favorite name.

The format of fontmap files is straightforward:

If an alias has an extension, it matches only those files with that extension; otherwise, it matches anything with the same root, regardless of extension. For example, an alias foo.tfm matches only when foo.tfm is being searched for; but an alias foo matches foo.vf, foo.600pk, etc.

πŸ“„ As an example, here is an excerpt from the texfonts.map in the Web2c distribution. It makes the old and new names of the LaTeX circle fonts equivalent.

circle10        lcircle10
circle10        lcirc10
lcircle10       circle10
lcircle10       lcirc10
lcirc10         circle10
lcirc10         lcircle10
...
Fontmaps are implemented in the file kpathsea/fontmap.c. The Fontname distribution has much more information on font naming (fontname).

πŸ”„ 6.3.3 Fallback font

If a bitmap font cannot be found or created at the requested size, Kpathsea looks for the font at a set of β€œfallback resolutions”. You specify these resolutions as a colon-separated list (like search paths). Kpathsea looks first for a program-specific environment variable (e.g., DVIPSSIZES for Dvipsk), then the environment variable TEXSIZES, then a default specified at compilation time (the Make variable default_texsizes). You can set this list to be empty if you prefer to find fonts at their stated size or not at all.

Finally, if the font cannot be found even at the fallback resolutions, Kpathsea looks for a fallback font, typically cmr10. Programs must enable this feature by calling kpathsea_init_prog (Calling sequence); the default is no fallback font.

(kpathsea)Glyph lookup
πŸ“– NAME πŸš€ Quick Reference πŸ” 6.3 Glyph lookup
πŸ” 6.3.1 Basic glyph lookup πŸ”— 6.3.2 Fontmap πŸ”„ 6.3.3 Fallback font

Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-14 21:44 @2600:1f28:365:80b0:4d23:66fa:c2bb:7bae
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^