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

Maps a character to a GlyphId using pre-parsed unicode cmap subtables.

Returns horizontal kerning for a pair of glyphs using pre-parsed kern subtables.

Trait Implementations

Convert to a Face reference.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.