Skip to main content
GameDev.net gamedev.net
🔒 Locked

Unicode characters

Started by Phantom Sage Aug 11, 2007 at 7:47 PM 2 replies 1.5k views
Original Post
Phantom Sage
Phantom Sage
I've been working on getting unicode characters into my bitmap font editor. It's going well thus far. However, I've noticed something odd. For the standard character set (typically 0x00-0xFF) if I call GetCharABCWidths() I get the proper placement data. However, on several characters (but not all) above this range the ABC struct returns with all 0's in it. This does not work because I at the very least need the B portion which specifies the actual width of the font character (A and C specifies the over/under hang for the font character). So I end up with a character that goes nowhere. My question is this: Is GetCharABCWidths suitable for higher unicode characters? Or do I use another API/function for that? If so, which API or function? I'd like to reiterate from past posts in other forums: I hate unicode. Thanks.
Extrarius
Extrarius
If you set your project to use unicode, it should work properly. If you don't want to (for whatever reason) but still want to use the unicode version of the function, add a 'W' suffix to make it "GetCharABCWidthsW" (or 'A' for the ansi version in a unicode program "GetCharABCWidthsA").
The same 'trick' can be applied to many functions that would process text in some way.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
Phantom Sage
Phantom Sage
Well I'm using .NET, but perhaps the pinvoke for the function isn't set to use the unicode version. I'll force it and give it a shot, thanks.
Phantom Sage
Phantom Sage
Quote:
Original post by Extrarius
If you set your project to use unicode, it should work properly. If you don't want to (for whatever reason) but still want to use the unicode version of the function, add a 'W' suffix to make it "GetCharABCWidthsW" (or 'A' for the ansi version in a unicode program "GetCharABCWidthsA").
The same 'trick' can be applied to many functions that would process text in some way.


That looks like it worked, apparently C# defaults the pinvoke functions to CharSet.ANSI, switching it to CharSet.Auto seemed to work like a charm.

Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.