Game Development Community

Extended ascii char display

by David Barr · in Torque Game Engine · 10/07/2006 (4:24 pm) · 1 replies

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 :

FrameTemp<UTF16> ubuf(dStrlen(str) + 1);
convertUTF8toUTF16(str, ubuf, dStrlen(str) + 1);

if you change this to :

#ifdef UNICODE
FrameTemp<UTF16> ubuf(dStrlen(str) + 1);
convertUTF8toUTF16(str, ubuf, dStrlen(str) + 1);
#else
FrameTemp<UTF8> ubuf(dStrlen(str) + 1);
dSprintf( ubuf, dStrlen(str) + 1, "%s", str );
#endif

then extended ascii chars display correctly.