pub struct CollectionHeader {
pub version: (u16, u16),
pub offsets: Vec<u32>,
}Expand description
Parsed TTC header. Carries the per-subfont byte offsets so the caller
can construct a Font<'_> over &bytes[offset..].
Fields§
§version: (u16, u16)(major, minor) from the TTC header. Always (1, 0) or (2, 0)
in real-world fonts; we don’t enforce minor==0 strictly.
offsets: Vec<u32>Per-subfont byte offsets within the parent file.
Implementations§
Source§impl CollectionHeader
impl CollectionHeader
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, Error>
pub fn parse(bytes: &[u8]) -> Result<Self, Error>
Try to parse a TTC header at the start of bytes. Returns
Error::BadMagic if the leading 4 bytes are not 'ttcf' —
callers can use that to differentiate between a TTC and a plain
sfnt without an explicit container probe.
Sourcepub fn font_offset(&self, index: u32) -> Option<u32>
pub fn font_offset(&self, index: u32) -> Option<u32>
File-relative byte offset of subfont index. Returns None if
index is out of range.
Trait Implementations§
Source§impl Clone for CollectionHeader
impl Clone for CollectionHeader
Source§fn clone(&self) -> CollectionHeader
fn clone(&self) -> CollectionHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 CollectionHeader
impl RefUnwindSafe for CollectionHeader
impl Send for CollectionHeader
impl Sync for CollectionHeader
impl Unpin for CollectionHeader
impl UnsafeUnpin for CollectionHeader
impl UnwindSafe for CollectionHeader
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