Search code examples
pdftruetype

Does TrueType require the 'cmap' table; must it cover all contained glyphs?


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.


Solution

  • 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.