Type Alias Cmap

Source
pub type Cmap<'a> = TableRef<'a, CmapMarker>;
Expand description

Aliased Type§

pub struct Cmap<'a> {
    pub(crate) shape: CmapMarker,
    pub(crate) data: FontData<'a>,
}

Fields§

§shape: CmapMarker§data: FontData<'a>

Implementations§

Source§

impl<'a> Cmap<'a>

Source

pub fn version(&self) -> u16

Table version number (0).

Source

pub fn num_tables(&self) -> u16

Number of encoding tables that follow.

Source

pub fn encoding_records(&self) -> &'a [EncodingRecord]

Source§

impl<'a> Cmap<'a>

Source

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.

Source

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).

Source

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.

Source

pub fn subtable(&self, index: u16) -> Result<CmapSubtable<'a>, ReadError>

Returns the subtable at the given index.

Source

pub fn closure_glyphs( &self, unicodes: &IntSet<u32>, glyph_set: &mut IntSet<GlyphId>, )

Trait Implementations§

Source§

impl<'a> Debug for Cmap<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> FontRead<'a> for Cmap<'a>

Source§

fn read(data: FontData<'a>) -> Result<Self, ReadError>

Read an instance of Self from the provided data, performing validation. Read more
Source§

impl<'a> SomeTable<'a> for Cmap<'a>

Source§

fn type_name(&self) -> &str

The name of this table
Source§

fn get_field(&self, idx: usize) -> Option<Field<'a>>

Access this table’s fields, in declaration order.
Source§

impl TopLevelTable for Cmap<'_>

Source§

const TAG: Tag

cmap