Skip to main content

ParseError

Enum ParseError 

Source
pub enum ParseError {
    InvalidSfnt,
    UnknownTableTag(RawTag),
    TruncatedTable {
        tag: RawTag,
        expected: usize,
        got: usize,
    },
    InvalidCmapFormat(u16),
    InvalidGlyphFormat,
    UnsupportedWoff2Transform,
    CollectionIndexOutOfBounds {
        index: usize,
        count: usize,
    },
    InvalidUnitsPerEm(u16),
}
Expand description

The single crate-level error for all font parsing.

Variants§

§

InvalidSfnt

The SFNT offset table (or WOFF/WOFF2 header) is malformed: bad signature, impossible table count, or a directory entry whose offset/length pair is out of range.

§

UnknownTableTag(RawTag)

A four-byte tag carried a value outside the known table set, where a known tag was required. Raw (unknown) table access is available via crate::FontRef::table_by_tag — this variant applies to typed lookups only.

§

TruncatedTable

A structure declared (or a read required) more bytes than the buffer holds. Bounds are checked at every read; tag is the table (or container) being read, expected the required absolute end offset, got the bytes actually available.

Fields

§tag: RawTag

Tag of the table (or container pseudo-tag) being read.

§expected: usize

Required absolute end offset in the buffer.

§got: usize

Bytes actually available.

§

InvalidCmapFormat(u16)

A cmap subtable carries a format this parser does not implement (formats 2, 8, 10, 13, 14) or a structurally invalid format number. Supported formats: 0, 4, 6, 12.

§

InvalidGlyphFormat

A glyf/loca/gvar record is structurally invalid: bad coordinate runs, a composite component loop that exceeds the nesting cap, a loca entry descending, or a WOFF2 glyph substream inconsistency.

§

UnsupportedWoff2Transform

A WOFF2 table directory entry declares a transformation version that is not defined for its tag (e.g. transformed name), so the entry cannot be decoded. Only glyf/loca (version 0) and hmtx (version 1) transforms are defined by WOFF2 2.0.

§

CollectionIndexOutOfBounds

A collection (TTC) index beyond the number of fonts declared by the ttcf header.

Fields

§index: usize

Index that was requested.

§count: usize

Number of fonts the collection declares.

§

InvalidUnitsPerEm(u16)

The head table’s unitsPerEm is zero or above the OpenType maximum of 16384.

Trait Implementations§

Source§

impl Clone for ParseError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ParseError

Source§

impl Debug for ParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ParseError

Source§

impl PartialEq for ParseError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ParseError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.