In the last thread I mencioned that we introduced MovableText. The text was fine, but it didn't suport special portuguese characters like L'ç' L'é' or L'À' . Here's somethings I learn today:
In C++ normal char's take 8 bit's while wide chars take 16 bits.
char:
char c = 'a';
wide char:
wchar_t wc = L'ç';
you have to put an L before the char literal to say that it is a wide char.
Theres also std::wstring for strings of wide chars.
In the MovableText class they use the Ogre::Font class. This class loads a true type font into the ogre system. It supports all types of UTF formats, but by default, it only loads to the memory the characters with unicode between 33 and 166. That's all fine if you're writing English, but if you're writing a language with accents like I am the first 166 characteres are just not enough.
I changed the range to [33, 255] before the Font's loading.
I added this code to MovableText in the setFontName function:
...
mpFont->addCodePointRange( Font::CodePointRange( 33, 255 ));
mpFont->load();
...
and there it is "ÇçáàéèíÍ..."
Showing posts with label wchar. Show all posts
Showing posts with label wchar. Show all posts
Wednesday, July 18, 2007
Subscribe to:
Posts (Atom)