#[non_exhaustive]pub enum Error {
Show 15 variants
TtLib(String),
FileIsCollection(String),
TableNotFound(Tag),
GlyphNotFound(String),
Struct(String),
Assertion(String),
Value(String),
Decompile {
tag: Tag,
source: Box<Error>,
},
Compile {
tag: Tag,
source: Box<Error>,
},
TtxParse(String),
TableBusy(Tag),
WrongTableType(Tag),
OffsetOverflow(Box<OverflowErrorRecord>),
Io(Error),
Import(String),
}Expand description
Errors from reading, writing or converting fonts.
The variants correspond to the exceptions fontTools raises, so that callers can tell them apart the same way.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TtLib(String)
TTLibError: malformed or unsupported font data, or a misuse of the API.
FileIsCollection(String)
TTLibFileIsCollectionError: a collection was opened without a valid font
number.
TableNotFound(Tag)
KeyError for a missing table.
GlyphNotFound(String)
KeyError for an unknown glyph name.
Struct(String)
struct.error: data too short to unpack, or a value that does not fit its
binary field.
Assertion(String)
AssertionError raised by fontTools on inconsistent data.
Value(String)
ValueError / TypeError for invalid values.
Decompile
An error while decompiling a table, with the table it occurred in.
Compile
An error while compiling a table, with the table it occurred in.
TtxParse(String)
TTXParseError or an XML syntax error.
TableBusy(Tag)
A required table is currently being decompiled, compiled or dumped, so it cannot be accessed (a circular dependency between tables).
WrongTableType(Tag)
A table exists but is not of the requested type (for example, it could not be decompiled and is kept as raw data).
OffsetOverflow(Box<OverflowErrorRecord>)
OTLOffsetOverflowError: a 16-bit offset does not fit while compiling an
OpenType Layout table.
Io(Error)
An I/O error.
Import(String)
ImportError: the functionality needs an optional dependency of
fontTools (one of its extras), which the Cargo feature of the same name
leaves out; the message is fontTools’ (for example
No module named brotli).
Implementations§
Source§impl Error
impl Error
Sourcepub fn into_pen_error(self) -> Error
pub fn into_pen_error(self) -> Error
This error as one of fontoxide_pens, to pass it through a pen.
Sourcepub fn root_cause(&self) -> &Error
pub fn root_cause(&self) -> &Error
The innermost error, skipping the Decompile/Compile wrappers.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()