Skip to main content

read_fonts/data/generated/
generated_tables.rs

1// THIS FILE IS AUTOGENERATED.
2// Any changes to this file will be overwritten.
3// Use ../../scripts/gen_tables.py to regenerate.
4
5/// Holds some data for each possible table in a font.
6#[derive(Clone, Default, Debug)]
7struct PerTableData<T> {
8    /// Anchor point table.
9    ankr: T,
10    /// Axis variation table.
11    avar: T,
12    /// Baseline table.
13    base: T,
14    /// Compact font format table.
15    cff: T,
16    /// Compact font format 2.0 table.
17    cff2: T,
18    /// Color bitmap data table.
19    cbdt: T,
20    /// Color bitmap location table.
21    cblc: T,
22    /// Color table.
23    colr: T,
24    /// Color palette table.
25    cpal: T,
26    /// Character to glyph mapping table.
27    cmap: T,
28    /// CVT variations table.
29    cvar: T,
30    /// Control value table.
31    cvt: T,
32    /// Digital signature table.
33    dsig: T,
34    /// Embedded bitmap data table.
35    ebdt: T,
36    /// Embedded bitmap location data table.
37    eblc: T,
38    /// Font feature table.
39    feat: T,
40    /// Font program table.
41    fpgm: T,
42    /// Font variations table.
43    fvar: T,
44    /// Grid-fitting and scan-conversion procedure table.
45    gasp: T,
46    /// Glyph definition table.
47    gdef: T,
48    /// TrueType glyph data table.
49    glyf: T,
50    /// Glyph positioning table.
51    gpos: T,
52    /// Glyph substitution table.
53    gsub: T,
54    /// Glyph variation table.
55    gvar: T,
56    /// Horizontal device metrics.
57    hdmx: T,
58    /// Font header table.
59    head: T,
60    /// Horizontal header table.
61    hhea: T,
62    /// Horizontal metrics table.
63    hmtx: T,
64    /// Horizontal metrics variation table.
65    hvar: T,
66    /// Incremental font transfer table.
67    ift: T,
68    /// Incremental font transfer table.
69    iftx: T,
70    /// Justification table.
71    jstf: T,
72    /// Kerning table.
73    kern: T,
74    /// Extended kerning table.
75    kerx: T,
76    /// Index to location table.
77    loca: T,
78    /// Language tag table.
79    ltag: T,
80    /// Mathematical typesetting table.
81    math: T,
82    /// Maximum profile table.
83    maxp: T,
84    /// Metadata table.
85    meta: T,
86    /// Extended metamorphosis table.
87    morx: T,
88    /// Metrics variation table.
89    mvar: T,
90    /// Naming table.
91    name: T,
92    /// OS/2 and Windows-specific metrics table.
93    os2: T,
94    /// PostScript information table.
95    post: T,
96    /// Control value program table.
97    prep: T,
98    /// Standard bitmap graphics table.
99    sbix: T,
100    /// Style attributes table.
101    stat: T,
102    /// Scalable vector graphics table.
103    svg: T,
104    /// Tracking table.
105    trak: T,
106    /// Variable composite/component table.
107    varc: T,
108    /// Vertical header table.
109    vhea: T,
110    /// Vertical metrics table.
111    vmtx: T,
112    /// Vertical origin table.
113    vorg: T,
114    /// Vertical metrics variation table.
115    vvar: T,
116}
117
118impl<T> PerTableData<T> {
119    /// Calls `f` with the tag and associated data for each table.
120    fn init_all(&mut self, f: impl Fn(Tag, &mut T)) {
121        f(Tag::new(b"ankr"), &mut self.ankr);
122        f(Tag::new(b"avar"), &mut self.avar);
123        f(Tag::new(b"BASE"), &mut self.base);
124        f(Tag::new(b"CFF "), &mut self.cff);
125        f(Tag::new(b"CFF2"), &mut self.cff2);
126        f(Tag::new(b"CBDT"), &mut self.cbdt);
127        f(Tag::new(b"CBLC"), &mut self.cblc);
128        f(Tag::new(b"COLR"), &mut self.colr);
129        f(Tag::new(b"CPAL"), &mut self.cpal);
130        f(Tag::new(b"cmap"), &mut self.cmap);
131        f(Tag::new(b"cvar"), &mut self.cvar);
132        f(Tag::new(b"cvt "), &mut self.cvt);
133        f(Tag::new(b"DSIG"), &mut self.dsig);
134        f(Tag::new(b"EBDT"), &mut self.ebdt);
135        f(Tag::new(b"EBLC"), &mut self.eblc);
136        f(Tag::new(b"feat"), &mut self.feat);
137        f(Tag::new(b"fpgm"), &mut self.fpgm);
138        f(Tag::new(b"fvar"), &mut self.fvar);
139        f(Tag::new(b"gasp"), &mut self.gasp);
140        f(Tag::new(b"GDEF"), &mut self.gdef);
141        f(Tag::new(b"glyf"), &mut self.glyf);
142        f(Tag::new(b"GPOS"), &mut self.gpos);
143        f(Tag::new(b"GSUB"), &mut self.gsub);
144        f(Tag::new(b"gvar"), &mut self.gvar);
145        f(Tag::new(b"hdmx"), &mut self.hdmx);
146        f(Tag::new(b"head"), &mut self.head);
147        f(Tag::new(b"hhea"), &mut self.hhea);
148        f(Tag::new(b"hmtx"), &mut self.hmtx);
149        f(Tag::new(b"HVAR"), &mut self.hvar);
150        f(Tag::new(b"IFT "), &mut self.ift);
151        f(Tag::new(b"IFTX"), &mut self.iftx);
152        f(Tag::new(b"JSTF"), &mut self.jstf);
153        f(Tag::new(b"kern"), &mut self.kern);
154        f(Tag::new(b"kerx"), &mut self.kerx);
155        f(Tag::new(b"loca"), &mut self.loca);
156        f(Tag::new(b"ltag"), &mut self.ltag);
157        f(Tag::new(b"MATH"), &mut self.math);
158        f(Tag::new(b"maxp"), &mut self.maxp);
159        f(Tag::new(b"meta"), &mut self.meta);
160        f(Tag::new(b"morx"), &mut self.morx);
161        f(Tag::new(b"MVAR"), &mut self.mvar);
162        f(Tag::new(b"name"), &mut self.name);
163        f(Tag::new(b"OS/2"), &mut self.os2);
164        f(Tag::new(b"post"), &mut self.post);
165        f(Tag::new(b"prep"), &mut self.prep);
166        f(Tag::new(b"sbix"), &mut self.sbix);
167        f(Tag::new(b"STAT"), &mut self.stat);
168        f(Tag::new(b"SVG "), &mut self.svg);
169        f(Tag::new(b"trak"), &mut self.trak);
170        f(Tag::new(b"VARC"), &mut self.varc);
171        f(Tag::new(b"vhea"), &mut self.vhea);
172        f(Tag::new(b"vmtx"), &mut self.vmtx);
173        f(Tag::new(b"VORG"), &mut self.vorg);
174        f(Tag::new(b"VVAR"), &mut self.vvar);
175    }
176}
177
178trait TableDataProvider<'a> where Self: 'a {
179    type Entry;
180
181    fn tables(&self) -> &'a PerTableData<Self::Entry>;
182    fn table_state(&self, tag: Tag, entry: &'a Self::Entry) -> Option<TableState<'a>>;
183
184    fn ankr(&self) -> Option<TableState<'a>> {
185        self.table_state(Tag::new(b"ankr"), &self.tables().ankr)
186    }
187
188    fn avar(&self) -> Option<TableState<'a>> {
189        self.table_state(Tag::new(b"avar"), &self.tables().avar)
190    }
191
192    fn base(&self) -> Option<TableState<'a>> {
193        self.table_state(Tag::new(b"BASE"), &self.tables().base)
194    }
195
196    fn cff(&self) -> Option<TableState<'a>> {
197        self.table_state(Tag::new(b"CFF "), &self.tables().cff)
198    }
199
200    fn cff2(&self) -> Option<TableState<'a>> {
201        self.table_state(Tag::new(b"CFF2"), &self.tables().cff2)
202    }
203
204    fn cbdt(&self) -> Option<TableState<'a>> {
205        self.table_state(Tag::new(b"CBDT"), &self.tables().cbdt)
206    }
207
208    fn cblc(&self) -> Option<TableState<'a>> {
209        self.table_state(Tag::new(b"CBLC"), &self.tables().cblc)
210    }
211
212    fn colr(&self) -> Option<TableState<'a>> {
213        self.table_state(Tag::new(b"COLR"), &self.tables().colr)
214    }
215
216    fn cpal(&self) -> Option<TableState<'a>> {
217        self.table_state(Tag::new(b"CPAL"), &self.tables().cpal)
218    }
219
220    fn cmap(&self) -> Option<TableState<'a>> {
221        self.table_state(Tag::new(b"cmap"), &self.tables().cmap)
222    }
223
224    fn cvar(&self) -> Option<TableState<'a>> {
225        self.table_state(Tag::new(b"cvar"), &self.tables().cvar)
226    }
227
228    fn cvt(&self) -> Option<TableState<'a>> {
229        self.table_state(Tag::new(b"cvt "), &self.tables().cvt)
230    }
231
232    fn dsig(&self) -> Option<TableState<'a>> {
233        self.table_state(Tag::new(b"DSIG"), &self.tables().dsig)
234    }
235
236    fn ebdt(&self) -> Option<TableState<'a>> {
237        self.table_state(Tag::new(b"EBDT"), &self.tables().ebdt)
238    }
239
240    fn eblc(&self) -> Option<TableState<'a>> {
241        self.table_state(Tag::new(b"EBLC"), &self.tables().eblc)
242    }
243
244    fn feat(&self) -> Option<TableState<'a>> {
245        self.table_state(Tag::new(b"feat"), &self.tables().feat)
246    }
247
248    fn fpgm(&self) -> Option<TableState<'a>> {
249        self.table_state(Tag::new(b"fpgm"), &self.tables().fpgm)
250    }
251
252    fn fvar(&self) -> Option<TableState<'a>> {
253        self.table_state(Tag::new(b"fvar"), &self.tables().fvar)
254    }
255
256    fn gasp(&self) -> Option<TableState<'a>> {
257        self.table_state(Tag::new(b"gasp"), &self.tables().gasp)
258    }
259
260    fn gdef(&self) -> Option<TableState<'a>> {
261        self.table_state(Tag::new(b"GDEF"), &self.tables().gdef)
262    }
263
264    fn glyf(&self) -> Option<TableState<'a>> {
265        self.table_state(Tag::new(b"glyf"), &self.tables().glyf)
266    }
267
268    fn gpos(&self) -> Option<TableState<'a>> {
269        self.table_state(Tag::new(b"GPOS"), &self.tables().gpos)
270    }
271
272    fn gsub(&self) -> Option<TableState<'a>> {
273        self.table_state(Tag::new(b"GSUB"), &self.tables().gsub)
274    }
275
276    fn gvar(&self) -> Option<TableState<'a>> {
277        self.table_state(Tag::new(b"gvar"), &self.tables().gvar)
278    }
279
280    fn hdmx(&self) -> Option<TableState<'a>> {
281        self.table_state(Tag::new(b"hdmx"), &self.tables().hdmx)
282    }
283
284    fn head(&self) -> Option<TableState<'a>> {
285        self.table_state(Tag::new(b"head"), &self.tables().head)
286    }
287
288    fn hhea(&self) -> Option<TableState<'a>> {
289        self.table_state(Tag::new(b"hhea"), &self.tables().hhea)
290    }
291
292    fn hmtx(&self) -> Option<TableState<'a>> {
293        self.table_state(Tag::new(b"hmtx"), &self.tables().hmtx)
294    }
295
296    fn hvar(&self) -> Option<TableState<'a>> {
297        self.table_state(Tag::new(b"HVAR"), &self.tables().hvar)
298    }
299
300    fn ift(&self) -> Option<TableState<'a>> {
301        self.table_state(Tag::new(b"IFT "), &self.tables().ift)
302    }
303
304    fn iftx(&self) -> Option<TableState<'a>> {
305        self.table_state(Tag::new(b"IFTX"), &self.tables().iftx)
306    }
307
308    fn jstf(&self) -> Option<TableState<'a>> {
309        self.table_state(Tag::new(b"JSTF"), &self.tables().jstf)
310    }
311
312    fn kern(&self) -> Option<TableState<'a>> {
313        self.table_state(Tag::new(b"kern"), &self.tables().kern)
314    }
315
316    fn kerx(&self) -> Option<TableState<'a>> {
317        self.table_state(Tag::new(b"kerx"), &self.tables().kerx)
318    }
319
320    fn loca(&self) -> Option<TableState<'a>> {
321        self.table_state(Tag::new(b"loca"), &self.tables().loca)
322    }
323
324    fn ltag(&self) -> Option<TableState<'a>> {
325        self.table_state(Tag::new(b"ltag"), &self.tables().ltag)
326    }
327
328    fn math(&self) -> Option<TableState<'a>> {
329        self.table_state(Tag::new(b"MATH"), &self.tables().math)
330    }
331
332    fn maxp(&self) -> Option<TableState<'a>> {
333        self.table_state(Tag::new(b"maxp"), &self.tables().maxp)
334    }
335
336    fn meta(&self) -> Option<TableState<'a>> {
337        self.table_state(Tag::new(b"meta"), &self.tables().meta)
338    }
339
340    fn morx(&self) -> Option<TableState<'a>> {
341        self.table_state(Tag::new(b"morx"), &self.tables().morx)
342    }
343
344    fn mvar(&self) -> Option<TableState<'a>> {
345        self.table_state(Tag::new(b"MVAR"), &self.tables().mvar)
346    }
347
348    fn name(&self) -> Option<TableState<'a>> {
349        self.table_state(Tag::new(b"name"), &self.tables().name)
350    }
351
352    fn os2(&self) -> Option<TableState<'a>> {
353        self.table_state(Tag::new(b"OS/2"), &self.tables().os2)
354    }
355
356    fn post(&self) -> Option<TableState<'a>> {
357        self.table_state(Tag::new(b"post"), &self.tables().post)
358    }
359
360    fn prep(&self) -> Option<TableState<'a>> {
361        self.table_state(Tag::new(b"prep"), &self.tables().prep)
362    }
363
364    fn sbix(&self) -> Option<TableState<'a>> {
365        self.table_state(Tag::new(b"sbix"), &self.tables().sbix)
366    }
367
368    fn stat(&self) -> Option<TableState<'a>> {
369        self.table_state(Tag::new(b"STAT"), &self.tables().stat)
370    }
371
372    fn svg(&self) -> Option<TableState<'a>> {
373        self.table_state(Tag::new(b"SVG "), &self.tables().svg)
374    }
375
376    fn trak(&self) -> Option<TableState<'a>> {
377        self.table_state(Tag::new(b"trak"), &self.tables().trak)
378    }
379
380    fn varc(&self) -> Option<TableState<'a>> {
381        self.table_state(Tag::new(b"VARC"), &self.tables().varc)
382    }
383
384    fn vhea(&self) -> Option<TableState<'a>> {
385        self.table_state(Tag::new(b"vhea"), &self.tables().vhea)
386    }
387
388    fn vmtx(&self) -> Option<TableState<'a>> {
389        self.table_state(Tag::new(b"vmtx"), &self.tables().vmtx)
390    }
391
392    fn vorg(&self) -> Option<TableState<'a>> {
393        self.table_state(Tag::new(b"VORG"), &self.tables().vorg)
394    }
395
396    fn vvar(&self) -> Option<TableState<'a>> {
397        self.table_state(Tag::new(b"VVAR"), &self.tables().vvar)
398    }
399
400}
401
402impl FontTables {
403    /// Anchor point table data.
404    ///
405    /// See the [ankr](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ankr.html) specification.
406    pub fn ankr_data(&self) -> Option<&'_ [u8]> {
407        self.ankr_state().map(|state| state.data)
408    }
409
410    fn ankr_state(&self) -> Option<TableState<'_>> {
411        match &self.0 {
412            TableSource::None => None,
413            TableSource::Blob(blob) => blob.ankr(),
414            TableSource::Function(func) => func.ankr(),
415        }
416    }
417
418    /// Axis variation table data.
419    ///
420    /// See the [avar](https://learn.microsoft.com/en-us/typography/opentype/spec/avar) specification.
421    pub fn avar_data(&self) -> Option<&'_ [u8]> {
422        self.avar_state().map(|state| state.data)
423    }
424
425    fn avar_state(&self) -> Option<TableState<'_>> {
426        match &self.0 {
427            TableSource::None => None,
428            TableSource::Blob(blob) => blob.avar(),
429            TableSource::Function(func) => func.avar(),
430        }
431    }
432
433    /// Baseline table data.
434    ///
435    /// See the [BASE](https://learn.microsoft.com/en-us/typography/opentype/spec/base) specification.
436    pub fn base_data(&self) -> Option<&'_ [u8]> {
437        self.base_state().map(|state| state.data)
438    }
439
440    fn base_state(&self) -> Option<TableState<'_>> {
441        match &self.0 {
442            TableSource::None => None,
443            TableSource::Blob(blob) => blob.base(),
444            TableSource::Function(func) => func.base(),
445        }
446    }
447
448    /// Compact font format table data.
449    ///
450    /// See the [CFF](https://learn.microsoft.com/en-us/typography/opentype/spec/cff) specification.
451    pub fn cff_data(&self) -> Option<&'_ [u8]> {
452        self.cff_state().map(|state| state.data)
453    }
454
455    fn cff_state(&self) -> Option<TableState<'_>> {
456        match &self.0 {
457            TableSource::None => None,
458            TableSource::Blob(blob) => blob.cff(),
459            TableSource::Function(func) => func.cff(),
460        }
461    }
462
463    /// Compact font format 2.0 table data.
464    ///
465    /// See the [CFF2](https://learn.microsoft.com/en-us/typography/opentype/spec/cff2) specification.
466    pub fn cff2_data(&self) -> Option<&'_ [u8]> {
467        self.cff2_state().map(|state| state.data)
468    }
469
470    fn cff2_state(&self) -> Option<TableState<'_>> {
471        match &self.0 {
472            TableSource::None => None,
473            TableSource::Blob(blob) => blob.cff2(),
474            TableSource::Function(func) => func.cff2(),
475        }
476    }
477
478    /// Color bitmap data table data.
479    ///
480    /// See the [CBDT](https://learn.microsoft.com/en-us/typography/opentype/spec/cbdt) specification.
481    pub fn cbdt_data(&self) -> Option<&'_ [u8]> {
482        self.cbdt_state().map(|state| state.data)
483    }
484
485    fn cbdt_state(&self) -> Option<TableState<'_>> {
486        match &self.0 {
487            TableSource::None => None,
488            TableSource::Blob(blob) => blob.cbdt(),
489            TableSource::Function(func) => func.cbdt(),
490        }
491    }
492
493    /// Color bitmap location table data.
494    ///
495    /// See the [CBLC](https://learn.microsoft.com/en-us/typography/opentype/spec/cblc) specification.
496    pub fn cblc_data(&self) -> Option<&'_ [u8]> {
497        self.cblc_state().map(|state| state.data)
498    }
499
500    fn cblc_state(&self) -> Option<TableState<'_>> {
501        match &self.0 {
502            TableSource::None => None,
503            TableSource::Blob(blob) => blob.cblc(),
504            TableSource::Function(func) => func.cblc(),
505        }
506    }
507
508    /// Color table data.
509    ///
510    /// See the [COLR](https://learn.microsoft.com/en-us/typography/opentype/spec/colr) specification.
511    pub fn colr_data(&self) -> Option<&'_ [u8]> {
512        self.colr_state().map(|state| state.data)
513    }
514
515    fn colr_state(&self) -> Option<TableState<'_>> {
516        match &self.0 {
517            TableSource::None => None,
518            TableSource::Blob(blob) => blob.colr(),
519            TableSource::Function(func) => func.colr(),
520        }
521    }
522
523    /// Color palette table data.
524    ///
525    /// See the [CPAL](https://learn.microsoft.com/en-us/typography/opentype/spec/cpal) specification.
526    pub fn cpal_data(&self) -> Option<&'_ [u8]> {
527        self.cpal_state().map(|state| state.data)
528    }
529
530    fn cpal_state(&self) -> Option<TableState<'_>> {
531        match &self.0 {
532            TableSource::None => None,
533            TableSource::Blob(blob) => blob.cpal(),
534            TableSource::Function(func) => func.cpal(),
535        }
536    }
537
538    /// Character to glyph mapping table data.
539    ///
540    /// See the [cmap](https://learn.microsoft.com/en-us/typography/opentype/spec/cmap) specification.
541    pub fn cmap_data(&self) -> Option<&'_ [u8]> {
542        self.cmap_state().map(|state| state.data)
543    }
544
545    fn cmap_state(&self) -> Option<TableState<'_>> {
546        match &self.0 {
547            TableSource::None => None,
548            TableSource::Blob(blob) => blob.cmap(),
549            TableSource::Function(func) => func.cmap(),
550        }
551    }
552
553    /// CVT variations table data.
554    ///
555    /// See the [cvar](https://learn.microsoft.com/en-us/typography/opentype/spec/cvar) specification.
556    pub fn cvar_data(&self) -> Option<&'_ [u8]> {
557        self.cvar_state().map(|state| state.data)
558    }
559
560    fn cvar_state(&self) -> Option<TableState<'_>> {
561        match &self.0 {
562            TableSource::None => None,
563            TableSource::Blob(blob) => blob.cvar(),
564            TableSource::Function(func) => func.cvar(),
565        }
566    }
567
568    /// Control value table data.
569    ///
570    /// See the [cvt](https://learn.microsoft.com/en-us/typography/opentype/spec/cvt) specification.
571    pub fn cvt_data(&self) -> Option<&'_ [u8]> {
572        self.cvt_state().map(|state| state.data)
573    }
574
575    fn cvt_state(&self) -> Option<TableState<'_>> {
576        match &self.0 {
577            TableSource::None => None,
578            TableSource::Blob(blob) => blob.cvt(),
579            TableSource::Function(func) => func.cvt(),
580        }
581    }
582
583    /// Digital signature table data.
584    ///
585    /// See the [DSIG](https://learn.microsoft.com/en-us/typography/opentype/spec/dsig) specification.
586    pub fn dsig_data(&self) -> Option<&'_ [u8]> {
587        self.dsig_state().map(|state| state.data)
588    }
589
590    fn dsig_state(&self) -> Option<TableState<'_>> {
591        match &self.0 {
592            TableSource::None => None,
593            TableSource::Blob(blob) => blob.dsig(),
594            TableSource::Function(func) => func.dsig(),
595        }
596    }
597
598    /// Embedded bitmap data table data.
599    ///
600    /// See the [EBDT](https://learn.microsoft.com/en-us/typography/opentype/spec/ebdt) specification.
601    pub fn ebdt_data(&self) -> Option<&'_ [u8]> {
602        self.ebdt_state().map(|state| state.data)
603    }
604
605    fn ebdt_state(&self) -> Option<TableState<'_>> {
606        match &self.0 {
607            TableSource::None => None,
608            TableSource::Blob(blob) => blob.ebdt(),
609            TableSource::Function(func) => func.ebdt(),
610        }
611    }
612
613    /// Embedded bitmap location data table data.
614    ///
615    /// See the [EBLC](https://learn.microsoft.com/en-us/typography/opentype/spec/eblc) specification.
616    pub fn eblc_data(&self) -> Option<&'_ [u8]> {
617        self.eblc_state().map(|state| state.data)
618    }
619
620    fn eblc_state(&self) -> Option<TableState<'_>> {
621        match &self.0 {
622            TableSource::None => None,
623            TableSource::Blob(blob) => blob.eblc(),
624            TableSource::Function(func) => func.eblc(),
625        }
626    }
627
628    /// Font feature table data.
629    ///
630    /// See the [feat](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6feat.html) specification.
631    pub fn feat_data(&self) -> Option<&'_ [u8]> {
632        self.feat_state().map(|state| state.data)
633    }
634
635    fn feat_state(&self) -> Option<TableState<'_>> {
636        match &self.0 {
637            TableSource::None => None,
638            TableSource::Blob(blob) => blob.feat(),
639            TableSource::Function(func) => func.feat(),
640        }
641    }
642
643    /// Font program table data.
644    ///
645    /// See the [fpgm](https://learn.microsoft.com/en-us/typography/opentype/spec/fpgm) specification.
646    pub fn fpgm_data(&self) -> Option<&'_ [u8]> {
647        self.fpgm_state().map(|state| state.data)
648    }
649
650    fn fpgm_state(&self) -> Option<TableState<'_>> {
651        match &self.0 {
652            TableSource::None => None,
653            TableSource::Blob(blob) => blob.fpgm(),
654            TableSource::Function(func) => func.fpgm(),
655        }
656    }
657
658    /// Font variations table data.
659    ///
660    /// See the [fvar](https://learn.microsoft.com/en-us/typography/opentype/spec/fvar) specification.
661    pub fn fvar_data(&self) -> Option<&'_ [u8]> {
662        self.fvar_state().map(|state| state.data)
663    }
664
665    fn fvar_state(&self) -> Option<TableState<'_>> {
666        match &self.0 {
667            TableSource::None => None,
668            TableSource::Blob(blob) => blob.fvar(),
669            TableSource::Function(func) => func.fvar(),
670        }
671    }
672
673    /// Grid-fitting and scan-conversion procedure table data.
674    ///
675    /// See the [gasp](https://learn.microsoft.com/en-us/typography/opentype/spec/gasp) specification.
676    pub fn gasp_data(&self) -> Option<&'_ [u8]> {
677        self.gasp_state().map(|state| state.data)
678    }
679
680    fn gasp_state(&self) -> Option<TableState<'_>> {
681        match &self.0 {
682            TableSource::None => None,
683            TableSource::Blob(blob) => blob.gasp(),
684            TableSource::Function(func) => func.gasp(),
685        }
686    }
687
688    /// Glyph definition table data.
689    ///
690    /// See the [GDEF](https://learn.microsoft.com/en-us/typography/opentype/spec/gdef) specification.
691    pub fn gdef_data(&self) -> Option<&'_ [u8]> {
692        self.gdef_state().map(|state| state.data)
693    }
694
695    fn gdef_state(&self) -> Option<TableState<'_>> {
696        match &self.0 {
697            TableSource::None => None,
698            TableSource::Blob(blob) => blob.gdef(),
699            TableSource::Function(func) => func.gdef(),
700        }
701    }
702
703    /// TrueType glyph data table data.
704    ///
705    /// See the [glyf](https://learn.microsoft.com/en-us/typography/opentype/spec/glyf) specification.
706    pub fn glyf_data(&self) -> Option<&'_ [u8]> {
707        self.glyf_state().map(|state| state.data)
708    }
709
710    fn glyf_state(&self) -> Option<TableState<'_>> {
711        match &self.0 {
712            TableSource::None => None,
713            TableSource::Blob(blob) => blob.glyf(),
714            TableSource::Function(func) => func.glyf(),
715        }
716    }
717
718    /// Glyph positioning table data.
719    ///
720    /// See the [GPOS](https://learn.microsoft.com/en-us/typography/opentype/spec/gpos) specification.
721    pub fn gpos_data(&self) -> Option<&'_ [u8]> {
722        self.gpos_state().map(|state| state.data)
723    }
724
725    fn gpos_state(&self) -> Option<TableState<'_>> {
726        match &self.0 {
727            TableSource::None => None,
728            TableSource::Blob(blob) => blob.gpos(),
729            TableSource::Function(func) => func.gpos(),
730        }
731    }
732
733    /// Glyph substitution table data.
734    ///
735    /// See the [GSUB](https://learn.microsoft.com/en-us/typography/opentype/spec/gsub) specification.
736    pub fn gsub_data(&self) -> Option<&'_ [u8]> {
737        self.gsub_state().map(|state| state.data)
738    }
739
740    fn gsub_state(&self) -> Option<TableState<'_>> {
741        match &self.0 {
742            TableSource::None => None,
743            TableSource::Blob(blob) => blob.gsub(),
744            TableSource::Function(func) => func.gsub(),
745        }
746    }
747
748    /// Glyph variation table data.
749    ///
750    /// See the [gvar](https://learn.microsoft.com/en-us/typography/opentype/spec/gvar) specification.
751    pub fn gvar_data(&self) -> Option<&'_ [u8]> {
752        self.gvar_state().map(|state| state.data)
753    }
754
755    fn gvar_state(&self) -> Option<TableState<'_>> {
756        match &self.0 {
757            TableSource::None => None,
758            TableSource::Blob(blob) => blob.gvar(),
759            TableSource::Function(func) => func.gvar(),
760        }
761    }
762
763    /// Horizontal device metrics data.
764    ///
765    /// See the [hdmx](https://learn.microsoft.com/en-us/typography/opentype/spec/hdmx) specification.
766    pub fn hdmx_data(&self) -> Option<&'_ [u8]> {
767        self.hdmx_state().map(|state| state.data)
768    }
769
770    fn hdmx_state(&self) -> Option<TableState<'_>> {
771        match &self.0 {
772            TableSource::None => None,
773            TableSource::Blob(blob) => blob.hdmx(),
774            TableSource::Function(func) => func.hdmx(),
775        }
776    }
777
778    /// Font header table data.
779    ///
780    /// See the [head](https://learn.microsoft.com/en-us/typography/opentype/spec/head) specification.
781    pub fn head_data(&self) -> Option<&'_ [u8]> {
782        self.head_state().map(|state| state.data)
783    }
784
785    fn head_state(&self) -> Option<TableState<'_>> {
786        match &self.0 {
787            TableSource::None => None,
788            TableSource::Blob(blob) => blob.head(),
789            TableSource::Function(func) => func.head(),
790        }
791    }
792
793    /// Horizontal header table data.
794    ///
795    /// See the [hhea](https://learn.microsoft.com/en-us/typography/opentype/spec/hhea) specification.
796    pub fn hhea_data(&self) -> Option<&'_ [u8]> {
797        self.hhea_state().map(|state| state.data)
798    }
799
800    fn hhea_state(&self) -> Option<TableState<'_>> {
801        match &self.0 {
802            TableSource::None => None,
803            TableSource::Blob(blob) => blob.hhea(),
804            TableSource::Function(func) => func.hhea(),
805        }
806    }
807
808    /// Horizontal metrics table data.
809    ///
810    /// See the [hmtx](https://learn.microsoft.com/en-us/typography/opentype/spec/hmtx) specification.
811    pub fn hmtx_data(&self) -> Option<&'_ [u8]> {
812        self.hmtx_state().map(|state| state.data)
813    }
814
815    fn hmtx_state(&self) -> Option<TableState<'_>> {
816        match &self.0 {
817            TableSource::None => None,
818            TableSource::Blob(blob) => blob.hmtx(),
819            TableSource::Function(func) => func.hmtx(),
820        }
821    }
822
823    /// Horizontal metrics variation table data.
824    ///
825    /// See the [HVAR](https://learn.microsoft.com/en-us/typography/opentype/spec/hvar) specification.
826    pub fn hvar_data(&self) -> Option<&'_ [u8]> {
827        self.hvar_state().map(|state| state.data)
828    }
829
830    fn hvar_state(&self) -> Option<TableState<'_>> {
831        match &self.0 {
832            TableSource::None => None,
833            TableSource::Blob(blob) => blob.hvar(),
834            TableSource::Function(func) => func.hvar(),
835        }
836    }
837
838    /// Incremental font transfer table data.
839    ///
840    /// See the [IFT](https://www.w3.org/TR/IFT/#font-format-extensions) specification.
841    pub fn ift_data(&self) -> Option<&'_ [u8]> {
842        self.ift_state().map(|state| state.data)
843    }
844
845    fn ift_state(&self) -> Option<TableState<'_>> {
846        match &self.0 {
847            TableSource::None => None,
848            TableSource::Blob(blob) => blob.ift(),
849            TableSource::Function(func) => func.ift(),
850        }
851    }
852
853    /// Incremental font transfer table data.
854    ///
855    /// See the [IFTX](https://www.w3.org/TR/IFT/#font-format-extensions) specification.
856    pub fn iftx_data(&self) -> Option<&'_ [u8]> {
857        self.iftx_state().map(|state| state.data)
858    }
859
860    fn iftx_state(&self) -> Option<TableState<'_>> {
861        match &self.0 {
862            TableSource::None => None,
863            TableSource::Blob(blob) => blob.iftx(),
864            TableSource::Function(func) => func.iftx(),
865        }
866    }
867
868    /// Justification table data.
869    ///
870    /// See the [JSTF](https://learn.microsoft.com/en-us/typography/opentype/spec/jstf) specification.
871    pub fn jstf_data(&self) -> Option<&'_ [u8]> {
872        self.jstf_state().map(|state| state.data)
873    }
874
875    fn jstf_state(&self) -> Option<TableState<'_>> {
876        match &self.0 {
877            TableSource::None => None,
878            TableSource::Blob(blob) => blob.jstf(),
879            TableSource::Function(func) => func.jstf(),
880        }
881    }
882
883    /// Kerning table data.
884    ///
885    /// See the [kern](https://learn.microsoft.com/en-us/typography/opentype/spec/kern) specification.
886    pub fn kern_data(&self) -> Option<&'_ [u8]> {
887        self.kern_state().map(|state| state.data)
888    }
889
890    fn kern_state(&self) -> Option<TableState<'_>> {
891        match &self.0 {
892            TableSource::None => None,
893            TableSource::Blob(blob) => blob.kern(),
894            TableSource::Function(func) => func.kern(),
895        }
896    }
897
898    /// Extended kerning table data.
899    ///
900    /// See the [kerx](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6kerx.html) specification.
901    pub fn kerx_data(&self) -> Option<&'_ [u8]> {
902        self.kerx_state().map(|state| state.data)
903    }
904
905    fn kerx_state(&self) -> Option<TableState<'_>> {
906        match &self.0 {
907            TableSource::None => None,
908            TableSource::Blob(blob) => blob.kerx(),
909            TableSource::Function(func) => func.kerx(),
910        }
911    }
912
913    /// Index to location table data.
914    ///
915    /// See the [loca](https://learn.microsoft.com/en-us/typography/opentype/spec/loca) specification.
916    pub fn loca_data(&self) -> Option<&'_ [u8]> {
917        self.loca_state().map(|state| state.data)
918    }
919
920    fn loca_state(&self) -> Option<TableState<'_>> {
921        match &self.0 {
922            TableSource::None => None,
923            TableSource::Blob(blob) => blob.loca(),
924            TableSource::Function(func) => func.loca(),
925        }
926    }
927
928    /// Language tag table data.
929    ///
930    /// See the [ltag](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ltag.html) specification.
931    pub fn ltag_data(&self) -> Option<&'_ [u8]> {
932        self.ltag_state().map(|state| state.data)
933    }
934
935    fn ltag_state(&self) -> Option<TableState<'_>> {
936        match &self.0 {
937            TableSource::None => None,
938            TableSource::Blob(blob) => blob.ltag(),
939            TableSource::Function(func) => func.ltag(),
940        }
941    }
942
943    /// Mathematical typesetting table data.
944    ///
945    /// See the [MATH](https://learn.microsoft.com/en-us/typography/opentype/spec/math) specification.
946    pub fn math_data(&self) -> Option<&'_ [u8]> {
947        self.math_state().map(|state| state.data)
948    }
949
950    fn math_state(&self) -> Option<TableState<'_>> {
951        match &self.0 {
952            TableSource::None => None,
953            TableSource::Blob(blob) => blob.math(),
954            TableSource::Function(func) => func.math(),
955        }
956    }
957
958    /// Maximum profile table data.
959    ///
960    /// See the [maxp](https://learn.microsoft.com/en-us/typography/opentype/spec/maxp) specification.
961    pub fn maxp_data(&self) -> Option<&'_ [u8]> {
962        self.maxp_state().map(|state| state.data)
963    }
964
965    fn maxp_state(&self) -> Option<TableState<'_>> {
966        match &self.0 {
967            TableSource::None => None,
968            TableSource::Blob(blob) => blob.maxp(),
969            TableSource::Function(func) => func.maxp(),
970        }
971    }
972
973    /// Metadata table data.
974    ///
975    /// See the [meta](https://learn.microsoft.com/en-us/typography/opentype/spec/meta) specification.
976    pub fn meta_data(&self) -> Option<&'_ [u8]> {
977        self.meta_state().map(|state| state.data)
978    }
979
980    fn meta_state(&self) -> Option<TableState<'_>> {
981        match &self.0 {
982            TableSource::None => None,
983            TableSource::Blob(blob) => blob.meta(),
984            TableSource::Function(func) => func.meta(),
985        }
986    }
987
988    /// Extended metamorphosis table data.
989    ///
990    /// See the [morx](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6morx.html) specification.
991    pub fn morx_data(&self) -> Option<&'_ [u8]> {
992        self.morx_state().map(|state| state.data)
993    }
994
995    fn morx_state(&self) -> Option<TableState<'_>> {
996        match &self.0 {
997            TableSource::None => None,
998            TableSource::Blob(blob) => blob.morx(),
999            TableSource::Function(func) => func.morx(),
1000        }
1001    }
1002
1003    /// Metrics variation table data.
1004    ///
1005    /// See the [MVAR](https://learn.microsoft.com/en-us/typography/opentype/spec/mvar) specification.
1006    pub fn mvar_data(&self) -> Option<&'_ [u8]> {
1007        self.mvar_state().map(|state| state.data)
1008    }
1009
1010    fn mvar_state(&self) -> Option<TableState<'_>> {
1011        match &self.0 {
1012            TableSource::None => None,
1013            TableSource::Blob(blob) => blob.mvar(),
1014            TableSource::Function(func) => func.mvar(),
1015        }
1016    }
1017
1018    /// Naming table data.
1019    ///
1020    /// See the [name](https://learn.microsoft.com/en-us/typography/opentype/spec/name) specification.
1021    pub fn name_data(&self) -> Option<&'_ [u8]> {
1022        self.name_state().map(|state| state.data)
1023    }
1024
1025    fn name_state(&self) -> Option<TableState<'_>> {
1026        match &self.0 {
1027            TableSource::None => None,
1028            TableSource::Blob(blob) => blob.name(),
1029            TableSource::Function(func) => func.name(),
1030        }
1031    }
1032
1033    /// OS/2 and Windows-specific metrics table data.
1034    ///
1035    /// See the [OS/2](https://learn.microsoft.com/en-us/typography/opentype/spec/os2) specification.
1036    pub fn os2_data(&self) -> Option<&'_ [u8]> {
1037        self.os2_state().map(|state| state.data)
1038    }
1039
1040    fn os2_state(&self) -> Option<TableState<'_>> {
1041        match &self.0 {
1042            TableSource::None => None,
1043            TableSource::Blob(blob) => blob.os2(),
1044            TableSource::Function(func) => func.os2(),
1045        }
1046    }
1047
1048    /// PostScript information table data.
1049    ///
1050    /// See the [post](https://learn.microsoft.com/en-us/typography/opentype/spec/post) specification.
1051    pub fn post_data(&self) -> Option<&'_ [u8]> {
1052        self.post_state().map(|state| state.data)
1053    }
1054
1055    fn post_state(&self) -> Option<TableState<'_>> {
1056        match &self.0 {
1057            TableSource::None => None,
1058            TableSource::Blob(blob) => blob.post(),
1059            TableSource::Function(func) => func.post(),
1060        }
1061    }
1062
1063    /// Control value program table data.
1064    ///
1065    /// See the [prep](https://learn.microsoft.com/en-us/typography/opentype/spec/prep) specification.
1066    pub fn prep_data(&self) -> Option<&'_ [u8]> {
1067        self.prep_state().map(|state| state.data)
1068    }
1069
1070    fn prep_state(&self) -> Option<TableState<'_>> {
1071        match &self.0 {
1072            TableSource::None => None,
1073            TableSource::Blob(blob) => blob.prep(),
1074            TableSource::Function(func) => func.prep(),
1075        }
1076    }
1077
1078    /// Standard bitmap graphics table data.
1079    ///
1080    /// See the [sbix](https://learn.microsoft.com/en-us/typography/opentype/spec/sbix) specification.
1081    pub fn sbix_data(&self) -> Option<&'_ [u8]> {
1082        self.sbix_state().map(|state| state.data)
1083    }
1084
1085    fn sbix_state(&self) -> Option<TableState<'_>> {
1086        match &self.0 {
1087            TableSource::None => None,
1088            TableSource::Blob(blob) => blob.sbix(),
1089            TableSource::Function(func) => func.sbix(),
1090        }
1091    }
1092
1093    /// Style attributes table data.
1094    ///
1095    /// See the [STAT](https://learn.microsoft.com/en-us/typography/opentype/spec/stat) specification.
1096    pub fn stat_data(&self) -> Option<&'_ [u8]> {
1097        self.stat_state().map(|state| state.data)
1098    }
1099
1100    fn stat_state(&self) -> Option<TableState<'_>> {
1101        match &self.0 {
1102            TableSource::None => None,
1103            TableSource::Blob(blob) => blob.stat(),
1104            TableSource::Function(func) => func.stat(),
1105        }
1106    }
1107
1108    /// Scalable vector graphics table data.
1109    ///
1110    /// See the [SVG](https://learn.microsoft.com/en-us/typography/opentype/spec/svg) specification.
1111    pub fn svg_data(&self) -> Option<&'_ [u8]> {
1112        self.svg_state().map(|state| state.data)
1113    }
1114
1115    fn svg_state(&self) -> Option<TableState<'_>> {
1116        match &self.0 {
1117            TableSource::None => None,
1118            TableSource::Blob(blob) => blob.svg(),
1119            TableSource::Function(func) => func.svg(),
1120        }
1121    }
1122
1123    /// Tracking table data.
1124    ///
1125    /// See the [trak](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6trak.html) specification.
1126    pub fn trak_data(&self) -> Option<&'_ [u8]> {
1127        self.trak_state().map(|state| state.data)
1128    }
1129
1130    fn trak_state(&self) -> Option<TableState<'_>> {
1131        match &self.0 {
1132            TableSource::None => None,
1133            TableSource::Blob(blob) => blob.trak(),
1134            TableSource::Function(func) => func.trak(),
1135        }
1136    }
1137
1138    /// Variable composite/component table data.
1139    ///
1140    /// See the [VARC](https://github.com/harfbuzz/boring-expansion-spec/blob/main/VARC.md) specification.
1141    pub fn varc_data(&self) -> Option<&'_ [u8]> {
1142        self.varc_state().map(|state| state.data)
1143    }
1144
1145    fn varc_state(&self) -> Option<TableState<'_>> {
1146        match &self.0 {
1147            TableSource::None => None,
1148            TableSource::Blob(blob) => blob.varc(),
1149            TableSource::Function(func) => func.varc(),
1150        }
1151    }
1152
1153    /// Vertical header table data.
1154    ///
1155    /// See the [vhea](https://learn.microsoft.com/en-us/typography/opentype/spec/vhea) specification.
1156    pub fn vhea_data(&self) -> Option<&'_ [u8]> {
1157        self.vhea_state().map(|state| state.data)
1158    }
1159
1160    fn vhea_state(&self) -> Option<TableState<'_>> {
1161        match &self.0 {
1162            TableSource::None => None,
1163            TableSource::Blob(blob) => blob.vhea(),
1164            TableSource::Function(func) => func.vhea(),
1165        }
1166    }
1167
1168    /// Vertical metrics table data.
1169    ///
1170    /// See the [vmtx](https://learn.microsoft.com/en-us/typography/opentype/spec/vmtx) specification.
1171    pub fn vmtx_data(&self) -> Option<&'_ [u8]> {
1172        self.vmtx_state().map(|state| state.data)
1173    }
1174
1175    fn vmtx_state(&self) -> Option<TableState<'_>> {
1176        match &self.0 {
1177            TableSource::None => None,
1178            TableSource::Blob(blob) => blob.vmtx(),
1179            TableSource::Function(func) => func.vmtx(),
1180        }
1181    }
1182
1183    /// Vertical origin table data.
1184    ///
1185    /// See the [VORG](https://learn.microsoft.com/en-us/typography/opentype/spec/vorg) specification.
1186    pub fn vorg_data(&self) -> Option<&'_ [u8]> {
1187        self.vorg_state().map(|state| state.data)
1188    }
1189
1190    fn vorg_state(&self) -> Option<TableState<'_>> {
1191        match &self.0 {
1192            TableSource::None => None,
1193            TableSource::Blob(blob) => blob.vorg(),
1194            TableSource::Function(func) => func.vorg(),
1195        }
1196    }
1197
1198    /// Vertical metrics variation table data.
1199    ///
1200    /// See the [VVAR](https://learn.microsoft.com/en-us/typography/opentype/spec/vvar) specification.
1201    pub fn vvar_data(&self) -> Option<&'_ [u8]> {
1202        self.vvar_state().map(|state| state.data)
1203    }
1204
1205    fn vvar_state(&self) -> Option<TableState<'_>> {
1206        match &self.0 {
1207            TableSource::None => None,
1208            TableSource::Blob(blob) => blob.vvar(),
1209            TableSource::Function(func) => func.vvar(),
1210        }
1211    }
1212
1213}