GDI and fonts

Started by
1 comment, last by Habba 18 years, 8 months ago
I'm using GDI function 'DrawText' to draw text on DirectX surface and then the surface is blitted to backbuffer. I got two problems: Look at the picture here - http://koti.mbnet.fi/oalatalo/Fontbug.PNG 1. In upper part of the picture you can see some white text on a background. The problem is, that character tracking (space between characters) is too small and the text looks somewhat messy. Is there a good way to increase the space between characters without increasing the size of fonts? This can be done in Adobe Photoshop atleast. I'm not sure wether it is a normal property or not. 2. Lower part of that picture holds the other problem. Transparent color on the surface (where the text is drawn) is RGB(255,0,198). When the text is drawn, it gets anti-aliased, which alters the colors and... well, you can see the results by yourself. So, can I turn of this anti-aliasing? I'm using GDI (DrawText) and a custom True-type font. Althought my problem contains some DirectX, I decided to post this message here because it's about GDI.
Advertisement
I think your biggest problem is that you're using a font which quite frankly is extremely difficult to read.

But that aside, SetTextCharacterExtra will add a fixed amount of space between each character. SetTextJustification will add space to "break" characters - spaces basically.

To turn off anti-aliasing (and Cleartype) specify NONANTIALIASED_QUALITY when creating the font.
-Mike
Quote:Original post by Anon Mike
I think your biggest problem is that you're using a font which quite frankly is extremely difficult to read.


Agreed, but I'm not the person who decides that.

Anyway, you solved my problems. My MSDN seems to be rather old, there was no mention about nonantialiased_quality...

Thanks again. I really like this place, no matter the problem, it gets solved in no time.

This topic is closed to new replies.

Advertisement