pub struct Woff2Reader { /* private fields */ }Available on crate feature
woff2 only.Expand description
Reader for files in the WOFF2 format.
Unlike OpenTypeReader, this reader owns the table data since it needs
to be decompressed. As a result, Self::read() will borrow the data from the reader itself,
not from the original font bytes.
Implementations§
Source§impl Woff2Reader
impl Woff2Reader
Sourcepub fn new(bytes: &[u8]) -> Result<Self, ParseError>
pub fn new(bytes: &[u8]) -> Result<Self, ParseError>
Creates a reader from the specified raw bytes.
This will parse the WOFF2 header and table records and decompress the table data.
§Errors
Returns parsing / decompression errors if any are encountered.
Sourcepub fn opentype_len(&self) -> usize
pub fn opentype_len(&self) -> usize
Returns the byte size of the equivalent OpenType font file.
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 Clone for Woff2Reader
impl Clone for Woff2Reader
Source§fn clone(&self) -> Woff2Reader
fn clone(&self) -> Woff2Reader
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 Woff2Reader
impl RefUnwindSafe for Woff2Reader
impl Send for Woff2Reader
impl Sync for Woff2Reader
impl Unpin for Woff2Reader
impl UnwindSafe for Woff2Reader
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