pub trait Table:
AsAny
+ Send
+ Sync {
// Required methods
fn tag(&self) -> Tag;
fn compile(&mut self, font: &mut Font) -> Result<Vec<u8>>;
fn clone_table(&self) -> Box<dyn Table>;
fn remap_glyphs(
&mut self,
f: &mut dyn FnMut(u32) -> Result<u32>,
) -> Result<()>;
// Provided methods
fn ensure_decompiled(&mut self) { ... }
fn is_raw(&self) -> bool { ... }
fn decompile_error(&self) -> Option<&str> { ... }
}Expand description
A font table (DefaultTable and its subclasses).
The methods take the Font because, as in fontTools, tables consult and even
modify each other: hmtx needs hhea to decompile, compiling maxp updates the
bounding box in head, and so on. While one of these methods runs, the table
itself is detached from the font.
fmt::Debug is not a supertrait, for the same reason as TableXml: the
Debug of dyn Table shows only the tag; downcast to see the contents.
Required Methods§
Sourcefn compile(&mut self, font: &mut Font) -> Result<Vec<u8>>
fn compile(&mut self, font: &mut Font) -> Result<Vec<u8>>
Compiles the table to binary (compile).
Sourcefn clone_table(&self) -> Box<dyn Table>
fn clone_table(&self) -> Box<dyn Table>
A deep copy.
Provided Methods§
Sourcefn ensure_decompiled(&mut self)
fn ensure_decompiled(&mut self)
Expands whatever was left compact when reading (ensureDecompiled).
Sourcefn is_raw(&self) -> bool
fn is_raw(&self) -> bool
Whether this is a plain DefaultTable, which TTX marks as raw.
Sourcefn decompile_error(&self) -> Option<&str>
fn decompile_error(&self) -> Option<&str>
The error message, if decompilation failed and the table was kept as raw
data (ERROR).
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".