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.
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.
UnclosedContour
A glyph’s outline contour is not closed with a trailing
Close command.
Fields
NonFiniteCoordinate
An outline coordinate is NaN or infinite. Named per field so the message points at the exact command slot that is corrupt.
Fields
NonMonotonicCmap
cmap entries are not strictly increasing in codepoint order — either
unsorted segments or two segments that overlap.
Fields
UnknownGlyph
A glyph id referenced by the model (from cmap or kerning) does not
exist in the font’s glyph store.
Fields
AdvanceOverflow
A computed advance width does not fit the u16 that hmtx stores.
Fields
UnsupportedCmapFormat
A cmap subtable format outside the modelled set (4 and 12) was
encountered while reading a font.
Parse
Reading a font failed: the byte-level parser rejected the input.