提取字形字距调整信息 C++

发布于 2024-08-01 13:55:31 字数 399 浏览 9 评论 0原文

在询问我之前的问题关于 Uniscribe 字形字距调整之后,尚未收到答案,再加上谷歌等的进一步阅读,看来 Uniscribe 可能不支持从字体中提取字形字距信息。

因此,我有一个简单的后续问题 - 是否有任何从字体中提取指定字符串的字形字距调整信息的好示例(最好使用一些 C++ 代码)?

在很多地方都提到 Pango、QT 或 ICU 都能够做到这一点,但相关文档有点薄弱,我很难知道从哪里开始。

非常感谢任何为我指明正确方向的帮助。 我已经有了代码来以所需的方式呈现字形,我只是在扩展字距调整信息之后,所以我可以将字形定位得更好一些。

谢谢,

After asking my previous question about Uniscribe glyph kerning, and not yet receiving an answer, plus further reading on google etc, it seems Uniscribe may not support extracting glyph kerning information from a font.

I therefore have a simple followup question - are there any good examples (preferably with some C++ code) of extracting glyph kerning information for a specified string from a font?

It's mentioned in various places that either Pango, QT or ICU are capable of doing this, but documentation is a bit thin on the ground and I'm struggling to know where to get started.

Any help pointing me in the right direction gratefully received. I already have code in place to render the glyphs in the desired way, I am simply after the extended kerning information, so I can position the glyphs a little nicer.

Thanks,

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

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

发布评论

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

评论(1

策马西风 2024-08-08 13:55:32

OpenType 字体有两种不同的方式来指定字距调整信息,这两种方式都是可选的:

  1. 字距调整表,继承自 TrueType。 该表提供字距调整对信息(即,应水平偏移特定字符对多少)。 Microsoft 提供了此表的规范,并且还提供了一些 Windows API 函数,例如 < a href="http://msdn.microsoft.com/en-us/library/dd144895%28VS.85%29.aspx" rel="nofollow noreferrer">GetKerningPair()GetFontData() 可以帮助您提取值。

  2. GPOS 表,一个 OpenType 表,显然可以处理所有可能的字形定位形式。 微软还对该表有一些规范,但老实说,我什至不知道知道从哪里开始...您可能想看看 ICU 如何处理此类内容。

尽管我认为从 kern 表获取字距调整值比 GPOS 表简单得多,但我还没有找到太多相关的代码示例。

OpenType fonts have two different ways to specify kerning information, both of which are optional:

  1. The kern table, inherited from TrueType. This table supplies kerning pair information (i.e. how much you should horizontally offset a particular pair of characters). Microsoft provides specs for this table and also supplies some Windows API functions such as GetKerningPair() and GetFontData() that could help you extract values.

  2. The GPOS table, an OpenType table which apparently handles every conceivable form of glyph positioning. Microsoft also has some specs for this table, but honestly I don't even know where you'd begin... You'd probably want to look at how ICU handles this sort of stuff.

I haven't found much in the way of code samples for any of this, though I'd imagine getting kerning values from the kern table is far simpler than the GPOS table.

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