[Tex/LaTex] the scheme of fonts naming in PDFs generated by LaTeX and other software


Most of PDF viewing software allows one to see documents properties, in particular, fonts used in them. Some viewers (e.g. Okular of KDE) even allow to extract such fonts to TTF files. I always wondered why names of fonts are often so weird – they contain prefixes. This holds for PDFs produced by PDFLaTeX, XeLateX, MS Word etc. Googling this subject reveals only information about font embedding, which is irrelevant to font naming.

Actually, two related questions arise from this:

  1. Is there any standard that a PDF producing application follows when it chooses font names?
  2. Is there any method to affect naming of fonts generated by LaTeX?

Below is a screenshot of a document properties window of Foxit Reader. Note that "EAPEGA+", "EAPHMM+" etc prefixes that some fonts have.

PDF document properties

EDIT: this thread partly answers to my second question: one can try to uncompress a PDF, then use find-and-replace to substitute font name string, and repack everything back to PDF.

EDIT2 Embedded the image into the post.

Best Answer

The prefixes indicate – as @cfr has already pointed out in the comments (and also in her almost synchronous answer) – that the respective font is embedded only as a subset, ie. that only those glyphs are included that are actually used in the document. These prefixes are meant to prevent clashes between different subsets of the same font, and to allow merging them.

The standard that the PDF-producing application has to follow is Adobe's PDF spec, which says (in section 9.6.4, PDF 1.7):

For a font subset, the PostScript name of the font—the value of the font’s BaseFont entry and the font descriptor’s FontName entry— shall begin with a tag followed by a plus sign (+). The tag shall consist of exactly six uppercase letters; the choice of letters is arbitrary, but different subsets in the same PDF file shall have different tags.

The naming scheme is hard-coded in pdftex, so there is no way to change the font names, other than editing the PDF file itself, which is always quite risky. Also, many viewers (among them, Adobe Reader) will not display the prefix at all.

A final remark regarding microtype, as @cfr brought it up: In contrast to the prefix with subsetting, font expansion lead to having a suffix added to the name of the font which was indeed included multiple times with earlier versions of pdftex. However, this is no longer the case (since pdftex version 1.20), and the size increase of the PDF file with enabled font expansion is negligible.

Related Question