News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Drawing characters

Started by Sanguis, March 06, 2008, 09:21:41 PM

Previous topic - Next topic

Sanguis

Hi,

When I print a complex characterstring like: aaaa,
I use an x variable to indicate the x-position of the (next) character.
I update it using the GetCharWidths32() function like this:

int x = 0;
for (int i = 0; i < NCHAR; i++) {
wchar_t ch = GetTheCharAndSetCorrectFont(hdc);

TextOut(hdc, x, 0, &ch, 1);

int to_add;
GetCharWidths32(hdc, ch, ch, &to_add);
x += to_add;
}

But there is an extra spacing between several characters (e.g. _ and =) that
I really want to get rid of. I noticed the TexOut() does not have this extra spacing.
Using SetTextCharacterExtra(hdc, 0) doesn't do anything either.
Could anyone help? (I am trying to support vector and raster fonts too, or isn't that worth the effort?)

Thanks.


iZzz32

Maybe you could use GetTextExtentPoint32 for a sequence of characters with the same style?