Tx · LaTeX & TikZ

How to Fix “pdfTeX Cannot Open Type 1 Font File”

Published By the 9to5Science editorial team

At a glance

  1. 1. Find the filename

    Read the compilation log to identify the exact .pfb font file pdfTeX cannot open.

  2. 2. Check whether it exists

    Use kpsewhich to see whether TeX can find the font file and its map file.

  3. 3. Install or enable it

    Install the font package, then refresh the filename database or enable its font map.

  4. 4. Compile again

    Rerun pdfLaTeX and check that the missing-file error has disappeared.

The error pdfTeX error: cannot open Type 1 font file for reading means pdfTeX tried to load a Type 1 font file and could not read it. The file is commonly a .pfb file. Your document may have compiled far enough to locate the font’s metrics, but pdfTeX also needs the actual outline file to embed the font in the PDF.

The usual cause is a missing font package or a font map that points to a file TeX cannot find. Use the exact filename from the log to diagnose which case applies before changing your document or reinstalling TeX.

Find the missing font file

Look in the .log file near the error. pdfTeX normally reports the filename it tried to open. It may look like somefont.pfb, though the actual name depends on the font package. Also note the font name and map entry nearby, if shown.

Search for the file with kpsewhich, the TeX tool that checks whether a file is discoverable through TeX’s file-search system. Replace the example filename with the one from your log:

kpsewhich somefont.pfb

If TeX finds the file, the command prints its path. If it prints nothing, TeX cannot find that file in its current search paths. On Windows, run the command in a command prompt where TeX’s executables are available; the same diagnostic applies.

You can check a suspected map file similarly:

kpsewhich somefont.map

The map file connects TeX font names to the outline files pdfTeX needs. The relevant map’s name may appear in the font package documentation or in the log.

Install the font package that provides it

If kpsewhich cannot find the .pfb file, install the package that supplies the font. Use your TeX distribution’s package manager rather than downloading a font file from an untrusted source. In TeX Live, for example, search the package database for the font or package name; in MiKTeX, search for and install the corresponding package using MiKTeX Console.

After installation, refresh the distribution’s file database if needed. In TeX Live, package installation generally updates the database automatically, but you can refresh it with:

mktexlsr

On MiKTeX, use Refresh file name database in MiKTeX Console. Then run kpsewhich somefont.pfb again. If it still returns no path, the font may not have been installed, or the TeX command may be using a different TeX installation than the package manager you updated.

Enable or update the font map

Sometimes the font file is installed and discoverable, but its map is not enabled. A map can tell pdfTeX which outline file to use for a font; a missing or outdated map can therefore cause font-loading problems too.

For TeX Live, first check that the font package provides a map file. If it does, follow that package’s instructions. A common system-wide command to enable a map is:

updmap-sys --enable Map=somefont.map

Replace somefont.map with the actual map filename. On a personal TeX Live installation, the corresponding command may be updmap --enable Map=somefont.map. Avoid enabling a guessed map name: use the file and instructions provided by the font package. If the map is already enabled but refers to a file that is not installed, enabling it again will not fix the missing font.

MiKTeX manages font maps through its own tools and configuration. Install or update the font package in MiKTeX Console, refresh its filename database, and use MiKTeX’s map-management settings or documentation if the map is the part that is missing. Do not apply TeX Live’s updmap commands to a MiKTeX installation.

Worked diagnosis

Suppose the log says pdfTeX cannot open examplefont.pfb. Run:

kpsewhich examplefont.pfb

If the package documentation identifies the map file, check that actual filename as well, for example:

kpsewhich examplefont.map

If kpsewhich cannot find the .pfb file, the font file is not discoverable; install the package that supplies it, refresh the file database, and repeat the check. A missing result for examplefont.map is only meaningful if that is the actual map filename; map filenames do not necessarily match the .pfb filename. If the .pfb is found but the actual map file is not, check the package’s instructions for installing or enabling its map. If both files are found, confirm that the map entry refers to the same filename and that your compilation is using the TeX distribution you just updated.

Then compile the document again. If the error persists, inspect the new log: it may name a different font file, or report a separate permission or file-access problem.

Common mistakes

  • Installing only the LaTeX package. A package that defines font commands may not include the actual Type 1 outlines. Install the font package that provides the .pfb file as well.
  • Editing the .tex file without checking the log. The font may be selected indirectly by a class or another package. The filename in the error is a better starting point than guessing which command chose it.
  • Refreshing the database when the file is absent. A filename database refresh helps TeX find installed files; it cannot create a missing font file.
  • Mixing TeX installations. Updating one distribution will not fix a document compiled by another. Check which pdflatex and kpsewhich commands your editor uses.
  • Treating every case as a font-map problem. If the .pfb file is missing, map changes alone cannot solve the problem. If it exists, then investigate the map, search path, file permissions, and installation in that order.

Switching to LuaLaTeX or XeLaTeX is not a general fix. Those engines handle fonts differently, but they still need access to the fonts your document requests, and changing engines can require changes to the document or its font setup.

References

  1. TeX Live Guide
  2. Kpathsea: A library for path searching

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.