Struct owned_ttf_parser::PreParsedSubtables [−][src]
pub struct PreParsedSubtables<'face, F> { /* fields omitted */ }
Expand description
A Face
with cmap & kern subtables parsed once on initialization.
Provides much faster PreParsedSubtables::glyph_index
&
PreParsedSubtables::glyphs_hor_kerning
methods compared to the
.as_face_ref()
equivalents that must parse their subtables on each call.
Example
use owned_ttf_parser::{AsFaceRef, GlyphId, OwnedFace, PreParsedSubtables};
let owned_face = OwnedFace::from_vec(owned_font_data, 0).unwrap();
let faster_face = PreParsedSubtables::from(owned_face);
// Lookup a GlyphId using the pre-parsed cmap subtables
// this is much faster than doing: .as_face_ref().glyph_index('x')
assert_eq!(faster_face.glyph_index('x'), Some(GlyphId(91)));
// The rest of the methods are still available as normal
assert_eq!(faster_face.as_face_ref().ascender(), 2254);
Implementations
Trait Implementations
Convert to a Face
reference.
Auto Trait Implementations
impl<'face, F> RefUnwindSafe for PreParsedSubtables<'face, F> where
F: RefUnwindSafe,
impl<'face, F> Send for PreParsedSubtables<'face, F> where
F: Send,
impl<'face, F> Sync for PreParsedSubtables<'face, F> where
F: Sync,
impl<'face, F> Unpin for PreParsedSubtables<'face, F> where
F: Unpin,
impl<'face, F> UnwindSafe for PreParsedSubtables<'face, F> where
F: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more