Game Development Community

Problem with UTF8 on itgb 1.4.1 and 1.5 [SOLVED]

by Edoardo · in iTorque 2D · 10/11/2011 (2:24 am) · 3 replies

If I use utf8 text on editor work correctly... but if I set the t2dTextObject at runtime doesn't work correctly (the particulars chars are not displayed)
Code used to set the text at runtime: textObject.Text = $Locale::VarWithUTF8Text;

This is a big problem for automatic localizations....

Can anyone help me?

Thanks

#1
10/11/2011 (5:06 pm)
the font is only generated for the letters present on the objects already. if the letter is not used at compiled time, then it will be missing on the bitmap font and thus not render on the device as bitmap fonts will not be generated on the device!

Its easy to fix: add a dummy text object that has present all letters you will use throughout the applictaion that uses the font and it will be generated with all them :)
#2
10/17/2011 (4:24 am)
Hi Marc,

Thanks for your response but your solution down't work for me :(

this is the test:

On Editor iT2D 1.4.1 :
before: img64.imageshack.us/img64/5053/beforec.png
after scene saved: img535.imageshack.us/img535/9769/afterr.png
Another issue.... When I save text object with "special characters" the editor crash.

#3
10/17/2011 (9:06 am)
I've found the error:

replace the code into StringBuffer.cc:

//Luma:	Version of StringBuffer that doesn't convert to UTF16 for performance reasons
StringBuffer::StringBuffer(const UTF8 *in, bool bNoConvert)
: mBuffer(), mBuffer8()
{
   SBMAddThisStringBuffer();
       setNoConvert(in);
}
with this:

//Luma:	Version of StringBuffer that doesn't convert to UTF16 for performance reasons
StringBuffer::StringBuffer(const UTF8 *in, bool bNoConvert)
: mBuffer(), mBuffer8()
{
   SBMAddThisStringBuffer();
    if(bNoConvert){
       setNoConvert(in);
    }else{
       set(in);
    }
}