Extended ASCII and the New Unicode Text
by Eric Armstrong · in Torque Game Builder · 10/02/2006 (9:00 pm) · 1 replies
I'm having an issue with rendering text containing extended ASCII characters. The specific character I'm attempting to write is the Registered Trademark symbol. ASCII code 174 - (R) - I can't put the actual symbol, since GG ate my post when I did.
Anyway... let me type this again...
I traced through the code, and the character is displaying fine in the debugger until the rendering code attempts to convert the UTF8 to a UTF32. In unicode.cc within method oneUTF8toUTF32, after halving the char value, and using that as a look up in an array, that array returns 0, which causes the character to be marked invalid, so it doesn't get displayed...
I don't really know enough about Unicode and the conversion that is going on to fix this. Does anyone out there know enough about this code to point me in a direction that may lead to a solution?
Any help would be appreciated...
Thanks,
Eric Armstrong
Anyway... let me type this again...
I traced through the code, and the character is displaying fine in the debugger until the rendering code attempts to convert the UTF8 to a UTF32. In unicode.cc within method oneUTF8toUTF32, after halving the char value, and using that as a look up in an array, that array returns 0, which causes the character to be marked invalid, so it doesn't get displayed...
I don't really know enough about Unicode and the conversion that is going on to fix this. Does anyone out there know enough about this code to point me in a direction that may lead to a solution?
Any help would be appreciated...
Thanks,
Eric Armstrong
Torque Owner David Barr
Viola Interactive Ltd
Try removing the UNICODE define and then adding this (from a post I made elsewhere)
When unicode is not defined, extended ascii chars are not displayed correctly in gui controls.
I think I have tracked this down to a call to dglDrawTextN in dgl.cc where the text to be drawn is converted from UTF8 to UTF16 regardless of whether unicode is defined or not.
Around line 514 you have :
if you change this to :
then extended ascii chars display correctly.