According to Apple's Reference manual for TrueType font files, there are 45 different types of font tables. Checking those ttf I have installed on my system, I have acertained that the number of tables actually present in those files ranges from 12 to maximum 22 font tables per file.
Looking further at the structure of a true type font file, it start with this information:
uint32 scaler type A tag to indicate the OFA scaler to be used to rasterize this font; see the note on the scaler type below for more information.
uint16 numTables number of tables
uint16 searchRange (maximum power of 2 <= numTables)*16
uint16 entrySelector log2(maximum power of 2 <= numTables)
uint16 rangeShift numTables*16-searchRange
which gives reason to believe there would be a common need for the precalculated, but yet totally imho redudant fields rangeShift
, entrySelector
, searchRange
. It even states them to be employed for binary searching of the list of font tables:
The entries for searchRange, entrySelector and rangeShift are used to facilitate quick binary searches of the table directory that follows (source https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6.html)
A valid reason to even consider adding those fields, which could anyway be calculated on the fly from numTables
would be indeed that there is a large number of font tables.
My question is therefore, if despite my testing there exist indeed occasions in which true type fonts are reasonably to be expected to have a larger (e.g. >1000) number of tables, which would imply the question if it is at all possible that any of the 45 different type of font tables can occure multiple times?
The tables it listed are the following.
- The 'acnt' (accent attachment) table
- The 'ankr' (anchor point) table
- The 'avar' (axis variation) table
- The 'bdat' (bitmap data) table
- The 'bhed' (bitmap font header) table
- The 'bloc' (bitmap location) table
- The 'bsln' (baseline) table
- The 'cmap' (character code mapping) table
- The 'cvar' (CVT variation) table
- The 'cvt ' (control value) table
- The 'EBSC' (embedded bitmap scaling control) table
- The 'fdsc' (font descriptor) table
- The 'feat' (layout feature) table
- The 'fmtx' (font metrics) table
- The 'fond' (font family compatibility) table
- The 'fpgm' (font program) table
- The 'fvar' (font variation) table
- The 'gasp' (grid-fitting and scan-conversion procedure) table
- The 'glyf' (glyph outline) table
- The 'gvar' (glyph variation) table
- The 'hdmx' (horizontal device metrics) table
- The 'head' (font header) table
- The 'hhea' (horizontal header) table
- The 'hmtx' (horizontal metrics) table
- The 'just' (justification) table
- The 'kern' (kerning) table
- The 'kerx' (extended kerning) table
- The 'lcar' (ligature caret) table
- The 'loca' (glyph location) table
- The 'ltag' (language tag) table
- The 'maxp' (maximum profile) table
- The 'meta' (metadata) table
- The 'morx' (extended metamorphosis) table
- The 'name' (name) table
- The 'opbd' (optical bounds) table
- The 'OS/2' (compatibility) table
- The 'post' (glyph name and PostScript compatibility) table
- The 'prep' (control value program) table
- The 'prop' (properties) table
- The 'sbix' (extended bitmaps) table
- The 'trak' (tracking) table
- The 'vhea' (vertical header) table
- The 'vmtx' (vertical metrics) table
- The 'xref' (cross-reference) table
- The 'Zapf' (glyph reference) table
It seems that the "font tables" allow any random "extension" among them, as for instance there is a font table labeled FFTM
, which
"[...] is unique to FontForge. It contains three timestamps: First FontForge's version date, then when the font was generated, and when the font was created. I describe its format here."
https://fontforge.github.io/TrueOpenTables.html
Still even those occasional added tables like FFTM
would not seem to merit the fields searchRange etc.
When TrueType was invented in the late 1980s/early 1990s, the developers were not certain how things would evolve as the format was adopted. Also remember that processor speeds were considerably slower then.
As it turns out, indeed, few fonts have more than about 25 tables, and probably none that approach the number where a binary search and the use of the pre-calculated fields would make much difference in locating a table (versus just iterating through the sorted list).
Nevertheless, the fields are part of the specification and can’t be “omitted”. Many implementations ignore the fields, and they are frequently filled with wrong values, but be aware that many font checkers/validators/sanitizers DO check them and might flag wrong values as an invalid font. So if you’re asking this question as regards creating a font, I would advise filling in the fields with correct data.