pub struct Cmap<'a> { /* private fields */ }Expand description
Implementations§
Source§impl<'a> Cmap<'a>
impl<'a> Cmap<'a>
pub const MIN_SIZE: usize
Sourcepub fn resolve_offset<O: Offset, R: FontRead<'a>>(
&self,
offset: O,
) -> Result<R, ReadError>
pub fn resolve_offset<O: Offset, R: FontRead<'a>>( &self, offset: O, ) -> Result<R, ReadError>
Resolve the provided offset from the start of this table.
Sourcepub fn offset_data(&self) -> FontData<'a>
pub fn offset_data(&self) -> FontData<'a>
Return a reference to this table’s raw data.
We use this in the compile crate to resolve offsets.
Sourcepub fn shape(&self) -> &Self
👎Deprecated: just use the base type directly
pub fn shape(&self) -> &Self
just use the base type directly
Return a reference to the table’s ‘Shape’ struct.
This is a low level implementation detail, but it can be useful in some cases where you want to know things about a table’s layout, such as the byte offsets of specific fields.
Sourcepub fn num_tables(&self) -> u16
pub fn num_tables(&self) -> u16
Number of encoding tables that follow.
pub fn encoding_records(&self) -> &'a [EncodingRecord]
pub fn version_byte_range(&self) -> Range<usize> ⓘ
pub fn num_tables_byte_range(&self) -> Range<usize> ⓘ
pub fn encoding_records_byte_range(&self) -> Range<usize> ⓘ
Source§impl<'a> Cmap<'a>
impl<'a> Cmap<'a>
Sourcepub fn map_codepoint(&self, codepoint: impl Into<u32>) -> Option<GlyphId>
pub fn map_codepoint(&self, codepoint: impl Into<u32>) -> Option<GlyphId>
Map a codepoint to a nominal glyph identifier
This uses the first available subtable that provides a valid mapping.
§Note:
Mapping logic is currently only implemented for the most common subtable formats.
Sourcepub fn best_subtable(&self) -> Option<(u16, EncodingRecord, CmapSubtable<'a>)>
pub fn best_subtable(&self) -> Option<(u16, EncodingRecord, CmapSubtable<'a>)>
Returns the index, encoding record and subtable for the most comprehensive mapping available.
Comprehensive means that tables capable of mapping the Unicode full repertoire are chosen over those that only support the basic multilingual plane. The exception is that symbol mappings are preferred above all others (see https://github.com/harfbuzz/harfbuzz/issues/1918).
Sourcepub fn uvs_subtable(&self) -> Option<(u16, Cmap14<'a>)>
pub fn uvs_subtable(&self) -> Option<(u16, Cmap14<'a>)>
Returns the index and subtable for the first mapping capable of handling Unicode variation sequences.
This is always a format 14 subtable.
Sourcepub fn subtable(&self, index: u16) -> Result<CmapSubtable<'a>, ReadError>
pub fn subtable(&self, index: u16) -> Result<CmapSubtable<'a>, ReadError>
Returns the subtable at the given index.
pub fn closure_glyphs( &self, unicodes: &IntSet<u32>, glyph_set: &mut IntSet<GlyphId>, )
std only.