如何使用 FreeType 确定字体中没有字形的所有代码点?
这个问题与
有没有办法以编程方式确定字体文件是否具有特定的 Unicode 字形?
但是,我正在寻找不使用 Windows API 的解决方案。 Freetype 尤其看起来很有前途,我想知道是否有熟悉它的人可以提供指导。
基本上,我想,给定一种字体,计算从字符映射到没有该字符映射的字形的代码点序列的映射。
This question is closely related to
Is there a way to programmatically determine if a font file has a specific Unicode Glyph?
However, I am looking for a solution that does not use the Windows API. Freetype in particular looks promising, and I was wondering if anyone familiar with it could provide pointers.
Basically, I'd like to, given a font, calculate a mapping from character map to a sequence of codepoints without glyphs for that character map.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
特别是对于 FreeType,您可以使用 FT_Get_Char_Index 函数。 此函数返回 glyphID 0 以指示未映射的字形。
更一般地说:首先,您需要选择一个字符映射表(某些字体包括用于不同平台或单个平台下不同目的的多个映射),然后从显式映射的字形构建一个字典,并对其进行测试。
With FreeType in particular, you may use the FT_Get_Char_Index function. This function returns a glyphID of 0 to indicate an unmapped glyph.
In more general terms: first you'd need to select a Character Mapping table (some fonts include multiple maps for different platforms or different purposes under a single platform), then build a dictionary from the explicitly-mapped glyphs, and test against that.