#[non_exhaustive]pub enum FontReader<'a> {
OpenType(OpenTypeReader<'a>),
Woff2(Woff2Reader),
}Expand description
Generic font reader that auto-detects the file format based on its first bytes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
OpenType(OpenTypeReader<'a>)
OpenType reader.
Woff2(Woff2Reader)
Available on crate feature
woff2 only.WOFF2 reader.
Implementations§
Source§impl<'a> FontReader<'a>
impl<'a> FontReader<'a>
Sourcepub fn new(bytes: &'a [u8]) -> Result<Self, ParseError>
pub fn new(bytes: &'a [u8]) -> Result<Self, ParseError>
Creates a reader.
§Errors
Returns parsing errors if any are encountered. This includes the case when the file format cannot be detected.
Sourcepub fn format(&self) -> FileFormat
pub fn format(&self) -> FileFormat
Returns the font format.
Sourcepub fn raw_tables(
&self,
) -> impl ExactSizeIterator<Item = (TableTag, &[u8])> + '_
pub fn raw_tables( &self, ) -> impl ExactSizeIterator<Item = (TableTag, &[u8])> + '_
Iterates over all tables in the file (including ones that are not processed by Font).
Trait Implementations§
Source§impl<'a> Clone for FontReader<'a>
impl<'a> Clone for FontReader<'a>
Source§fn clone(&self) -> FontReader<'a>
fn clone(&self) -> FontReader<'a>
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<'a> Freeze for FontReader<'a>
impl<'a> RefUnwindSafe for FontReader<'a>
impl<'a> Send for FontReader<'a>
impl<'a> Sync for FontReader<'a>
impl<'a> Unpin for FontReader<'a>
impl<'a> UnwindSafe for FontReader<'a>
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