Struct owned_ttf_parser::PreParsedSubtables
source · pub struct PreParsedSubtables<'face, F> {
pub face: F,
/* private fields */
}
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);
Fields§
§face: F
Underlying face.
Implementations§
source§impl<F> PreParsedSubtables<'_, F>
impl<F> PreParsedSubtables<'_, F>
Trait Implementations§
source§impl<F> AsFaceRef for &PreParsedSubtables<'_, F>where
F: AsFaceRef,
impl<F> AsFaceRef for &PreParsedSubtables<'_, F>where
F: AsFaceRef,
source§fn as_face_ref(&self) -> &Face<'_>
fn as_face_ref(&self) -> &Face<'_>
Convert to a
Face
reference.source§impl<F> AsFaceRef for PreParsedSubtables<'_, F>where
F: AsFaceRef,
impl<F> AsFaceRef for PreParsedSubtables<'_, F>where
F: AsFaceRef,
source§fn as_face_ref(&self) -> &Face<'_>
fn as_face_ref(&self) -> &Face<'_>
Convert to a
Face
reference.source§impl<'face, F: Clone> Clone for PreParsedSubtables<'face, F>
impl<'face, F: Clone> Clone for PreParsedSubtables<'face, F>
source§fn clone(&self) -> PreParsedSubtables<'face, F>
fn clone(&self) -> PreParsedSubtables<'face, F>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<F> Debug for PreParsedSubtables<'_, F>
impl<F> Debug for PreParsedSubtables<'_, F>
source§impl<F> FaceMut for &mut PreParsedSubtables<'_, F>where
F: FaceMut,
impl<F> FaceMut for &mut PreParsedSubtables<'_, F>where
F: FaceMut,
source§impl<F> FaceMut for PreParsedSubtables<'_, F>where
F: FaceMut,
impl<F> FaceMut for PreParsedSubtables<'_, F>where
F: FaceMut,
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more