NO

Author Topic: Drawing characters  (Read 4022 times)

Sanguis

  • Guest
Drawing characters
« on: March 06, 2008, 09:21:41 PM »
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

  • Guest
Re: Drawing characters
« Reply #1 on: March 17, 2008, 08:09:07 PM »
Maybe you could use GetTextExtentPoint32 for a sequence of characters with the same style?