Windows:从其他字体获取替换字符的字形轮廓
我需要将字体渲染到 3D 游戏世界中,因此我使用 GetGlyphOutline 轮廓函数来获取要渲染到纹理中的字形形状。但是,我希望能够处理给定字体中不存在字符的情况(亚洲其他国际文本经常出现这种情况)。 Windows 文本渲染将自动替换具有所需字符的字体。但 GetGlyphOutline 不会。我如何检测这种情况,并获取替换字形的轮廓? Mac OS X Core Text 有一个函数可以获取给定字体和字符串的匹配替换字体 - Windows 上有类似的功能吗?
I need to render fonts into a 3d game world, so I use the GetGlyphOutline outline function to get the glyph shapes to render into a texture. However, I want to be able to handle the case where characters are not present in the given font (as is often the case for asian other other international text). Windows text rendering will automatically substitute fonts which have the needed characters. But GetGlyphOutline will not. How can I detect this case, and get the outlines for the substituted glyphs? Mac OS X Core Text has a function to get a matching substitution font for a given font and a string - is there anything similar on windows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
找到了我自己需要了解的内容: IMLangFontLink 界面< /a>,尤其是 MapFont 方法包含查找应在 Windows 上使用哪些替换字体所需的功能。
Found out what I needed to know myself: The IMLangFontLink interface, especially the MapFont method contain the needed functionality to find out which substitution fonts should be used on windows.
我也对 GetGlyphOutline 感到困惑。我不确定您是否能够执行相同的操作,但我能够通过将
TextOut()
与BeginPath()
结合使用来获得混合脚本文本轮廓、EndPath()
和GetPath()
。例如,即使使用 Arial 字体,我也能够获取日语文本「テsuto」的路径(使用 C++,但也可以在 C 中轻松完成):
I too have puzzled with
GetGlyphOutline
. I'm not sure if you were able to do the same, but I was able to get mixed-script text outlines by usingTextOut()
in combination withBeginPath()
,EndPath()
andGetPath()
.For example, even with the Arial font, I am able to get the path of the Japanese text 「テスト」 (using C++, but can easily be done in C as well):