Glyph lookup β How Kpathsea searches for a bitmap font in GF or PK format given a font name and resolution.
| Use Case | Command / Variable | Description |
|---|---|---|
| π Find existing bitmap font | kpathsea_find_glyph | Search for a font file NAME.DPIFORMAT or dpiDPI/NAME.FORMAT |
| π Look up font alias | texfonts.map via TEXFONTMAPS | Map alternate names to actual font files |
| βοΈ Generate missing font | mktexpk | Run external program to create the font bitmap |
| π Fallback resolution | DVIPSSIZES, TEXSIZES, default_texsizes | Try scaled sizes when exact DPI is not found |
| π Last-resort font | cmr10 (fallback) | Use a standard fallback font if all else fails |
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 fileNAMEat resolutionDPI. The search stops at the first successful lookup.
NAME.DPIFORMAT in the specified format(s).NAME is an alias for a file F in the fontmap file texfonts.map, look for F.DPI.mktexpk) to generate the font (mktex scripts).FALLBACK.DPI, where FALLBACK is some last-resort font (typically cmr10).This is implemented inkpathsea_find_glyphinkpathsea/tex-glyph.c.
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.
dpiDPI/NAME.FORMAT; for example, dpi600/cmr10.pk. This is how fonts are typically stored on filesystems (such as DOS) that permit only three-character extensions.KPSE_BITMAP_TOLERANCE in kpathsea/tex-glyph.h to be DPI / 500 + 1. This is slightly more than the 0.2% minimum allowed by the DVI standard (<CTAN:/dviware/driv-standard/level-0>).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:
Times-Roman instead of ptmr, you can (you get ptmr8r).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:
% on a line and continue to the end of the line. (This provides for names that include a %, ill-advised as that may be.)include, the second word is used as a filename, and it is searched for and read.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).
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.
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/)