Struct ttf_parser::cmap::Subtable
source · [−]pub struct Subtable<'a> {
pub platform_id: PlatformId,
pub encoding_id: u16,
pub format: Format<'a>,
}
Expand description
A character encoding subtable.
Fields
platform_id: PlatformId
Subtable platform.
encoding_id: u16
Subtable encoding.
format: Format<'a>
A subtable format.
Implementations
sourceimpl<'a> Subtable<'a>
impl<'a> Subtable<'a>
sourcepub fn is_unicode(&self) -> bool
pub fn is_unicode(&self) -> bool
Checks that the current encoding is Unicode compatible.
sourcepub fn glyph_index(&self, code_point: u32) -> Option<GlyphId>
pub fn glyph_index(&self, code_point: u32) -> Option<GlyphId>
Maps a character to a glyph ID.
This is a low-level method and unlike Face::glyph_index
it doesn’t
check that the current encoding is Unicode.
It simply maps a u32
codepoint number to a glyph ID.
Returns None
:
- when glyph ID is
0
. - when format is
MixedCoverage
, since it’s not supported. - when format is
UnicodeVariationSequences
. Useglyph_variation_index
instead.
sourcepub fn glyph_variation_index(
&self,
code_point: u32,
variation: u32
) -> Option<GlyphVariationResult>
pub fn glyph_variation_index(
&self,
code_point: u32,
variation: u32
) -> Option<GlyphVariationResult>
Resolves a variation of a glyph ID from two code points.
Returns None
:
- when glyph ID is
0
. - when format is not
UnicodeVariationSequences
.
sourcepub fn codepoints<F: FnMut(u32)>(&self, f: F)
pub fn codepoints<F: FnMut(u32)>(&self, f: F)
Calls f
for all codepoints contained in this subtable.
This is a low-level method and it doesn’t check that the current
encoding is Unicode. It simply calls the function f
for all u32
codepoints that are present in this subtable.
Note that this may list codepoints for which glyph_index
still returns
None
because this method finds all codepoints which were defined in
this subtable. The subtable may still map them to glyph ID 0
.
Returns without doing anything:
- when format is
MixedCoverage
, since it’s not supported. - when format is
UnicodeVariationSequences
, since it’s not supported.