如何更改.ttf字体的名称

时间:2022-12-06 22:49:46

How do you change the name of the font embedded in the .ttf file? (It's for a device that's expecting a hard coded font name that I'd like to swap w/ another more readable openly licensed font).

如何更改.ttf文件中嵌入的字体名称? (这是一个设备,它期望一个硬编码的字体名称,我想交换w /另一个更可读的公开许可字体)。

I'd prefer a method which I can implement myself rather than installing a program.

我更喜欢一种方法,我可以自己实现而不是安装程序。

1 个解决方案

#1


TrueType is a pretty complex binary data format -- the kind that takes an entire book-length spec to describe. I've worked with it in the distant past.

TrueType是一种非常复杂的二进制数据格式 - 需要整个书籍长度规范来描述。我在遥远的过去曾与它合作过。

There are specialized tools that can edit fonts, including metadata like names. I would not recommend trying to mess with the binary data in a font file without such a tool. There might be libraries available that you could call to manipulate TrueType data; if one existed, I would guess Python would be the most likely language to find it in, because there's a long correlation between font hackers and Python (Guido van Rossum's brother is a well-known typographer.)

有专门的工具可以编辑字体,包括名称之类的元数据。我不建议在没有这样的工具的情况下尝试将字体文件中的二进制数据弄乱。可能有可用的库可以调用来操作TrueType数据;如果存在,我猜想Python会是最有可能找到它的语言,因为字体黑客和Python之间有很长的关联(Guido van Rossum的兄弟是一位知名的印刷师。)

#1


TrueType is a pretty complex binary data format -- the kind that takes an entire book-length spec to describe. I've worked with it in the distant past.

TrueType是一种非常复杂的二进制数据格式 - 需要整个书籍长度规范来描述。我在遥远的过去曾与它合作过。

There are specialized tools that can edit fonts, including metadata like names. I would not recommend trying to mess with the binary data in a font file without such a tool. There might be libraries available that you could call to manipulate TrueType data; if one existed, I would guess Python would be the most likely language to find it in, because there's a long correlation between font hackers and Python (Guido van Rossum's brother is a well-known typographer.)

有专门的工具可以编辑字体,包括名称之类的元数据。我不建议在没有这样的工具的情况下尝试将字体文件中的二进制数据弄乱。可能有可用的库可以调用来操作TrueType数据;如果存在,我猜想Python会是最有可能找到它的语言,因为字体黑客和Python之间有很长的关联(Guido van Rossum的兄弟是一位知名的印刷师。)