pub struct FontSubsetter { /* private fields */ }Available on crate features
svg and font-subset only.Expand description
Font embedder / subsetter based on the font-subset library.
Implementations§
Source§impl FontSubsetter
impl FontSubsetter
Sourcepub fn new(font: FontFace) -> Result<Self, SubsettingError>
pub fn new(font: FontFace) -> Result<Self, SubsettingError>
Sourcepub fn from_faces(
first_face: FontFace,
second_face: Option<FontFace>,
) -> Result<Self, SubsettingError>
pub fn from_faces( first_face: FontFace, second_face: Option<FontFace>, ) -> Result<Self, SubsettingError>
Initializes the subsetter with the specified font.
§Arguments
Currently supports at most 2 input fonts. These may correspond to a regular + bold or regular + italic font faces (can be provided in any order). Each of the provided fonts may be variable (e.g., by weight).
§Errors
Returns an error if parsing font bytes fails.
Trait Implementations§
Source§impl Debug for FontSubsetter
impl Debug for FontSubsetter
Source§impl FontEmbedder for FontSubsetter
impl FontEmbedder for FontSubsetter
Source§type Error = SubsettingError
type Error = SubsettingError
Errors produced by the embedder.
Source§fn embed_font(
&self,
used_chars: BTreeSet<char>,
) -> Result<EmbeddedFont, Self::Error>
fn embed_font( &self, used_chars: BTreeSet<char>, ) -> Result<EmbeddedFont, Self::Error>
Performs embedding. This can involve subsetting the font based on the specified chars used in the transcript. Read more
Auto Trait Implementations§
impl Freeze for FontSubsetter
impl RefUnwindSafe for FontSubsetter
impl Send for FontSubsetter
impl Sync for FontSubsetter
impl Unpin for FontSubsetter
impl UnwindSafe for FontSubsetter
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.