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
这让我们有理由相信,对于预先计算好的但完全恕我直言的冗余字段 rangeShift
、entrySelector
、searchRange
会有普遍的需求。它甚至声明它们将用于字体列表的二进制搜索 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 如下。
- 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
似乎 "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 确实会检查它们并可能将错误的值标记为无效字体。因此,如果您问这个关于创建字体的问题,我建议您在字段中填写正确的数据。
根据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
这让我们有理由相信,对于预先计算好的但完全恕我直言的冗余字段 rangeShift
、entrySelector
、searchRange
会有普遍的需求。它甚至声明它们将用于字体列表的二进制搜索 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 如下。
- 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
似乎 "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 确实会检查它们并可能将错误的值标记为无效字体。因此,如果您问这个关于创建字体的问题,我建议您在字段中填写正确的数据。