1
votes

The purpose of TrueType's font table cmap purpose is clear: It allows to defined one (or even multiple) ways to map input "character codes" with the glyphs contained in the file.

However I wonder if the TrueType reference does require its presence? And furthermore even if it was mandated that cmap should exist, must it provide a mapping for that covers all glyphs?

Background Let me provide the motivation to this question, for those who wonder: Why would somebody event think it sensible to not provide for a mapping?
Would this not make the omitted (no mapping provided) glyphs, inaccessible, what is the point?

PDF has a text encoding defined as /Identity-H which for TrueType fonts maps 16bit words from a text directly to the glyph indeces (refered to as GID), meaning when embedding a TrueType font program in a pdf file and using the /Identity-H encoding for this font, to the best of my undersanding the cmap table is made obsolete, hence the wish to not having to include it in the subset fonts I embed.

3

3 Answers

4
votes

From PDF 32000-1:2008 - 9.9 Embedded Font Programs:

[...]These TrueType tables shall always be present if present in the original TrueType font program: “head”, “hhea”, “loca”, “maxp”, “cvt”, “prep”, “glyf”, “hmtx”, and “fpgm”. If used with a simple font dictionary, the font program shall additionally contain a cmap table defining one or more encodings, as discussed in 9.6.6.4, "Encodings for TrueType Fonts". If used with a CIDFont dictionary, the cmap table is not needed and shall not be present, since the mapping from character codes to glyph descriptions is provided separately.[...]

So the cmap table shall be not present if it is used with a CIDFont.

2
votes

There are two specs being discussed here: the TrueType one, cited in @JosephA answer and PDF one cited in @Jan Slabon answer.

The TrueType spec really mark cmap table as required, so a font file without cmap can be considered invalid.

The PDF spec points that when embedding that font, the cmap can be omitted from the font subset being embedded.

To those not acquainted with PDF font embedding, a font can be embedded entirely or, more often, as a subset (only the character/glyphs used in the file are included).

So, while cmap table is required for TrueType fonts it can be excluded from the subset being embedded in the process of creating the PDF.

Also important to point that even when cmap is embedded, only the relevant cmap entries (used glyphs) are added to the PDF file minimizing the size impact

1
votes

The TrueType reference mentions in Table 2, that 'cmap' is a required table. I think you're going to get into trouble by purposely trying to create a TrueType font that lacks this table with the hopes that you can rely on the PDF font dictionary's encoding to override it. It's possible PDF TrueType parsing code will not be expecting the cmap table to be present, will raise an error when it's not found, etc. In general I don't believe the cmap table is going to take up much space in the first place in the font program.