pub struct FontCollection<'a> { /* private fields */ }Expand description
A parsed TTC collection: N font directories sharing table data.
Implementations§
Source§impl<'a> FontCollection<'a>
impl<'a> FontCollection<'a>
Sourcepub fn parse(data: &'a [u8]) -> Result<Self, ParseError>
pub fn parse(data: &'a [u8]) -> Result<Self, ParseError>
Parse and validate the TTC header.
§Errors
ParseError::InvalidSfnt for a bad signature or version;
ParseError::TruncatedTable when the offset array is short.
Sourcepub fn font(&self, index: usize) -> Result<FontRef<'a>, ParseError>
pub fn font(&self, index: usize) -> Result<FontRef<'a>, ParseError>
Font index as a zero-copy reference over the whole collection
buffer (TTC table offsets are file-relative, so sharing works).
§Errors
ParseError::CollectionIndexOutOfBounds beyond the font count;
ParseError::InvalidSfnt / ParseError::TruncatedTable for a
malformed directory.
Trait Implementations§
Source§impl<'a> Clone for FontCollection<'a>
impl<'a> Clone for FontCollection<'a>
Auto Trait Implementations§
impl<'a> Freeze for FontCollection<'a>
impl<'a> RefUnwindSafe for FontCollection<'a>
impl<'a> Send for FontCollection<'a>
impl<'a> Sync for FontCollection<'a>
impl<'a> Unpin for FontCollection<'a>
impl<'a> UnsafeUnpin for FontCollection<'a>
impl<'a> UnwindSafe for FontCollection<'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