Skip to main content

write_fonts/
tables.rs

1//! A directory of all the font tables.
2
3// NOTE: if you add a new table, also add it to the test below to make sure
4// that serde works!
5
6pub mod avar;
7pub mod base;
8pub mod cmap;
9pub mod colr;
10pub mod cpal;
11pub mod cvar;
12pub mod dsig;
13pub mod fvar;
14pub mod gasp;
15pub mod gdef;
16pub mod glyf;
17pub mod gpos;
18pub mod gsub;
19pub mod gvar;
20pub mod head;
21pub mod hhea;
22pub mod hmtx;
23pub mod hvar;
24pub mod layout;
25pub mod loca;
26pub mod maxp;
27pub mod meta;
28pub mod mvar;
29pub mod name;
30pub mod os2;
31pub mod post;
32pub mod sbix;
33pub mod stat;
34pub mod varc;
35pub mod variations;
36pub mod vhea;
37pub mod vmtx;
38pub mod vvar;
39
40#[cfg(feature = "ift")]
41pub mod ift;
42
43// ensure that all of our types implement the serde traits
44#[cfg(feature = "serde")]
45#[test]
46fn do_we_even_serde() {
47    #[derive(Default, serde::Deserialize, serde::Serialize)]
48    struct AllTables {
49        avar: avar::Avar,
50        base: base::Base,
51        cmap: cmap::Cmap,
52        cpal: cpal::Cpal,
53        cvar: cvar::Cvar,
54        dsig: dsig::Dsig,
55        fvar: fvar::Fvar,
56        gasp: gasp::Gasp,
57        gdef: gdef::Gdef,
58        glyf: glyf::Glyf,
59        gpos: gpos::Gpos,
60        gsub: gsub::Gsub,
61        gvar: gvar::Gvar,
62        head: head::Head,
63        hhea: hhea::Hhea,
64        hmtx: hmtx::Hmtx,
65        hvar: hvar::Hvar,
66        loca: loca::Loca,
67        maxp: maxp::Maxp,
68        meta: meta::Meta,
69        name: name::Name,
70        os2: os2::Os2,
71        post: post::Post,
72        sbix: sbix::Sbix,
73        stat: stat::Stat,
74        vhea: vhea::Vhea,
75        vmtx: vmtx::Vmtx,
76        vvar: vvar::Vvar,
77        ift: ift::Ift,
78    }
79    let tables = AllTables::default();
80    let dumped = bincode::serialize(&tables).unwrap();
81    let _loaded: AllTables = bincode::deserialize(&dumped).unwrap();
82}