为什么使用 Direct X 渲染斜体文本时某些字符没有完全显示

发布于 2024-11-09 05:37:20 字数 129 浏览 9 评论 0原文

我正在使用 ID3DXFont::DrawText 渲染一些斜体文本。虽然我指定了 DT_NOCLIP 并且矩形足够大,但通常但不仅如此,文本的最后一个字符没有完全显示,而是从右侧剪切。

原因是什么?我该如何解决?有什么想法吗?

I am rendering some italic text using ID3DXFont::DrawText. Although i specify DT_NOCLIP and the rectangle is big enough, usually, but not only, last character of the text isn't show completely, but it is rather cut from its right side.

What can be the reason and how can I fix it? Any ideas?

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

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

发布评论

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

评论(2

生死何惧 2024-11-16 05:37:20

这是 ID3DFont 类中的常见故障,并且无法解决(据我所知)。当字符具有不同的字符宽度和渲染宽度时,它不会计算真实的矩形面积,主要是在计算完整句子的总矩形面积时。
此外,罕见的字体(具有与其他字符重叠的渲染矩形)也肯定会被剪切。
其他故障包括字距调整对,因为它根本不关心它们。经典的 AV 示例将被渲染为中间有一个空白区域。

因此,最好的解决方案是避免 ID3DFont,并为自己编写文本渲染器,或使用 DirectWrite 等其他替代方案。

http://msdn.microsoft.com/en -us/library/dd368038%28v=vs.85%29.aspx

This is a common malfunction in the ID3DFont class, and it is not solventable (as I know of). It doesn't calculate real rectangle areas when characters have different character width and render width, mainly when calculating total rectangle area of a complete sentence.
Also rare fonts (that have render rectangles the overlap other characters) will be cut for sure too.
Other malfunctions include kerning pairs, as it simply doesn't care about them. The classic AV example will be rendered as if it had a white space in the middle.

Because of this, the best solution is to avoid ID3DFont, and code yourself a text renderer, or use other alternatives like DirectWrite.

http://msdn.microsoft.com/en-us/library/dd368038%28v=vs.85%29.aspx

删除→记忆 2024-11-16 05:37:20

这可能是别名问题?也许矩形实际上不够大?

不过,您应该发布一些代码和问题的屏幕截图......

It could be an aliasing issue? Perhaps the rectangle isn't actually big enough?

You should post some code and a screenshot of the problem though...

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