[−][src]Module informa::sfnt::tables::cmap
cmap — Character to Glyph Index Mapping Table
Implementation of the cmap
table.
Specification: OpenType, TrueType.
The cmap
table provides mappings from character codes to glyph ids.
This allows typesetting systems using the font to resolve the glyphs needed to display a string of characters.
Not all glyphs need be covered by cmap
; some glyphs are accessible only using smart font technology or a glyph picker.
Conversely, some glyphs may be mapped to by multiple character codes.
A cmap
table consists of one or multiple subtables.
Subtables are differentiated by their format.
Formats differ in character code encoding, compression strategies, and codepoint space size.
Subtables are accessed by encoding records. A record describes the format of its associated subtable, the intended platform, and the encoding. Multiple records using the same subtable format (but possibly with different platforms and encodings) need not store the same subtable multiple times and instead share the common subtable storage space.
Usage
Use the compile
function to convert a character map to a cmap
table.
The Context::cmap_encoding_records
field can be set to customize the encoding records used by compile
.
Example
let ctx = Context::default(); let mut map = CharacterMap::new(); map.insert('A', 1); map.insert('B', 2); map.insert('C', 3); let table = compile(&map, &ctx);
Modules
format4 | Format 4: Segment mapping to delta values |
format12 | Format 12: Segmented coverage |
Structs
EncodingRecord | An encoding record describes a |
Enums
Encoding | The combination of a platform id and a matching encoding id. |
ReadError | An error that may occur when reading an encoding record. |
RecordFormat | The supported |
UnicodeEncoding | The supported Unicode encodings. |
WindowsEncoding | The supported Windows encodings. |
Functions
compile | Returns a |