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§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()