使用 GDI 设置字距调整+绘制文字时
使用 GDI+ 绘制文本时是否可以设置字距调整?如果没有,有人知道有一个像样的图像库可以实现这一点吗?
干杯,伊恩。
Is it possible to set the kerning when drawing text with GDI+? If not does anyone know of a decent image library that enables this?
Cheers, Ian.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 CodeGuru 上找到了 C++ 代码,它解释了字偶距对并使用 GDI+ 进行绘制。它不是 .NET,因此需要互操作,或者您可以将代码放入 C++/CLI 程序集中。
制作GDI+ Less Finicky About Fonts
本质上,您需要获取字体的字距对并组装 GDI+ 绘图路径给定的字符串。我能够使用 Visual Studio 2013 轻松打开、构建和运行他的代码,并且它可以正确调整字距。前任。用 Garamond 绘制“SAVVA”将正确调整 AV 对的字距。
I found C++ code on CodeGuru which accounts for the Kerning Pairs and draws with GDI+. It's not .NET so interop would be needed or you could put the code into a C++/CLI assembly.
Make GDI+ Less Finicky About Fonts
Essentially, you need to get the font's Kerning Pairs and assemble the GDI+ drawing path for a given string. I was able to open, build and run his code with Visual Studio 2013 with not much effort and it does the kerning properly. ex. draw "SAVVA" with Garamond will kern the AV pair properly.