[][src]Module informa::sfnt::tables::cmap::format4

Format 4: Segment mapping to delta values

Implementation of the cmap format 4 subtable.

Specification: OpenType, TrueType.

The entry to this module is the compile function. It returns a cmap format 4 subtable for a given character map.

The cmap format 4 subtable allows for considerable file size optimizations. Some of these optimizations are enabled by default, others need to be enabled manually. The compiler feature cmap_format4_advanced_segment_merging controls whether advanced optimizations should be applied and cmap_format4_evaluate_all_segments allows for further optimizations.

Examples

let ctx = Context::default();
let mut map = CharacterMap::new();
map.insert('A', 1);
map.insert('B', 2);
map.insert('C', 3);
let subtable = compile(&map, &ctx);

compile_segments allows manual control over the segments used. encoding_segments returns a segmentation for a character map.

let mut segments = encoding_segments(&map, &ctx);
segments.push(Segment::sentinel());
let subtable = compile_segments(&map, &segments);

Structs

Segment

A segment is a range of continuous character codes with an encoding strategy.

Enums

SegmentEncodingStrategy

The strategy used to encode a segment.

Constants

SENTINEL_SCALER

The Unicode scaler used as a sentinel value for the character search.

Functions

compile

Returns a cmap format 4 subtable representing the given character map.

compile_segments

Returns a cmap format 4 subtable representing the given segments.

encoding_segments

Returns a segmentation of the given character map suitable for compile.

encoding_segments_continuous

Returns a segmentation of the given mappings where mappings is required to have continuous character codes.