复合 (Type0) 字体的 PDF 字形宽度
PDF glyph widths for composite (Type0) fonts
CIDfont 宽度在什么 unit/space 中定义?
我正在尝试获取文档中字形的设备 space 坐标(或者,在我的情况下,在默认用户 space 中等效),但我在复合字体的字形置换方面遇到了问题。
ISO 规范(CIDFonts 上的 8.7.1)表示 DW 是以用户单位定义的。
这似乎是一个奇怪的选择,因为其他字体类型(Type3 除外)的宽度以字形 space 定义,但 W 中的宽度也以用户单位定义是有意义的。
但似乎并非如此。在计算字形位移时(如 9.4.4 文本 Space 详细信息中所述),将宽度与逆文本矩阵相乘,将它们转换为文本 space,似乎没有给我正确的结果。我正在处理的文档使用默认用户 space(未定义 CTM 或设置 UserUnit),因此根据我的理解,这应该有效。
我哪里错了?
The ISO spec (8.7.1 on CIDFonts) says that DW is defined in user units.
我假设您发现 "user units" 在 ISO 32000-1 第 9.7.4.1 节(第 "CIDFonts" 节的 "General" 节中提到):
DW
integer
(Optional) The default width for glyphs in the CIDFont (see 9.7.4.3, "Glyph Metrics in CIDFonts"). Default value: 1000 (defined in user units).
(ISO 32000-1, Table 117 – Entries in a CIDFont dictionary)
的确,这里的”(以用户单位定义)”是相当具有误导性的,所以它在ISO 32000-2中已经被删除,其中相应的条目只说
DW
number
(Optional) The default width for glyphs in the CIDFont (see 9.7.4.3, "Glyph metrics in CIDFonts"). Default value: 1000.
(ISO 32000-2, Table 115 — Entries in a CIDFont dictionary)
假定以用户 space 单位给出的字体位移数字也没有任何意义,因为位移必须符合当前状态,如文本矩阵、水平缩放和字体大小,因此,不能是用户 space.
中的固定维度
相反,我们实际上与 CID 字体处于与其他字体相同的情况,位移以字形 space 给出,并转换为文本 space,如第 8.3 节中所定义。 ISO 32000-1 和 ISO 32000-2 的 2.4 ("Other Coordinate Spaces"):
Character glyphs in a font shall be defined in glyph space (see 9.2.4, "Glyph Positioning and Metrics"). The transformation from glyph space to text space shall be defined by the font matrix. For most types of fonts, this matrix shall be predefined to map 1000 units of glyph space to 1 unit of text space; for Type 3 fonts, the font matrix shall be given explicitly in the font dictionary (see 9.6.5, "Type 3 Fonts").
因此,默认 CIDFont 字形宽度的默认值 1000 DW 允许正方形 1×1 文本 space 区域,而正方形区域确实是什么可以正确绘制许多 CJK 字形,使此默认值合理。
CIDfont 宽度在什么 unit/space 中定义? 我正在尝试获取文档中字形的设备 space 坐标(或者,在我的情况下,在默认用户 space 中等效),但我在复合字体的字形置换方面遇到了问题。
ISO 规范(CIDFonts 上的 8.7.1)表示 DW 是以用户单位定义的。 这似乎是一个奇怪的选择,因为其他字体类型(Type3 除外)的宽度以字形 space 定义,但 W 中的宽度也以用户单位定义是有意义的。
但似乎并非如此。在计算字形位移时(如 9.4.4 文本 Space 详细信息中所述),将宽度与逆文本矩阵相乘,将它们转换为文本 space,似乎没有给我正确的结果。我正在处理的文档使用默认用户 space(未定义 CTM 或设置 UserUnit),因此根据我的理解,这应该有效。
我哪里错了?
The ISO spec (8.7.1 on CIDFonts) says that DW is defined in user units.
我假设您发现 "user units" 在 ISO 32000-1 第 9.7.4.1 节(第 "CIDFonts" 节的 "General" 节中提到):
DW integer (Optional) The default width for glyphs in the CIDFont (see 9.7.4.3, "Glyph Metrics in CIDFonts"). Default value: 1000 (defined in user units).
(ISO 32000-1, Table 117 – Entries in a CIDFont dictionary)
的确,这里的”(以用户单位定义)”是相当具有误导性的,所以它在ISO 32000-2中已经被删除,其中相应的条目只说
DW number (Optional) The default width for glyphs in the CIDFont (see 9.7.4.3, "Glyph metrics in CIDFonts"). Default value: 1000.
(ISO 32000-2, Table 115 — Entries in a CIDFont dictionary)
假定以用户 space 单位给出的字体位移数字也没有任何意义,因为位移必须符合当前状态,如文本矩阵、水平缩放和字体大小,因此,不能是用户 space.
中的固定维度相反,我们实际上与 CID 字体处于与其他字体相同的情况,位移以字形 space 给出,并转换为文本 space,如第 8.3 节中所定义。 ISO 32000-1 和 ISO 32000-2 的 2.4 ("Other Coordinate Spaces"):
Character glyphs in a font shall be defined in glyph space (see 9.2.4, "Glyph Positioning and Metrics"). The transformation from glyph space to text space shall be defined by the font matrix. For most types of fonts, this matrix shall be predefined to map 1000 units of glyph space to 1 unit of text space; for Type 3 fonts, the font matrix shall be given explicitly in the font dictionary (see 9.6.5, "Type 3 Fonts").
因此,默认 CIDFont 字形宽度的默认值 1000 DW 允许正方形 1×1 文本 space 区域,而正方形区域确实是什么可以正确绘制许多 CJK 字形,使此默认值合理。