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 dsig;
12pub mod fvar;
13pub mod gasp;
14pub mod gdef;
15pub mod glyf;
16pub mod gpos;
17pub mod gsub;
18pub mod gvar;
19pub mod head;
20pub mod hhea;
21pub mod hmtx;
22pub mod hvar;
23pub mod layout;
24pub mod loca;
25pub mod maxp;
26pub mod meta;
27pub mod mvar;
28pub mod name;
29pub mod os2;
30pub mod post;
31pub mod postscript;
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        dsig: dsig::Dsig,
54        fvar: fvar::Fvar,
55        gasp: gasp::Gasp,
56        gdef: gdef::Gdef,
57        glyf: glyf::Glyf,
58        gpos: gpos::Gpos,
59        gsub: gsub::Gsub,
60        gvar: gvar::Gvar,
61        head: head::Head,
62        hhea: hhea::Hhea,
63        hmtx: hmtx::Hmtx,
64        hvar: hvar::Hvar,
65        loca: loca::Loca,
66        maxp: maxp::Maxp,
67        meta: meta::Meta,
68        name: name::Name,
69        os2: os2::Os2,
70        post: post::Post,
71        sbix: sbix::Sbix,
72        stat: stat::Stat,
73        vhea: vhea::Vhea,
74        vmtx: vmtx::Vmtx,
75        vvar: vvar::Vvar,
76        ift: ift::Ift,
77    }
78    let tables = AllTables::default();
79    let dumped = bincode::serialize(&tables).unwrap();
80    let _loaded: AllTables = bincode::deserialize(&dumped).unwrap();
81}