pub struct UnicodeCharmap {
mapping: Vec<(u32, GlyphId)>,
}Expand description
A Unicode charmap built from glyph names.
Building one depends on the agl feature.
Fields§
§mapping: Vec<(u32, GlyphId)>Implementations§
Source§impl UnicodeCharmap
impl UnicodeCharmap
Sourcepub fn map(&self, ch: impl Into<u32>) -> Option<GlyphId>
pub fn map(&self, ch: impl Into<u32>) -> Option<GlyphId>
Returns the glyph id for the given character.
A base glyph is preferred, and a variant is used where the font has no base glyph for the character.
Sourcepub(crate) fn next_char(&self, ch: u32) -> Option<(u32, GlyphId)>
pub(crate) fn next_char(&self, ch: u32) -> Option<(u32, GlyphId)>
Returns the first character above ch that has a glyph, and the
glyph.
Sourcefn search(&self, ch: u32, wrapping_index: bool) -> (Option<GlyphId>, usize)
fn search(&self, ch: u32, wrapping_index: bool) -> (Option<GlyphId>, usize)
Searches for ch as FreeType does, returning the glyph found and the
index of the first entry at or above ch.
The search keeps a variant until it finds the base glyph, and after
each step predicts the next entry as in a run of consecutive
characters. Where several glyphs share a character, the predictions
decide which is found. A step below the current entry is a large
unsigned step forwards. char_next keeps a 32 bit index, so the step
wraps around to the entry below. char_index keeps a pointer, which
wraps the same way on 32 bit targets and lands past the end on 64 bit
ones, so its results depend on the target.
Trait Implementations§
Source§impl Clone for UnicodeCharmap
impl Clone for UnicodeCharmap
Source§fn clone(&self) -> UnicodeCharmap
fn clone(&self) -> UnicodeCharmap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more