Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 21 variants UnexpectedEof, BadMagic, BadHeader, BadOffset, MissingTable(&'static str), MissingCff, Cff2NotImplemented, GlyphOutOfRange(u16), UnsupportedCmapFormat(u16), Cff(&'static str), BadStructure(&'static str), CharstringStackOverflow, CharstringStackUnderflow, CharstringBadSubrIndex(i32), CharstringNoLocalSubrs, CharstringTooDeep, CharstringTooLong, CharstringUnsupportedOp(u16), CharstringSeacBadComponent(u8), CharstringSeacNested, CharstringTransientIndex(i32), // some variants omitted
}
Expand description

Errors emitted during font parsing or glyph lookup.

Variants§

§

UnexpectedEof

The input slice was too short for the requested header / structure.

§

BadMagic

The sfnt magic version did not match OTTO, 0x00010000, or true.

§

BadHeader

The table count in the sfnt header is implausibly large.

§

BadOffset

An offset / length field pointed outside the file.

§

MissingTable(&'static str)

A required table was missing from the table directory.

§

MissingCff

The font has no CFF or CFF2 table.

§

Cff2NotImplemented

CFF2-flavoured fonts are parsed for metadata (header, Top DICT, structural INDEXes — see the cff2 module), but Type 2 charstring decoding for CFF2 (with blend + vsindex resolution against the ItemVariationStore) is not yet implemented; Font::glyph_outline returns this error on a CFF2 font.

§

GlyphOutOfRange(u16)

A glyph index was out of range vs. maxp.numGlyphs / CharStrings INDEX count.

§

UnsupportedCmapFormat(u16)

A cmap subtable used a format we do not implement in round 1.

§

Cff(&'static str)

CFF-specific failure with a brief reason.

§

BadStructure(&'static str)

A varying-length structure was malformed in a non-CFF table (head, hhea, maxp, hmtx, name, cmap).

§

CharstringStackOverflow

Operand stack overflowed (>= 192 entries).

§

CharstringStackUnderflow

Operator consumed more operands than the stack held.

§

CharstringBadSubrIndex(i32)

Operator referenced a subroutine number outside the INDEX range.

§

CharstringNoLocalSubrs

callsubr was used in a font that has no Local Subrs INDEX.

§

CharstringTooDeep

Subroutine recursion exceeded the spec cap (TN5177 §4.5: 10).

§

CharstringTooLong

Charstring processed too many bytes (DoS bound).

§

CharstringUnsupportedOp(u16)

Charstring used an operator we don’t yet implement.

§

CharstringSeacBadComponent(u8)

endchar was used in its deprecated four-operand seac form (TN5177 Appendix C / Type 1 seac) but a referenced component glyph could not be resolved through the Standard Encoding table + the font’s charset. The contained byte is the unresolved Standard-Encoding code (bchar or achar).

§

CharstringSeacNested

Nested seac was attempted. The spec forbids it (TN5177 Appendix C: “This construct may not be nested.”).

§

CharstringTransientIndex(i32)

A put / get storage operator (TN5177 §4.5) referenced a transient-array index outside 0..32 (Appendix B fixes the array at 32 elements). The contained value is the offending index.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

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 Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Eq for Error

Source§

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for Error

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.