pub struct CmapSubtable {
pub kind: SubtableKind,
pub format: u16,
pub platform_id: u16,
pub plat_enc_id: u16,
pub language: Option<u32>,
pub cmap: Arc<CharMap>,
pub reserved: u16,
pub length: u32,
pub n_groups: u32,
pub num_var_selector_records: u32,
pub uvs_dict: Option<UvsDict>,
pub data: Option<Vec<u8>>,
}Expand description
A cmap subtable (CmapSubtable and its subclasses).
Fields§
§kind: SubtableKindThe subtable class.
format: u16The format number (format).
platform_id: u16The platform ID (platformID).
plat_enc_id: u16The encoding ID (platEncID).
language: Option<u32>The language (language); None where fontTools has none (a subtable not
read from anywhere yet, or an unknown format read from TTX).
cmap: Arc<CharMap>The mapping (cmap). Subtables at the same offset in a decompiled table
share it, as in fontTools, and are compiled only once; use
Arc::make_mut to modify it.
reserved: u16The reserved field of formats 12 and 13 (reserved).
length: u32The subtable length, as read (length; written to TTX for formats 12 and
13).
n_groups: u32The number of groups, as read (nGroups; formats 12 and 13).
num_var_selector_records: u32The number of variation selector records, as read (numVarSelectorRecords;
formats 14 and 15).
uvs_dict: Option<UvsDict>The variation sequences of formats 14 and 15 (uvsDict). None if not set,
as for a subtable sharing its data with an earlier one.
data: Option<Vec<u8>>The raw subtable of an unknown format, header included (data).
Implementations§
Source§impl CmapSubtable
impl CmapSubtable
Sourcepub fn new(format: u16) -> Self
pub fn new(format: u16) -> Self
A new, empty subtable of the given format (CmapSubtable.newSubtable).
Sourcepub fn is_unicode(&self) -> bool
pub fn is_unicode(&self) -> bool
Whether the characters are Unicode code points (isUnicode).
Sourcepub fn encoding(&self) -> Option<&'static str>
pub fn encoding(&self) -> Option<&'static str>
The codec of the subtable’s encoding, None if unknown (getEncoding()).
Sourcepub fn is_symbol(&self) -> bool
pub fn is_symbol(&self) -> bool
Whether the subtable is for the Symbol encoding (3, 0) (isSymbol).
Sourcepub fn cmap_mut(&mut self) -> &mut CharMap
pub fn cmap_mut(&mut self) -> &mut CharMap
The mapping, for modification (Arc::make_mut on CmapSubtable::cmap).
Sourcepub fn decompile(&mut self, data: &[u8]) -> Result<()>
pub fn decompile(&mut self, data: &[u8]) -> Result<()>
Decompiles a subtable from its data, header included (decompile(data, ttFont)).