PostScript AFM 文件和字形名称

发布于 2024-12-10 18:54:45 字数 638 浏览 0 评论 0 原文

我想使用字形名称作为键将 Type 1 字体的字形度量存储在字典(Python)中,因为每个字形都有一个名称并且是唯一的(AFAIK)。但是,Adobe Font Metric 规范 规定单个字符指标的规范不必包含字形名称(它是可选的)。因此,某些 AFM 文件可能未指定字形名称,因此仅知道某些字形的字符代码。这意味着,在没有指定字形名称的情况下,我还需要解析 PFB 文件以找出字形名称(在编码表中查找)。这似乎违背了 AFM 文件的初衷。

但是,我检查了一些 AFM 文件,但尚未找到在指标规范中省略字形名称的文件。我可以放心地假设字形名称将始终存在吗?是不是有什么不成文的规定,毕竟名字是必须的?

编辑我已经测试了 Adobe FTP 站点,并且在所有这些站点中,为每个字符度量行指定了字形名称。因此,至少对于 Adob​​e 字体,我认为我可以假设字形名称存在。

I would like to store a Type 1 font's glyph metrics in a dictionary (Python) using the glyph name as the key, as each glyph has a name and it is unique (AFAIK). However, the Adobe Font Metric specification states that an individual character metrics' specification does not have to include the glyph name (it's optional). Therefore, it is possible that some AFM files do not specify the glyph name, so only the character code is known for some glyphs. This means that, in the case no glyph name is specified, I need to also parse the PFB file to find out the glyph name (looking it up in the encoding table). This seems to defeat the very purpose of the AFM file.

However, I have checked a few AFM files, and I haven't yet found one that omits the glyph name in a metrics specification. Can I safely assume the glyph name will always be present? Is there an unwritten rule that the name is required afterall?

EDIT I have tested the 2447 AFM files that are available on the Adobe FTP site, and in all of them the glyph name is specified for each and every character metrics line. So, for Adobe fonts at least, I think I can assume the glyph name is present.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

卖梦商人 2024-12-17 18:54:45

编码的查找仅适用于那些以默认编码编码的字形,这通常是总可用字形的一小部分。显然,您可以重新编码字体以访问通常无法访问的字形。

未编码的字形在 AFM 文件中的字符代码为 -1,因此您无法在编码中查找它们。这意味着这些指标毫无用处,因为您不知道它们适用于哪个字形!

虽然名称在 AFM 中是可选的,但如果您发现许多 AFM 文件不提供该名称,我会感到惊讶。

请注意,我通常与 AFM 文件没有任何关系,因为 PostScript 根本不使用它们。

您是正确的,类型 1 字体 CharStrings 字典中的字形名称是唯一的。

Lookup of the Encoding only works for those glyphs which are encoded in the default Encoding, this is often a small subset of the total available glyphs. Obviously you can re-encode the font to access the glyphs which are not normally accessible.

Glyphs which aren't encoded have a character code of -1 in the AFM file, so you can't look those up in the Encoding. Which means that the metrics are useless because you don't know which glyph they apply to!

While the name is optional in an AFM I'd be surprised if you find many AFM files which don't supply it.

Note that I don't normally have anything to do with AFM files, as they aren't used by PostScript at all.

You are correct that glyph names in a type 1 font CharStrings dictionary are unique.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文