Hayri Uğur Koltuk
Hayri Uğur Koltuk

Reputation: 3020

Why some characters aren't completely shown when rendering italic text with Direct X

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?

Upvotes: 0

Views: 450

Answers (2)

Jordi Ros
Jordi Ros

Reputation: 21

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

Upvotes: 2

meds
meds

Reputation: 22926

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

Upvotes: 0

Related Questions