Important: The information in this document is obsolete and should not be used for new development.
The Character-Code Mapping Table
The character-code mapping table, with a tag name of'cmap'
, maps character codes (like ASCII codes) to glyph indexes. The glyph repertoire of an outline font is indexed consecutively from zero to the number of glyphs in the font. The encoding method selected by the font designer depends on the conventions used by the intended platform and sometimes on other platform-specific selectors, such as which script system is in use. A font intended for use on multiple platforms with different conventions requires multiple encoding tables; however, double-byte fonts require various special formats for efficient encoding. As a result, the'cmap'
table may contain multiple encoding components, one for each supported encoding scheme, often in different formats.Character codes that do not correspond to any glyph in the font should be mapped to glyph index 0. At this location in the font there should be a special glyph representing a missing character, which typically is a box (
). For more information on requirements for character-to-glyph mapping, see the TrueType Font Format Specification.
In the simplest case, the character-code mapping table consists of a header component and only one character-mapping format component, which includes an array of glyph indexes. In other cases, there are several character-mapping components in the table.