Skip to main content

ModelError

Enum ModelError 

Source
pub enum ModelError {
    InvalidUnitsPerEm {
        units_per_em: u16,
    },
    ZeroAdvance {
        glyph: GlyphId,
    },
    UnclosedContour {
        glyph: GlyphId,
        contour: usize,
    },
    NonFiniteCoordinate {
        glyph: GlyphId,
        contour: usize,
        command: usize,
        field: &'static str,
    },
    NonMonotonicCmap {
        subtable: usize,
        previous: u32,
        current: u32,
    },
    UnknownGlyph {
        glyph: GlyphId,
        glyph_count: usize,
    },
    AdvanceOverflow {
        glyph: GlyphId,
        advance: i32,
    },
    UnsupportedCmapFormat {
        format: u16,
    },
    Parse {
        message: String,
    },
}
Expand description

The single crate-level error for model construction, validation, and subsetting.

Variants§

§

InvalidUnitsPerEm

unitsPerEm is outside the OpenType-legal range 16..=16384.

Fields

§units_per_em: u16

The rejected value.

§

ZeroAdvance

A glyph with at least one outline point has a zero advance width. An empty (space-like) glyph may legitimately have a zero advance.

Fields

§glyph: GlyphId

The glyph whose advance_width is zero.

§

UnclosedContour

A glyph’s outline contour is not closed with a trailing Close command.

Fields

§glyph: GlyphId

The glyph with the unclosed contour.

§contour: usize

Index of the offending contour within the outline.

§

NonFiniteCoordinate

An outline coordinate is NaN or infinite. Named per field so the message points at the exact command slot that is corrupt.

Fields

§glyph: GlyphId

The glyph with the corrupt coordinate.

§contour: usize

Index of the contour within the outline.

§command: usize

Index of the command within the contour.

§field: &'static str

The field name ("x", "y", "control.x", …).

§

NonMonotonicCmap

cmap entries are not strictly increasing in codepoint order — either unsorted segments or two segments that overlap.

Fields

§subtable: usize

Index of the offending subtable within the cmap.

§previous: u32

The previously seen codepoint.

§current: u32

The codepoint that broke monotonicity.

§

UnknownGlyph

A glyph id referenced by the model (from cmap or kerning) does not exist in the font’s glyph store.

Fields

§glyph: GlyphId

The dangling reference.

§glyph_count: usize

How many glyphs the font actually holds.

§

AdvanceOverflow

A computed advance width does not fit the u16 that hmtx stores.

Fields

§glyph: GlyphId

The glyph whose advance could not be represented.

§advance: i32

The unclamped advance in font units.

§

UnsupportedCmapFormat

A cmap subtable format outside the modelled set (4 and 12) was encountered while reading a font.

Fields

§format: u16

The rejected format number.

§

Parse

Reading a font failed: the byte-level parser rejected the input.

Fields

§message: String

The parser’s own message, verbatim.

Trait Implementations§

Source§

impl Clone for ModelError

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

Source§

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

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

impl Display for ModelError

Source§

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

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

impl From<ParseError> for ModelError

Source§

fn from(e: ParseError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ModelError

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 ModelError

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.