Skip to main content

Table

Trait Table 

Source
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§

Source

fn tag(&self) -> Tag

The table tag (tableTag).

Source

fn compile(&mut self, font: &mut Font) -> Result<Vec<u8>>

Compiles the table to binary (compile).

Source

fn clone_table(&self) -> Box<dyn Table>

A deep copy.

Source

fn remap_glyphs(&mut self, f: &mut dyn FnMut(u32) -> Result<u32>) -> Result<()>

Maps every glyph ID in the table with f, as when the glyph order changes (fontTools refers to glyphs by name, so this happens implicitly there). f fails for glyphs that no longer exist.

Provided Methods§

Source

fn ensure_decompiled(&mut self)

Expands whatever was left compact when reading (ensureDecompiled).

Source

fn is_raw(&self) -> bool

Whether this is a plain DefaultTable, which TTX marks as raw.

Source

fn decompile_error(&self) -> Option<&str>

The error message, if decompilation failed and the table was kept as raw data (ERROR).

Trait Implementations§

Source§

impl Clone for Box<dyn Table>

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 dyn Table

Source§

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

Formats the value using the given formatter. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Table for Ankr

Source§

impl Table for AsciiTable

Source§

impl Table for Avar

Source§

impl Table for Base

Source§

impl Table for Bgcl

Source§

impl Table for Bhed

Source§

impl Table for Bsln

Source§

impl Table for Cff

Source§

impl Table for Cff2

Source§

impl Table for Cidg

Source§

impl Table for Cmap

Source§

impl Table for Colr

Source§

impl Table for Cpal

Source§

impl Table for Cvar

Source§

impl Table for Cvt

Source§

impl Table for Debg

Source§

impl Table for DefaultTable

Source§

impl Table for Dmap

Source§

impl Table for Dsig

Source§

impl Table for Ebsc

Source§

impl Table for fontoxide_ttlib::tables::graphite::Feat

Source§

impl Table for fontoxide_ttlib::tables::otl::Feat

Source§

impl Table for Fftm

Source§

impl Table for Fpgm

Source§

impl Table for Fvar

Source§

impl Table for Gasp

Source§

impl Table for Gcid

Source§

impl Table for Gdef

Source§

impl Table for Glat

Source§

impl Table for Gloc

Source§

impl Table for Glyf

Source§

impl Table for Gpos

Source§

impl Table for Gsub

Source§

impl Table for Gvar

Source§

impl Table for Hdmx

Source§

impl Table for Head

Source§

impl Table for Hhea

Source§

impl Table for Hmtx

Source§

impl Table for Hvar

Source§

impl Table for Ift

Source§

impl Table for Iftx

Source§

impl Table for Jstf

Source§

impl Table for Kern

Source§

impl Table for Lcar

Source§

impl Table for Loca

Source§

impl Table for Ltag

Source§

impl Table for Ltsh

Source§

impl Table for Math

Source§

impl Table for Maxp

Source§

impl Table for Meta

Source§

impl Table for Mort

Source§

impl Table for Morx

Source§

impl Table for Mvar

Source§

impl Table for Name

Source§

impl Table for Opbd

Source§

impl Table for Os2

Source§

impl Table for Post

Source§

impl Table for Prep

Source§

impl Table for Prop

Source§

impl Table for Sbix

Source§

impl Table for Silf

Source§

impl Table for Sill

Source§

impl Table for Stat

Source§

impl Table for Svg

Source§

impl Table for Trak

Source§

impl Table for Tsi5

Source§

impl Table for TsiIndex

Source§

impl Table for TsiPrograms

Source§

impl Table for Tsic

Source§

impl Table for Varc

Source§

impl Table for Vdmx

Source§

impl Table for Vhea

Source§

impl Table for Vmtx

Source§

impl Table for Vorg

Source§

impl Table for Vvar

Source§

impl<const COLOR: bool, const APPLE: bool> Table for BitmapData<COLOR, APPLE>

Source§

impl<const COLOR: bool, const APPLE: bool> Table for BitmapLocator<COLOR, APPLE>