TrueType 字体文件中的字体表数量?

Number of font tables in TrueType Font files?

根据Apple's Reference manual for TrueType字体文件,有45种不同类型的字体table。检查我在系统上安装的那些 ttf,我确定这些文件中实际存在的 tables 的数量范围从每个文件 12 到最多 22 个字体 tables。

进一步查看真字体文件的结构,它从以下信息开始:​​

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

这让我们有理由相信,对于预先计算好的但完全恕我直言的冗余字段 rangeShiftentrySelectorsearchRange 会有普遍的需求。它甚至声明它们将用于字体列表的二进制搜索 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)

甚至考虑添加这些字段的一个正当理由,这些字段无论如何都可以从 numTables 中即时计算出来,确实有大量字体 tables.

因此,我的问题是,尽管我进行了测试,但是否确实存在可以合理预期 true type 字体具有更大(例如 >1000)数量的 table 的情况,这意味着问题是 45 种不同类型的字体 table 中的任何一种是否有可能多次出现?

它列出的 table 如下。

  1. The 'acnt' (accent attachment) table
  2. The 'ankr' (anchor point) table
  3. The 'avar' (axis variation) table
  4. The 'bdat' (bitmap data) table
  5. The 'bhed' (bitmap font header) table
  6. The 'bloc' (bitmap location) table
  7. The 'bsln' (baseline) table
  8. The 'cmap' (character code mapping) table
  9. The 'cvar' (CVT variation) table
  10. The 'cvt ' (control value) table
  11. The 'EBSC' (embedded bitmap scaling control) table
  12. The 'fdsc' (font descriptor) table
  13. The 'feat' (layout feature) table
  14. The 'fmtx' (font metrics) table
  15. The 'fond' (font family compatibility) table
  16. The 'fpgm' (font program) table
  17. The 'fvar' (font variation) table
  18. The 'gasp' (grid-fitting and scan-conversion procedure) table
  19. The 'glyf' (glyph outline) table
  20. The 'gvar' (glyph variation) table
  21. The 'hdmx' (horizontal device metrics) table
  22. The 'head' (font header) table
  23. The 'hhea' (horizontal header) table
  24. The 'hmtx' (horizontal metrics) table
  25. The 'just' (justification) table
  26. The 'kern' (kerning) table
  27. The 'kerx' (extended kerning) table
  28. The 'lcar' (ligature caret) table
  29. The 'loca' (glyph location) table
  30. The 'ltag' (language tag) table
  31. The 'maxp' (maximum profile) table
  32. The 'meta' (metadata) table
  33. The 'morx' (extended metamorphosis) table
  34. The 'name' (name) table
  35. The 'opbd' (optical bounds) table
  36. The 'OS/2' (compatibility) table
  37. The 'post' (glyph name and PostScript compatibility) table
  38. The 'prep' (control value program) table
  39. The 'prop' (properties) table
  40. The 'sbix' (extended bitmaps) table
  41. The 'trak' (tracking) table
  42. The 'vhea' (vertical header) table
  43. The 'vmtx' (vertical metrics) table
  44. The 'xref' (cross-reference) table
  45. The 'Zapf' (glyph reference) table

似乎 "font tables" 允许其中任何随机 "extension",例如有一个字体 table 标记为 FFTM

"[...] 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

即使是像 FFTM 这样偶尔添加的 table 似乎也不适合字段 searchRange

在 80 年代末/90 年代初发明 TrueType 时,开发人员不确定随着格式的采用会发生怎样的变化。还要记住,那时处理器速度要慢得多。

事实证明,确实很少有字体超过 25 tables,并且可能 none 接近二进制搜索和使用预计算字段的数字在定位 table 时会有很大的不同(与仅遍历排序列表相比)。

不过,字段是规范的一部分,不能“省略”。许多实现会忽略这些字段,并且它们经常填充错误的值,但请注意许多字体 checkers/validators/sanitizers 确实会检查它们并可能将错误的值标记为无效字体。因此,如果您问这个关于创建字体的问题,我建议您在字段中填写正确的数据。