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: FUnderlying face.
Implementations§
source§impl<F> PreParsedSubtables<'_, F>
 
impl<F> PreParsedSubtables<'_, F>
sourcepub fn glyph_index(&self, c: char) -> Option<GlyphId>
 
pub fn glyph_index(&self, c: char) -> Option<GlyphId>
Maps a character to a GlyphId using pre-parsed unicode cmap subtables.
sourcepub fn glyph_variation_index(&self, c: char, v: char) -> Option<GlyphId>
 
pub fn glyph_variation_index(&self, c: char, v: char) -> Option<GlyphId>
Maps a variation of a character to a GlyphId using pre-parsed unicode cmap subtables.
sourcepub fn glyphs_hor_kerning(&self, first: GlyphId, second: GlyphId) -> Option<i16>
 
pub fn glyphs_hor_kerning(&self, first: GlyphId, second: GlyphId) -> Option<i16>
Returns horizontal kerning for a pair of glyphs using pre-parsed kern subtables.
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§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§fn set_variation(&mut self, axis: Tag, value: f32) -> Option<()>
 
fn set_variation(&mut self, axis: Tag, value: f32) -> Option<()>
Sets a variation axis coordinate. Read more
source§impl<F> FaceMut for PreParsedSubtables<'_, F>where
    F: FaceMut,
 
impl<F> FaceMut for PreParsedSubtables<'_, F>where
    F: FaceMut,
source§fn set_variation(&mut self, axis: Tag, value: f32) -> Option<()>
 
fn set_variation(&mut self, axis: Tag, value: f32) -> Option<()>
Sets a variation axis coordinate. Read more
source§impl<'face> From<Face<'face>> for PreParsedSubtables<'face, Face<'face>>
 
impl<'face> From<Face<'face>> for PreParsedSubtables<'face, Face<'face>>
Auto Trait Implementations§
impl<'face, F> Freeze for PreParsedSubtables<'face, F>where
    F: Freeze,
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§
§impl<T> Any for Twhere
    T: 'static + ?Sized,
 
impl<T> Any for Twhere
    T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
    T: ?Sized,
 
impl<T> Borrow<T> for Twhere
    T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
 
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)