从 ttf 文件中提取字形路径信息

发布于 2024-09-04 07:52:13 字数 187 浏览 5 评论 0原文

我正在尝试找出一种方法来提取 ttf 文件中编码的信息。即:字符到字形表和单独的字形路径数据。

有谁有解释 ttf 文件结构的良好参考资料或其他解决方案吗?

请记住,我对任何可以为我做这件事的库也不感兴趣(除非它们是开源的并且我可以看到他们是如何做的)。 “主要”目标是用 Javascript 实现它。

谢谢!

I'm trying to figure out a way to extract the information encoded in ttf files. namely: The char-to-glyph table and the individual glyph path data.

Does anyone have a good reference explaining the ttf file structure, or some other solution?

Keep in mind that I'm not interested in any libraries that can do it for me either (unless they are open source and I can see how they are doing it). The "master" goal is to implement it in Javascript.

Thanks!

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

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

发布评论

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

评论(3

无力看清 2024-09-11 07:52:14

该工具包有一个名为 ttf2svg 的实用程序,它是用 java 编写的开源工具。
http://xmlgraphics.apache.org/batik/

你可以尝试提取ttf解析逻辑并按照您的意愿实施它。

在过去的情况下,我使用此实用程序生成 svg 文件并在针对 ipad 用户的网页中使用它(@fontface css 功能)。

This toolkit has an utility called ttf2svg, it is open source written in java.
http://xmlgraphics.apache.org/batik/

You can try to extract the ttf parsing logic and implement it as you want.

In a past situation I used this utility to generate a svg file and use it in a web page targeting ipad users (@fontface css feature).

无畏 2024-09-11 07:52:14

OpenType.js 在 javascript 环境、浏览器或 Node.js(我为该库做出了贡献)中非常完美。快速&便于使用。
请记住,实施尚未完成,如果您需要尚未实施的内容,您可以提出问题,我们将尽可能为您提供帮助!

对于更完整的工具,fontTools在命令行上会更强大(&完整解析/书写) https:// github.com/behdad/fonttools/

如果您执行 ttx myfont.ttf ,它将生成一个包含所有信息的 xml 文件 (myfont.ttx),您可以修改信息并执行 ttx myfont.ttx 它会根据它生成一个字体!

顺便说一句,我最近做了一个很棒的排版列表,其中包含大量有关 ttf / otf 的资源: https:// github.com/Jolg42/awesome-typography
有很多不同语言的库,从 javascript 到 C

OpenType.js is perfect in a javascript environment, browser or Node.js (I contributed to the lib). Fast & easy to use.
Just keep in mind that the implementation is not complete, if you need something that is not yet implemented you can open an issue and we will help you if we can!

For a more complete tool, fontTools will be more powerful in command line (& complete parsing/writing) https://github.com/behdad/fonttools/

If you do ttx myfont.ttf it will generate an xml file (myfont.ttx) with all infos, you can modify the infos and do ttx myfont.ttx and it will generate a font based on it!

By the way I did an awesome list for typography recently with a lot of resources concerning ttf / otf: https://github.com/Jolg42/awesome-typography
There are a lot of librairies in different languages from javascript to C ????

野味少女 2024-09-11 07:52:13

查看 OpenType.js,网址为 http://opentype.js.org/

opentype.js 为您提供对字形的原始访问,以便您可以根据需要修改它们。

可以使用 Font Inspector 检查 OpenType 和 TrueType 字体中的所有表格,并枚举所有使用 Glyph Inspector 的字形

Take a look at OpenType.js at http://opentype.js.org/

opentype.js provides you with raw access to the glyphs so you can modify them as you please.

One can inspect all the tables in an OpenType and TrueType font using Font Inspector, and enumerate all the glyphs using Glyph Inspector

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