0

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?

Hayri Uğur Koltuk
  • 2,970
  • 4
  • 31
  • 60

2 Answers2

2

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

Jordi Ros
  • 21
  • 3
0

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...

meds
  • 21,699
  • 37
  • 163
  • 314
  • I am sure that the rectangle is big enough. Here is how I am sure: I draw 2 different texts into 1 rectangle, one of them is aligned with DT_LEFT other with DT_RIGHT. There is some distance between them, means rectangle is wide enough. However when any of them is italic (doesn't matter if the one on the left or if the one on the right), some letters (not necessarily last) of italic text is something like half-displayed, i.e., right part of them isn't shown. I will try to provide some screenshot but I am not sure if I can – Hayri Uğur Koltuk May 25 '11 at 13:51