summaryrefslogtreecommitdiff
path: root/systems/doc/luatex/luatex-fontloader.tex
blob: e99ea1d2ff237a43c75716e125ca701431cffd2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
% language=uk

\environment luatex-style

\startcomponent luatex-fontloader

\startchapter[reference=fontloader,title={The fontloader}]

\topicindex {fonts+loading}

The fontloader library is sort of independent of the rest in the sense that it
can load font into a \LUA\ table that then can be converted into a table suitable
for \TEX. The library is an adapted subset of \FONTFORGE\ and as such gives a
similar view on a font (which has advantages when you want to debug). We will not
discuss \OPENTYPE\ in detail here as the \MICROSOFT\ website offers enough
information about it. The tables returned by the loader are not that far from the
standard. We have no plans to extend the loader (it may even become an external
module at some time).

\startsection[title={Getting quick information on a font}][library=fontloader]

\topicindex {fonts+information}

\libindex{info}

When you want to locate font by name you need some basic information that is
hidden in the font files. For that reason we provide an efficient helper that
gets the basic information without loading all of the font. Normally this helper
is used to create a font (name) database.

\startfunctioncall
<table> info =
    fontloader.info(<string> filename)
\stopfunctioncall

This function returns either \type {nil}, or a \type {table}, or an array of
small tables (in the case of a \TRUETYPE\ collection). The returned table(s) will
contain some fairly interesting information items from the font(s) defined by the
file:

\starttabulate[|l|l|p|]
\DB key                 \BC type     \BC explanation \NC \NR
\TB
\NC \type{fontname}     \NC string   \NC the \POSTSCRIPT\ name of the font\NC \NR
\NC \type{fullname}     \NC string   \NC the formal name of the font\NC \NR
\NC \type{familyname}   \NC string   \NC the family name this font belongs to\NC \NR
\NC \type{weight}       \NC string   \NC a string indicating the color value of the font\NC \NR
\NC \type{version}      \NC string   \NC the internal font version\NC \NR
\NC \type{italicangle}  \NC float    \NC the slant angle\NC \NR
\NC \type{units_per_em} \NC number   \NC 1000 for \POSTSCRIPT-based fonts, usually 2048 for \TRUETYPE\NC \NR
\NC \type{pfminfo}      \NC table    \NC (see \in{section}[fontloaderpfminfotable])\NC \NR
\LL
\stoptabulate

Getting information through this function is (sometimes much) more efficient than
loading the font properly, and is therefore handy when you want to create a
dictionary of available fonts based on a directory contents.

\stopsection

\startsection[title={Loading an \OPENTYPE\ or \TRUETYPE\ file}][library=fontloader]

\topicindex {\OPENTYPE}
\topicindex {\TRUETYPE}

\libindex{open}
\libindex{close}
\libindex{to_table}

If you want to use an \OPENTYPE\ font, you have to get the metric information
from somewhere. Using the \type {fontloader} library, the simplest way to get
that information is thus:

\starttyping
function load_font (filename)
  local metrics = nil
  local font = fontloader.open(filename)
  if font then
     metrics = fontloader.to_table(font)
     fontloader.close(font)
  end
  return metrics
end

myfont = load_font('/opt/tex/texmf/fonts/data/arial.ttf')
\stoptyping

The main function call is

\startfunctioncall
<userdata> f, <table> w = fontloader.open(<string> filename)
<userdata> f, <table> w = fontloader.open(<string> filename, <string> fontname)
\stopfunctioncall

The first return value is a userdata representation of the font. The second
return value is a table containing any warnings and errors reported by fontloader
while opening the font. In normal typesetting, you would probably ignore the
second argument, but it can be useful for debugging purposes.

For \TRUETYPE\ collections (when filename ends in 'ttc') and \DFONT\ collections,
you have to use a second string argument to specify which font you want from the
collection. Use the \type {fontname} strings that are returned by \type
{fontloader.info} for that.

To turn the font into a table, \type {fontloader.to_table} is used on the font
returned by \type {fontloader.open}.

\startfunctioncall
<table> f = fontloader.to_table(<userdata> font)
\stopfunctioncall

This table cannot be used directly by \LUATEX\ and should be turned into another
one as described in~\in {chapter} [fonts]. Do not forget to store the \type
{fontname} value in the \type {psname} field of the metrics table to be returned
to \LUATEX, otherwise the font inclusion backend will not be able to find the
correct font in the collection.

See \in {section} [fontloadertables] for details on the userdata object returned
by \type {fontloader.open} and the layout of the \type {metrics} table returned
by \type {fontloader.to_table}.

The font file is parsed and partially interpreted by the font loading routines
from \FONTFORGE. The file format can be \OPENTYPE, \TRUETYPE, \TRUETYPE\
Collection, \CFF, or \TYPEONE.

There are a few advantages to this approach compared to reading the actual font
file ourselves:

\startitemize

\startitem
    The font is automatically re|-|encoded, so that the \type {metrics} table for
    \TRUETYPE\ and \OPENTYPE\ fonts is using \UNICODE\ for the character indices.
\stopitem

\startitem
    Many features are pre|-|processed into a format that is easier to handle than
    just the bare tables would be.
\stopitem

\startitem
    \POSTSCRIPT|-|based \OPENTYPE\ fonts do not store the character height and
    depth in the font file, so the character boundingbox has to be calculated in
    some way.
\stopitem

\stopitemize

A loaded font is discarded with:

\startfunctioncall
fontloader.close(<userdata> font)
\stopfunctioncall

\stopsection

\startsection[title={Applying a \quote{feature file}}][library=fontloader]

\libindex{apply_featurefile}

You can apply a \quote{feature file} to a loaded font:

\startfunctioncall
<table> errors = fontloader.apply_featurefile(<userdata> font, <string> filename)
\stopfunctioncall

A \quote {feature file} is a textual representation of the features in an
\OPENTYPE\ font. See

\starttyping
http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html
\stoptyping

and

\starttyping
http://fontforge.sourceforge.net/featurefile.html
\stoptyping

for a more detailed description of feature files.

If the function fails, the return value is a table containing any errors reported
by fontloader while applying the feature file. On success, \type {nil} is
returned.

\stopsection

\startsection[title={Applying an \quote{\AFM\ file}}][library=fontloader]

\topicindex {\TYPEONE}

\libindex{apply_afmfile}

You can apply an \quote {\AFM\ file} to a loaded font:

\startfunctioncall
<table> errors = fontloader.apply_afmfile(<userdata> font, <string> filename)
\stopfunctioncall

An \AFM\ file is a textual representation of (some of) the meta information
in a \TYPEONE\ font. See

\starttyping
ftp://ftp.math.utah.edu/u/ma/hohn/linux/postscript/5004.AFM_Spec.pdf
\stoptyping

for more information about \AFM\ files.

Note: If you \type {fontloader.open} a \TYPEONE\ file named \type {font.pfb},
the library will automatically search for and apply \type {font.afm} if it exists
in the same directory as the file \type {font.pfb}. In that case, there is no
need for an explicit call to \type {apply_afmfile()}.

If the function fails, the return value is a table containing any errors reported
by fontloader while applying the AFM file. On success, \type {nil} is returned.

\stopsection

\startsection[title={Fontloader font tables},reference=fontloadertables][library=fontloader]

\topicindex {fontloader+tables}

\libindex{fields}

As mentioned earlier, the return value of \type {fontloader.open} is a userdata
object. One way to have access to the actual metrics is to call \type
{fontloader.to_table} on this object, returning the table structure that is
explained in the following sections. In teh following sections we will not
explain each field in detail. Most fields are self descriptive and for the more
technical aspects you need to consult the relevant font references.

It turns out that the result from \type {fontloader.to_table} sometimes needs
very large amounts of memory (depending on the font's complexity and size) so it
is possible to access the userdata object directly.

\startitemize
\startitem
    All top|-|level keys that would be returned by \type {to_table()}
    can also be accessed directly.
\stopitem
\startitem
    The top|-|level key \quote {glyphs} returns a {\it virtual\/} array that
    allows indices from \type {f.glyphmin} to (\type {f.glyphmax}).
\stopitem
\startitem
    The items in that virtual array (the actual glyphs) are themselves also
    userdata objects, and each has accessors for all of the keys explained in the
    section \quote {Glyph items} below.
\stopitem
\startitem
    The top|-|level key \quote {subfonts} returns an {\it actual} array of userdata
    objects, one for each of the subfonts (or nil, if there are no subfonts).
\stopitem
\stopitemize

A short example may be helpful. This code generates a printout of all
the glyph names in the font \type {PunkNova.kern.otf}:

\starttyping
local f = fontloader.open('PunkNova.kern.otf')
print (f.fontname)
local i = 0
if f.glyphcnt > 0 then
    for i=f.glyphmin,f.glyphmax do
       local g = f.glyphs[i]
       if g then
          print(g.name)
       end
       i = i + 1
    end
end
fontloader.close(f)
\stoptyping

In this case, the \LUATEX\ memory requirement stays below 100MB on the test
computer, while the internal structure generated by \type {to_table()} needs more
than 2GB of memory (the font itself is 6.9MB in disk size).

Only the top|-|level font, the subfont table entries, and the glyphs are virtual
objects, everything else still produces normal \LUA\ values and tables.

If you want to know the valid fields in a font or glyph structure, call the \type
{fields} function on an object of a particular type (either glyph or font):

\startfunctioncall
<table> fields = fontloader.fields(<userdata> font)
<table> fields = fontloader.fields(<userdata> font_glyph)
\stopfunctioncall

For instance:

\startfunctioncall
local fields = fontloader.fields(f)
local fields = fontloader.fields(f.glyphs[0])
\stopfunctioncall

\stopsection

\startsection[title={Table types}][library=fontloader]

\startsubsection[title={The main table}]

The top|-|level keys in the returned table are (the explanations in this part of
the documentation are not yet finished):

\starttabulate[|l|l|p|]
\DB key                                 \BC type     \NC explanation \NC \NR
\TB
\NC \type{table_version}                \NC number   \NC indicates the metrics version (currently~0.3)\NC \NR
\NC \type{fontname}                     \NC string   \NC \POSTSCRIPT\ font name\NC \NR
\NC \type{fullname}                     \NC string   \NC official (human-oriented) font name\NC \NR
\NC \type{familyname}                   \NC string   \NC family name\NC \NR
\NC \type{weight}                       \NC string   \NC weight indicator\NC \NR
\NC \type{copyright}                    \NC string   \NC copyright information\NC \NR
\NC \type{filename}                     \NC string   \NC the file name\NC \NR
\NC \type{version}                      \NC string   \NC font version\NC \NR
\NC \type{italicangle}                  \NC float    \NC slant angle\NC \NR
\NC \type{units_per_em}                 \NC number   \NC 1000 for \POSTSCRIPT-based fonts, usually 2048 for \TRUETYPE\NC \NR
\NC \type{ascent}                       \NC number   \NC height of ascender in \type {units_per_em}\NC \NR
\NC \type{descent}                      \NC number   \NC depth of descender in \type {units_per_em}\NC \NR
\NC \type{upos}                         \NC float    \NC \NC \NR
\NC \type{uwidth}                       \NC float    \NC \NC \NR
\NC \type{uniqueid}                     \NC number   \NC \NC \NR
\NC \type{glyphs}                       \NC array    \NC \NC \NR
\NC \type{glyphcnt}                     \NC number   \NC number of included glyphs\NC \NR
\NC \type{glyphmax}                     \NC number   \NC maximum used index the glyphs array\NC \NR
\NC \type{glyphmin}                     \NC number   \NC minimum used index the glyphs array\NC \NR
\NC \type{notdef_loc}                   \NC number   \NC location of the \type {.notdef} glyph
                                                         or \type {-1} when not present \NC \NR
\NC \type{hasvmetrics}                  \NC number   \NC \NC \NR
\NC \type{onlybitmaps}                  \NC number   \NC \NC \NR
\NC \type{serifcheck}                   \NC number   \NC \NC \NR
\NC \type{isserif}                      \NC number   \NC \NC \NR
\NC \type{issans}                       \NC number   \NC \NC \NR
\NC \type{encodingchanged}              \NC number   \NC \NC \NR
\NC \type{strokedfont}                  \NC number   \NC \NC \NR
\NC \type{use_typo_metrics}             \NC number   \NC \NC \NR
\NC \type{weight_width_slope_only}      \NC number   \NC \NC \NR
\NC \type{head_optimized_for_cleartype} \NC number   \NC \NC \NR
\NC \type{uni_interp}                   \NC enum     \NC \nod {unset}, \type {none}, \type {adobe},
                                                         \type {greek}, \type {japanese}, \type {trad_chinese},
                                                         \type {simp_chinese}, \type {korean}, \type {ams}\NC \NR
\NC \type{origname}                     \NC string   \NC the file name, as supplied by the user\NC \NR
\NC \type{map}                          \NC table    \NC \NC \NR
\NC \type{private}                      \NC table    \NC \NC \NR
\NC \type{xuid}                         \NC string   \NC \NC \NR
\NC \type{pfminfo}                      \NC table    \NC \NC \NR
\NC \type{names}                        \NC table    \NC \NC \NR
\NC \type{cidinfo}                      \NC table    \NC \NC \NR
\NC \type{subfonts}                     \NC array    \NC \NC \NR
\NC \type{commments}                    \NC string   \NC \NC \NR
\NC \type{fontlog}                      \NC string   \NC \NC \NR
\NC \type{cvt_names}                    \NC string   \NC \NC \NR
\NC \type{anchor_classes}               \NC table    \NC \NC \NR
\NC \type{ttf_tables}                   \NC table    \NC \NC \NR
\NC \type{ttf_tab_saved}                \NC table    \NC \NC \NR
\NC \type{kerns}                        \NC table    \NC \NC \NR
\NC \type{vkerns}                       \NC table    \NC \NC \NR
\NC \type{texdata}                      \NC table    \NC \NC \NR
\NC \type{lookups}                      \NC table    \NC \NC \NR
\NC \type{gpos}                         \NC table    \NC \NC \NR
\NC \type{gsub}                         \NC table    \NC \NC \NR
\NC \type{mm}                           \NC table    \NC \NC \NR
\NC \type{chosenname}                   \NC string   \NC \NC \NR
\NC \type{macstyle}                     \NC number   \NC \NC \NR
\NC \type{fondname}                     \NC string   \NC \NC \NR
%NC \type{design_size}                  \NC number   \NC \NC \NR
\NC \type{fontstyle_id}                 \NC number   \NC \NC \NR
\NC \type{fontstyle_name}               \NC table    \NC \NC \NR
%NC \type{design_range_bottom}          \NC number   \NC \NC \NR
%NC \type{design_range_top}             \NC number   \NC \NC \NR
\NC \type{strokewidth}                  \NC float    \NC \NC \NR
\NC \type{mark_classes}                 \NC table    \NC \NC \NR
\NC \type{creationtime}                 \NC number   \NC \NC \NR
\NC \type{modificationtime}             \NC number   \NC \NC \NR
\NC \type{os2_version}                  \NC number   \NC \NC \NR
\NC \type{math}                         \NC table    \NC \NC \NR
\NC \type{validation_state}             \NC table    \NC \NC \NR
\NC \type{horiz_base}                   \NC table    \NC \NC \NR
\NC \type{vert_base}                    \NC table    \NC \NC \NR
\NC \type{extrema_bound}                \NC number   \NC \NC \NR
\NC \type{truetype}                     \NC boolean  \NC signals a \TRUETYPE\ font \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[title={\type {glyphs}}]

The \type {glyphs} is an array containing the per|-|character
information (quite a few of these are only present if non|-|zero).

\starttabulate[|l|l|p|]
\DB key                      \BC type     \BC explanation \NC \NR
\TB
\NC \type{name}              \NC string   \NC the glyph name \NC \NR
\NC \type{unicode}           \NC number   \NC unicode code point, or -1 \NC \NR
\NC \type{boundingbox}       \NC array    \NC array of four numbers, see note below \NC \NR
\NC \type{width}             \NC number   \NC only for horizontal fonts \NC \NR
\NC \type{vwidth}            \NC number   \NC only for vertical fonts \NC \NR
\NC \type{tsidebearing}      \NC number   \NC only for vertical ttf/otf fonts, and only if non|-|zero \NC \NR
\NC \type{lsidebearing}      \NC number   \NC only if non|-|zero and not equal to boundingbox[1] \NC \NR
\NC \type{class}             \NC string   \NC one of "none", "base", "ligature", "mark", "component"
                                              (if not present, the glyph class is \quote {automatic}) \NC \NR
\NC \type{kerns}             \NC array    \NC only for horizontal fonts, if set \NC \NR
\NC \type{vkerns}            \NC array    \NC only for vertical fonts, if set \NC \NR
\NC \type{dependents}        \NC array    \NC linear array of glyph name strings, only if nonempty\NC \NR
\NC \type{lookups}           \NC table    \NC only if nonempty \NC \NR
\NC \type{ligatures}         \NC table    \NC only if nonempty \NC \NR
\NC \type{anchors}           \NC table    \NC only if set \NC \NR
\NC \type{comment}           \NC string   \NC only if set \NC \NR
\NC \type{tex_height}        \NC number   \NC only if set \NC \NR
\NC \type{tex_depth}         \NC number   \NC only if set \NC \NR
\NC \type{italic_correction} \NC number   \NC only if set \NC \NR
\NC \type{top_accent}        \NC number   \NC only if set \NC \NR
\NC \type{is_extended_shape} \NC number   \NC only if this character is part of a math extension list \NC \NR
\NC \type{altuni}            \NC table    \NC alternate \UNICODE\ items \NC \NR
\NC \type{vert_variants}     \NC table    \NC \NC \NR
\NC \type{horiz_variants}    \NC table    \NC \NC \NR
\NC \type{mathkern}          \NC table    \NC \NC \NR
\LL
\stoptabulate

On \type {boundingbox}: The boundingbox information for \TRUETYPE\ fonts and
\TRUETYPE-based \OTF\ fonts is read directly from the font file.
\POSTSCRIPT-based fonts do not have this information, so the boundingbox of
traditional \POSTSCRIPT\ fonts is generated by interpreting the actual bezier
curves to find the exact boundingbox. This can be a slow process, so the
boundingboxes of \POSTSCRIPT-based \OTF\ fonts (and raw \CFF\ fonts) are
calculated using an approximation of the glyph shape based on the actual glyph
points only, instead of taking the whole curve into account. This means that
glyphs that have missing points at extrema will have a too|-|tight boundingbox,
but the processing is so much faster that in our opinion the tradeoff is worth
it.

The \type {kerns} and \type {vkerns} are linear arrays of small hashes:

\starttabulate[|l|l|p|]
\DB key           \BC type   \BC explanation \NC \NR
\TB
\NC \type{char}   \NC string \NC \NC \NR
\NC \type{off}    \NC number \NC \NC \NR
\NC \type{lookup} \NC string \NC \NC \NR
\LL
\stoptabulate

The \type {lookups} is a hash, based on lookup subtable names, with
the value of each key inside that a linear array of small hashes:

% TODO: fix this description

\starttabulate[|l|l|p|]
\DB key                  \BC type \BC explanation \NC \NR
\TB
\NC \type{type}          \NC enum \NC \type {position}, \type {pair}, \type
                                      {substitution}, \type {alternate}, \type
                                      {multiple}, \type {ligature}, \type
                                      {lcaret}, \cbk {kerning}, \type {vkerning},
                                      \type {anchors}, \type {contextpos}, \type
                                      {contextsub}, \type {chainpos}, \type
                                      {chainsub}, \type {reversesub}, \type
                                      {max}, \type {kernback}, \type {vkernback}
                                      \NC \NR
\NC \type{specification} \NC table \NC extra data \NC \NR
\LL
\stoptabulate

For the first seven values of \type {type}, there can be additional
sub|-|information, stored in the sub-table \type {specification}:

\starttabulate[|l|l|p|]
\DB value               \BC type     \BC explanation \NC \NR
\TB
\NC \type{position}     \NC table    \NC a table of the \type {offset_specs} type \NC \NR
\NC \type{pair}         \NC table    \NC one string: \type {paired}, and an array of one
                                         or two \type {offset_specs} tables: \type {offsets} \NC \NR
\NC \type{substitution} \NC table    \NC one string: \type {variant} \NC \NR
\NC \type{alternate}    \NC table    \NC one string: \type {components} \NC \NR
\NC \type{multiple}     \NC table    \NC one string: \type {components} \NC \NR
\NC \type{ligature}     \NC table    \NC two strings: \type {components}, \type {char} \NC \NR
\NC \type{lcaret}       \NC array    \NC linear array of numbers \NC \NR
\LL
\stoptabulate

Tables for \type {offset_specs} contain up to four number|-|valued fields: \type
{x} (a horizontal offset), \type {y} (a vertical offset), \type {h} (an advance
width correction) and \type {v} (an advance height correction).

The \type {ligatures} is a linear array of small hashes:

\starttabulate[|l|l|p|]
\DB key               \BC type   \BC explanation \NC \NR
\TB
\NC \type{lig}        \NC table  \NC uses the same substructure as a single item in
                                     the \type {lookups} table explained above \NC \NR
\NC \type{char}       \NC string \NC \NC \NR
\NC \type{components} \NC array  \NC linear array of named components \NC \NR
\NC \type{ccnt}       \NC number \NC \NC \NR
\LL
\stoptabulate

The \type {anchor} table is indexed by a string signifying the anchor type, which
is one of:

\starttabulate[|l|l|p|]
\DB key             \BC type  \BC explanation \NC \NR
\TB
\NC \type{mark}     \NC table \NC placement mark \NC \NR
\NC \type{basechar} \NC table \NC mark for attaching combining items to a base char \NC \NR
\NC \type{baselig}  \NC table \NC mark for attaching combining items to a ligature \NC \NR
\NC \type{basemark} \NC table \NC generic mark for attaching combining items to connect to \NC \NR
\NC \type{centry}   \NC table \NC cursive entry point \NC \NR
\NC \type{cexit}    \NC table \NC cursive exit point \NC \NR
\LL
\stoptabulate

The content of these is a short array of defined anchors, with the
entry keys being the anchor names. For all except \type {baselig}, the
value is a single table with this definition:

\starttabulate[|l|l|p|]
\DB key                 \BC type   \BC explanation \NC \NR
\TB
\NC \type{x}            \NC number \NC x location \NC \NR
\NC \type{y}            \NC number \NC y location \NC \NR
\NC \type{ttf_pt_index} \NC number \NC truetype point index, only if given \NC \NR
\LL
\stoptabulate

For \type {baselig}, the value is a small array of such anchor sets sets, one for
each constituent item of the ligature.

For clarification, an anchor table could for example look like this :

\starttyping
['anchor'] = {
    ['basemark'] = {
        ['Anchor-7'] = { ['x']=170, ['y']=1080 }
    },
    ['mark'] ={
        ['Anchor-1'] = { ['x']=160, ['y']=810 },
        ['Anchor-4'] = { ['x']=160, ['y']=800 }
    },
    ['baselig'] = {
        [1] = { ['Anchor-2'] = { ['x']=160, ['y']=650 } },
        [2] = { ['Anchor-2'] = { ['x']=460, ['y']=640 } }
        }
    }
\stoptyping

Note: The \type {baselig} table can be sparse!

\stopsubsection

\startsubsection[title={\type {map}}]

The top|-|level map is a list of encoding mappings. Each of those is a table
itself.

\starttabulate[|l|l|p|]
\DB key             \BC type   \BC explanation \NC \NR
\TB
\NC \type{enccount} \NC number \NC \NC \NR
\NC \type{encmax}   \NC number \NC \NC \NR
\NC \type{backmax}  \NC number \NC \NC \NR
\NC \type{remap}    \NC table  \NC \NC \NR
\NC \type{map}      \NC array  \NC non|-|linear array of mappings\NC \NR
\NC \type{backmap}  \NC array  \NC non|-|linear array of backward mappings\NC \NR
\NC \type{enc}      \NC table  \NC \NC \NR
\LL
\stoptabulate

The \type {remap} table is very small:

\starttabulate[|l|l|p|]
\DB key             \BC type   \BC explanation \NC \NR
\TB
\NC \type{firstenc} \NC number \NC \NC \NR
\NC \type{lastenc}  \NC number \NC \NC \NR
\NC \type{infont}   \NC number \NC \NC \NR
\LL
\stoptabulate

The \type {enc} table is a bit more verbose:

\starttabulate[|l|l|p|]
\DB key                     \BC type   \BC explanation \NC \NR
\TB
\NC \type{enc_name}         \NC string \NC \NC \NR
\NC \type{char_cnt}         \NC number \NC \NC \NR
\NC \type{char_max}         \NC number \NC \NC \NR
\NC \type{unicode}          \NC array  \NC of \UNICODE\ position numbers\NC \NR
\NC \type{psnames}          \NC array  \NC of \POSTSCRIPT\ glyph names\NC \NR
\NC \type{builtin}          \NC number \NC \NC \NR
\NC \type{hidden}           \NC number \NC \NC \NR
\NC \type{only_1byte}       \NC number \NC \NC \NR
\NC \type{has_1byte}        \NC number \NC \NC \NR
\NC \type{has_2byte}        \NC number \NC \NC \NR
\NC \type{is_unicodebmp}    \NC number \NC only if non|-|zero\NC \NR
\NC \type{is_unicodefull}   \NC number \NC only if non|-|zero\NC \NR
\NC \type{is_custom}        \NC number \NC only if non|-|zero\NC \NR
\NC \type{is_original}      \NC number \NC only if non|-|zero\NC \NR
\NC \type{is_compact}       \NC number \NC only if non|-|zero\NC \NR
\NC \type{is_japanese}      \NC number \NC only if non|-|zero\NC \NR
\NC \type{is_korean}        \NC number \NC only if non|-|zero\NC \NR
\NC \type{is_tradchinese}   \NC number \NC only if non|-|zero [name?]\NC \NR
\NC \type{is_simplechinese} \NC number \NC only if non|-|zero\NC \NR
\NC \type{low_page}         \NC number \NC \NC \NR
\NC \type{high_page}        \NC number \NC \NC \NR
\NC \type{iconv_name}       \NC string \NC \NC \NR
\NC \type{iso_2022_escape}  \NC string \NC \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[title={\type {private}}]

This is the font's private \POSTSCRIPT\ dictionary, if any. Keys and values are
both strings.

\stopsubsection

\startsubsection[title={\type {cidinfo}}]

\starttabulate[|l|l|p|]
\DB key               \BC type   \BC explanation \NC \NR
\TB
\NC \type{registry}   \NC string \NC \NC \NR
\NC \type{ordering}   \NC string \NC \NC \NR
\NC \type{supplement} \NC number \NC \NC \NR
\NC \type{version}    \NC number \NC \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[reference=fontloaderpfminfotable,title={\type {pfminfo}}]

The \type {pfminfo} table contains most of the OS/2 information:

\starttabulate[|l|l|p|]
\DB key                     \BC type   \BC explanation \NC \NR
\TB
\NC \type{pfmset}           \NC number \NC \NC \NR
\NC \type{winascent_add}    \NC number \NC \NC \NR
\NC \type{windescent_add}   \NC number \NC \NC \NR
\NC \type{hheadascent_add}  \NC number \NC \NC \NR
\NC \type{hheaddescent_add} \NC number \NC \NC \NR
\NC \type{typoascent_add}   \NC number \NC \NC \NR
\NC \type{typodescent_add}  \NC number \NC \NC \NR
\NC \type{subsuper_set}     \NC number \NC \NC \NR
\NC \type{panose_set}       \NC number \NC \NC \NR
\NC \type{hheadset}         \NC number \NC \NC \NR
\NC \type{vheadset}         \NC number \NC \NC \NR
\NC \type{pfmfamily}        \NC number \NC \NC \NR
\NC \type{weight}           \NC number \NC \NC \NR
\NC \type{width}            \NC number \NC \NC \NR
\NC \type{avgwidth}         \NC number \NC \NC \NR
\NC \type{firstchar}        \NC number \NC \NC \NR
\NC \type{lastchar}         \NC number \NC \NC \NR
\NC \type{fstype}           \NC number \NC \NC \NR
\NC \type{linegap}          \NC number \NC \NC \NR
\NC \type{vlinegap}         \NC number \NC \NC \NR
\NC \type{hhead_ascent}     \NC number \NC \NC \NR
\NC \type{hhead_descent}    \NC number \NC \NC \NR
\NC \type{os2_typoascent}   \NC number \NC \NC \NR
\NC \type{os2_typodescent}  \NC number \NC \NC \NR
\NC \type{os2_typolinegap}  \NC number \NC \NC \NR
\NC \type{os2_winascent}    \NC number \NC \NC \NR
\NC \type{os2_windescent}   \NC number \NC \NC \NR
\NC \type{os2_subxsize}     \NC number \NC \NC \NR
\NC \type{os2_subysize}     \NC number \NC \NC \NR
\NC \type{os2_subxoff}      \NC number \NC \NC \NR
\NC \type{os2_subyoff}      \NC number \NC \NC \NR
\NC \type{os2_supxsize}     \NC number \NC \NC \NR
\NC \type{os2_supysize}     \NC number \NC \NC \NR
\NC \type{os2_supxoff}      \NC number \NC \NC \NR
\NC \type{os2_supyoff}      \NC number \NC \NC \NR
\NC \type{os2_strikeysize}  \NC number \NC \NC \NR
\NC \type{os2_strikeypos}   \NC number \NC \NC \NR
\NC \type{os2_family_class} \NC number \NC \NC \NR
\NC \type{os2_xheight}      \NC number \NC \NC \NR
\NC \type{os2_capheight}    \NC number \NC \NC \NR
\NC \type{os2_defaultchar}  \NC number \NC \NC \NR
\NC \type{os2_breakchar}    \NC number \NC \NC \NR
\NC \type{os2_vendor}       \NC string \NC \NC \NR
\NC \type{codepages}        \NC table  \NC A two-number array of encoded code pages \NC \NR
\NC \type{unicoderages}     \NC table  \NC A four-number array of encoded unicode ranges \NC \NR
\NC \type{panose}           \NC table  \NC \NC \NR
\LL
\stoptabulate

The \type {panose} subtable has exactly 10 string keys:

\starttabulate[|l|l|p|]
\DB key                    \BC type    \BC explanation \NC \NR
\TB
\NC \type{familytype}      \NC string  \NC Values as in the \OPENTYPE\ font
                                           specification: \type {Any}, \type {No Fit},
                                           \type {Text and Display}, \type {Script},
                                           \type {Decorative}, \type {Pictorial} \NC
                                           \NR
\NC \type{serifstyle}      \NC string  \NC See the \OPENTYPE\ font specification for
                                           values \NC \NR
\NC \type{weight}          \NC string  \NC idem \NC \NR
\NC \type{proportion}      \NC string  \NC idem \NC \NR
\NC \type{contrast}        \NC string  \NC idem \NC \NR
\NC \type{strokevariation} \NC string  \NC idem \NC \NR
\NC \type{armstyle}        \NC string  \NC idem \NC \NR
\NC \type{letterform}      \NC string  \NC idem \NC \NR
\NC \type{midline}         \NC string  \NC idem \NC \NR
\NC \type{xheight}         \NC string  \NC idem \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[reference=fontloadernamestable,title={\type {names}}]

Each item has two top|-|level keys:

\starttabulate[|l|l|p|]
\DB key          \BC type   \BC explanation \NC \NR
\TB
\NC \type{lang}  \NC string \NC language for this entry \NC \NR
\NC \type{names} \NC table  \NC \NC \NR
\LL
\stoptabulate

The \type {names} keys are the actual \TRUETYPE\ name strings. The possible keys
are: \type {copyright}, \type {family}, \type {subfamily}, \type {uniqueid},
\type {fullname}, \type {version}, \type {postscriptname}, \type {trademark},
\type {manufacturer}, \type {designer}, \type {descriptor}, \type {venderurl},
\type {designerurl}, \type {license}, \type {licenseurl}, \type {idontknow},
\type {preffamilyname}, \type {prefmodifiers}, \type {compatfull}, \type
{sampletext}, \type {cidfindfontname}, \type {wwsfamily} and \type
{wwssubfamily}.

\stopsubsection

\startsubsection[title={\type {anchor_classes}}]

The anchor_classes classes:

\starttabulate[|l|l|p|]
\DB key           \BC type   \BC explanation \NC \NR
\TB
\NC \type{name}   \NC string \NC a descriptive id of this anchor class\NC \NR
\NC \type{lookup} \NC string \NC \NC \NR
\NC \type{type}   \NC string \NC one of \nod {mark}, \type {mkmk}, \type {curs}, \type {mklg} \NC \NR
\LL
\stoptabulate

% type is actually a lookup subtype, not a feature name. Officially, these
% strings should be gpos_mark2mark etc.

\stopsubsection

\startsubsection[title={\type {gpos}}]

The \type {gpos} table has one array entry for each lookup. (The \type {gpos_}
prefix is somewhat redundant.)

\starttabulate[|l|l|p|]
\DB key              \BC type   \BC explanation \NC \NR
\TB
\NC \type{type}      \NC string \NC one of \type {gpos_single}, \type {gpos_pair},
                                    \type {gpos_cursive}, \type {gpos_mark2base},\crlf
                                    \type {gpos_mark2ligature}, \type {gpos_mark2mark}, \type {gpos_context},\crlf \type {gpos_contextchain} \NC \NR
\NC \type{flags}     \NC table  \NC \NC \NR
\NC \type{name}      \NC string \NC \NC \NR
\NC \type{features}  \NC array  \NC \NC \NR
\NC \type{subtables} \NC array  \NC \NC \NR
\LL
\stoptabulate

The flags table has a true value for each of the lookup flags that is actually
set:

\starttabulate[|l|l|p|]
\DB key                         \BC type    \BC explanation \NC \NR
\TB
\NC \type{r2l}                  \NC boolean \NC \NC \NR
\NC \type{ignorebaseglyphs}     \NC boolean \NC \NC \NR
\NC \type{ignoreligatures}      \NC boolean \NC \NC \NR
\NC \type{ignorecombiningmarks} \NC boolean \NC \NC \NR
\NC \type{mark_class}           \NC string  \NC \NC \NR
\LL
\stoptabulate

The features subtable items of gpos have:

\starttabulate[|l|l|p|]
\DB key            \BC type   \BC explanation \NC \NR
\TB
\NC \type{tag}     \NC string \NC \NC \NR
\NC \type{scripts} \NC table  \NC \NC \NR
\LL
\stoptabulate

The scripts table within features has:

\starttabulate[|l|l|p|]
\DB key           \BC type             \BC explanation \NC \NR
\TB
\NC \type{script} \NC string           \NC \NC \NR
\NC \type{langs}  \NC array of strings \NC \NC \NR
\LL
\stoptabulate

The subtables table has:

\starttabulate[|l|l|p|]
\DB key                     \BC type   \BC explanation \NC \NR
\TB
\NC \type{name}             \NC string \NC \NC \NR
\NC \type{suffix}           \NC string \NC (only if used)\NC \NR % used by gpos_single to get a default
\NC \type{anchor_classes}   \NC number \NC (only if used)\NC \NR
\NC \type{vertical_kerning} \NC number \NC (only if used)\NC \NR
\NC \type{kernclass}        \NC table  \NC (only if used)\NC \NR
\LL
\stoptabulate

The kernclass with subtables table has:

\starttabulate[|l|l|p|]
\DB key            \BC type             \BC explanation \NC \NR
\TB
\NC \type{firsts}  \NC array of strings \NC \NC \NR
\NC \type{seconds} \NC array of strings \NC \NC \NR
\NC \type{lookup}  \NC string or array  \NC associated lookup(s) \NC \NR
\NC \type{offsets} \NC array of numbers \NC \NC \NR
\LL
\stoptabulate

Note: the kernclass (as far as we can see) always has one entry so it could be one level
deep instead. Also the seconds start at \type {[2]} which is close to the fontforge
internals so we keep that too.

\stopsubsection

\startsubsection[title={\type {gsub}}]

This has identical layout to the \type {gpos} table, except for the
type:

\starttabulate[|l|l|p|]
\DB key         \BC type   \BC explanation \NC \NR
\TB
\NC \type{type} \NC string \NC one of \type {gsub_single}, \type {gsub_multiple},
                               \type {gsub_alternate}, \type {gsub_ligature},\crlf
                               \type {gsub_context}, \type {gsub_contextchain},
                               \type {gsub_reversecontextchain} \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[title={\type {ttf_tables} and \type {ttf_tab_saved}}]

\starttabulate[|l|l|p|]
\DB key           \BC type   \BC explanation \NC \NR
\TB
\NC \type{tag}    \NC string \NC \NC \NR
\NC \type{len}    \NC number \NC \NC \NR
\NC \type{maxlen} \NC number \NC \NC \NR
\NC \type{data}   \NC number \NC \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[title={\type {mm}}]

\starttabulate[|l|l|p|]
\DB key                   \BC type   \BC explanation \NC \NR
\TB
\NC \type{axes}           \NC table  \NC array of axis names \NC \NR
\NC \type{instance_count} \NC number \NC \NC \NR
\NC \type{positions}      \NC table  \NC array of instance positions
                                         (\#axes * instances )\NC \NR
\NC \type{defweights}     \NC table  \NC array of default weights for instances \NC \NR
\NC \type{cdv}            \NC string \NC \NC \NR
\NC \type{ndv}            \NC string \NC \NC \NR
\NC \type{axismaps}       \NC table  \NC \NC \NR
\LL
\stoptabulate

The \type {axismaps}:

\starttabulate[|l|l|p|]
\DB key            \BC type   \BC explanation \NC \NR
\TB
\NC \type{blends}  \NC table  \NC an array of blend points \NC \NR
\NC \type{designs} \NC table  \NC an array of design values \NC \NR
\NC \type{min}     \NC number \NC \NC \NR
\NC \type{def}     \NC number \NC \NC \NR
\NC \type{max}     \NC number \NC \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[title={\type {mark_classes}}]

The keys in this table are mark class names, and the values are a
space|-|separated string of glyph names in this class.

\stopsubsection

\startsubsection[title={\type {math}}]

The math table has the variables that are also discussed in the chapter aboout
math: \type {ScriptPercentScaleDown}, \type {ScriptScriptPercentScaleDown}, \type
{DelimitedSubFormulaMinHeight}, \type {DisplayOperatorMinHeight}, \type
{MathLeading}, \type {AxisHeight}, \type {AccentBaseHeight}, \type
{FlattenedAccentBaseHeight}, \type {SubscriptShiftDown}, \type {SubscriptTopMax},
\type {SubscriptBaselineDropMin}, \type {SuperscriptShiftUp}, \type
{SuperscriptShiftUpCramped}, \type {SuperscriptBottomMin}, \type
{SuperscriptBaselineDropMax}, \type {SubSuperscriptGapMin}, \type
{SuperscriptBottomMaxWithSubscript}, \type {SpaceAfterScript}, \type
{UpperLimitGapMin}, \type {UpperLimitBaselineRiseMin}, \type {LowerLimitGapMin},
\type {LowerLimitBaselineDropMin}, \type {StackTopShiftUp}, \type
{StackTopDisplayStyleShiftUp}, \type {StackBottomShiftDown}, \type
{StackBottomDisplayStyleShiftDown}, \type {StackGapMin}, \type
{StackDisplayStyleGapMin}, \type {StretchStackTopShiftUp}, \type
{StretchStackBottomShiftDown}, \type {StretchStackGapAboveMin}, \type
{StretchStackGapBelowMin}, \type {FractionNumeratorShiftUp}, \type
{FractionNumeratorDisplayStyleShiftUp}, \type {FractionDenominatorShiftDown},
\type {FractionDenominatorDisplayStyleShiftDown}, \type
{FractionNumeratorGapMin}, \type {FractionNumeratorDisplayStyleGapMin} \type
{FractionRuleThickness}, \type {FractionDenominatorGapMin}, \type
{FractionDenominatorDisplayStyleGapMin}, \type {SkewedFractionHorizontalGap},
\type {SkewedFractionVerticalGap}, \type {OverbarVerticalGap}, \type
{OverbarRuleThickness}, \type {OverbarExtraAscender}, \type
{UnderbarVerticalGap}, \type {UnderbarRuleThickness}, \type
{UnderbarExtraDescender}, \type {RadicalVerticalGap}, \type
{RadicalDisplayStyleVerticalGap}, \type {RadicalRuleThickness}, \type
{RadicalExtraAscender}, \type {RadicalKernBeforeDegree}, \type
{RadicalKernAfterDegree}, \type {RadicalDegreeBottomRaisePercent}, \type
{MinConnectorOverlap}, \type {FractionDelimiterSize} and \type
{FractionDelimiterDisplayStyleSize}.

\stopsubsection

\startsubsection[title={\type {validation_state}}]

This is just a bonus table with keys: \type {bad_ps_fontname}, \type {bad_glyph_table}, \type {bad_cff_table}, \type {bad_metrics_table}, \type {bad_cmap_table}, \type {bad_bitmaps_table}, \type {bad_gx_table}, \type {bad_ot_table}, \type {bad_os2_version} and \type {bad_sfnt_header}.

\stopsubsection

\startsubsection[title={\type {horiz_base} and \type {vert_base}}]

\starttabulate[|l|l|p|]
\DB key            \BC type  \BC explanation \NC \NR
\TB
\NC \type{tags}    \NC table \NC an array of script list tags\NC \NR
\NC \type{scripts} \NC table \NC \NC \NR
\LL
\stoptabulate

The \type {scripts} subtable:

\starttabulate[|l|l|p|]
\DB key                     \BC type    \BC explanation \NC \NR
\TB
\NC \type{baseline}         \NC table   \NC \NC \NR
\NC \type{default_baseline} \NC number  \NC \NC \NR
\NC \type{lang}             \NC table   \NC \NC \NR
\LL
\stoptabulate


The \type {lang} subtable:

\starttabulate[|l|l|p|]
\DB key             \BC type   \BC explanation \NC \NR
\TB
\NC \type{tag}      \NC string \NC a script tag \NC \NR
\NC \type{ascent}   \NC number \NC \NC \NR
\NC \type{descent}  \NC number \NC \NC \NR
\NC \type{features} \NC table  \NC \NC \NR
\LL
\stoptabulate

The \type {features} points to an array of tables with the same layout except
that in those nested tables, the tag represents a language.

\stopsubsection

\startsubsection[title={\type {altuni}}]

An array of alternate \UNICODE\ values. Inside that array are hashes with:

\starttabulate[|l|l|p|]
\DB key            \BC type   \BC explanation \NC \NR
\TB
\NC \type{unicode} \NC number \NC this glyph is also used for this unicode \NC \NR
\NC \type{variant} \NC number \NC the alternative is driven by this unicode selector \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[title={\type {vert_variants} and \type {horiz_variants}}]

\starttabulate[|l|l|p|]
\DB key                      \BC type   \BC explanation \NC \NR
\TB
\NC \type{variants}          \NC string \NC \NC \NR
\NC \type{italic_correction} \NC number \NC \NC \NR
\NC \type{parts}             \NC table  \NC \NC \NR
\LL
\stoptabulate

The \type {parts} table is an array of smaller tables:

\starttabulate[|l|l|p|]
\DB key              \BC type   \BC explanation \NC \NR
\TB
\NC \type{component} \NC string \NC \NC \NR
\NC \type{extender}  \NC number \NC \NC \NR
\NC \type{start}     \NC number \NC \NC \NR
\NC \type{end}       \NC number \NC \NC \NR
\NC \type{advance}   \NC number \NC \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[title={\type {mathkern}}]

\starttabulate[|l|l|p|]
\DB key                 \BC type  \BC explanation \NC \NR
\TB
\NC \type{top_right}    \NC table \NC \NC \NR
\NC \type{bottom_right} \NC table \NC \NC \NR
\NC \type{top_left}     \NC table \NC \NC \NR
\NC \type{bottom_left}  \NC table \NC \NC \NR
\LL
\stoptabulate

Each of the subtables is an array of small hashes with two keys:

\starttabulate[|l|l|p|]
\DB key           \BC type   \BC explanation \NC \NR
\TB
\NC \type{height} \NC number \NC \NC \NR
\NC \type{kern}   \NC number \NC \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[title={\type {kerns}}]

Substructure is identical to the per|-|glyph subtable.

\stopsubsection

\startsubsection[title={\type {vkerns}}]

Substructure is identical to the per|-|glyph subtable.

\stopsubsection

\startsubsection[title={\type {texdata}}]

\starttabulate[|l|l|p|]
\DB key           \BC type   \BC explanation \NC \NR
\TB
\NC \type{type}   \NC string \NC \nod {unset}, \type {text}, \nod {math}, \type {mathext} \NC \NR
\NC \type{params} \NC array  \NC 22 font numeric parameters \NC \NR
\LL
\stoptabulate

\stopsubsection

\startsubsection[title={\type {lookups}}]

Top|-|level \type {lookups} is quite different from the ones at character level.
The keys in this hash are strings, the values the actual lookups, represented as
dictionary tables.

\starttabulate[|l|l|p|]
\DB key                  \BC type   \BC explanation \NC \NR
\TB
\NC \type{type}          \NC string \NC \NC \NR
\NC \type{format}        \NC enum   \NC one of \type {glyphs}, \type {class}, \type {coverage},
                                        \type {reversecoverage} \NC \NR
\NC \type{tag}           \NC string \NC \NC \NR
\NC \type{current_class} \NC array  \NC \NC \NR
\NC \type{before_class}  \NC array  \NC \NC \NR
\NC \type{after_class}   \NC array  \NC \NC \NR
\NC \type{rules}         \NC array  \NC an array of rule items\NC \NR
\LL
\stoptabulate

Rule items have one common item and one specialized item:

\starttabulate[|l|l|p|]
\DB key                    \BC type  \BC explanation \NC \NR
\TB
\NC \type{lookups}         \NC array \NC a linear array of lookup names                         \NC \NR
\NC \type{glyphs}          \NC array \NC only if the parent's format is \type {glyphs}          \NC \NR
\NC \type{class}           \NC array \NC only if the parent's format is \type {class}           \NC \NR
\NC \type{coverage}        \NC array \NC only if the parent's format is \type {coverage}        \NC \NR
\NC \type{reversecoverage} \NC array \NC only if the parent's format is \type {reversecoverage} \NC \NR
\LL
\stoptabulate

A glyph table is:

\starttabulate[|l|l|p|]
\DB key          \BC type   \BC explanation \NC \NR
\TB
\NC \type{names} \NC string \NC \NC \NR
\NC \type{back}  \NC string \NC \NC \NR
\NC \type{fore}  \NC string \NC \NC \NR
\LL
\stoptabulate

A class table is:

\starttabulate[|l|l|p|]
\DB key            \BC type  \BC explanation \NC \NR
\TB
\NC \type{current} \NC array \NC of numbers  \NC \NR
\NC \type{before}  \NC array \NC of numbers  \NC \NR
\NC \type{after}   \NC array \NC of numbers  \NC \NR
\LL
\stoptabulate

for coverage:

\starttabulate[|l|l|p|]
\DB key            \BC type  \BC explanation \NC \NR
\TB
\NC \type{current} \NC array \NC of strings \NC \NR
\NC \type{before}  \NC array \NC of strings \NC \NR
\NC \type{after}   \NC array \NC of strings \NC \NR
\LL
\stoptabulate

and for reverse coverage:

\starttabulate[|l|l|p|]
\DB key                 \BC type   \BC explanation \NC \NR
\TB
\NC \type{current}      \NC array  \NC of strings  \NC \NR
\NC \type{before}       \NC array  \NC of strings  \NC \NR
\NC \type{after}        \NC array  \NC of strings  \NC \NR
\NC \type{replacements} \NC string \NC             \NC \NR
\LL
\stoptabulate

\stopsubsection

\stopsection

\stopchapter

\stopcomponent