pub struct SubsetFont {
pub bytes: Vec<u8>,
pub glyph_mapping: BTreeMap<u16, (u16, char)>,
}Expand description
Result of font subsetting operation.
Contains the subsetted font bytes and a mapping from original glyph IDs to new glyph IDs in the subset.
Fields§
§bytes: Vec<u8>The subsetted font file bytes (smaller than original).
glyph_mapping: BTreeMap<u16, (u16, char)>Mapping: original glyph ID -> (new subset glyph ID, source character).
Implementations§
Source§impl SubsetFont
impl SubsetFont
Sourcepub fn subset_text(&self, text: &str) -> String
pub fn subset_text(&self, text: &str) -> String
Return the changed text so that when rendering with the subset font (instead of the original) the renderer will end up at the same glyph IDs as if we used the original text on the original font
Trait Implementations§
Source§impl Clone for SubsetFont
impl Clone for SubsetFont
Source§fn clone(&self) -> SubsetFont
fn clone(&self) -> SubsetFont
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for SubsetFont
impl RefUnwindSafe for SubsetFont
impl Send for SubsetFont
impl Sync for SubsetFont
impl Unpin for SubsetFont
impl UnwindSafe for SubsetFont
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more