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 si开发者_如何学编程de.
What can be the reason and how can I fix it? Any ideas?
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
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...
精彩评论