Page 1 of 1

Japanese Text Display error

Posted: Mon Oct 24, 2005 12:40 pm
by nasedo
Hello, I tried adding some japanese text to Irrlicht gui display but soon found that the addStaticText function cannot display the text properly, resulting in "blocky squares" displayed for each character.

The code look like this:

Code: Select all

wchar_t* text = L"オフィス翻訳";
guienv->addStaticText(text, core::rect<int>(20,20,200,200), true, true, container);
But the equivalent text displayed correctly with setWindowsCaption function:

Code: Select all

wchar_t captiontext[255];
swprintf(captiontext, 255, L"オフィス翻訳");
device->setWindowCaption(captiontext); 
I had tried using the swprintf/stringw function and many other ways to handle the text, e.g. saving the cpp files with different encodings, re-compiled the engine with different locale and language settings, etc, but the displayed result are still "blocky squares". Anyone experienced similar behaviour? Any idea for solving this problem? Thanks.

Re: Japanese Text Display error

Posted: Mon Oct 24, 2005 1:14 pm
by [SOM]Roberto.
U must using utf6 code table witn develop program..

éőíőáéóűü :)

[SOM]Roberto

Posted: Tue Oct 25, 2005 4:17 pm
by nasedo
Well, changing code table didn't work. I already tried that before. Also tried setLocale, using Macro in <TChar.h>, etc and etc.

Posted: Wed Oct 26, 2005 10:23 am
by bearSoft
i will not guarantee u hat this will work but it did for danish charachters
i simply omitted the 'L' whitch is a string formatting flag for unicode:
..'literal unicode-wide'
eg try
wchar_t captiontext[255];
swprintf(captiontext, 255, "オフィス翻訳"); //obs no 'L'
device->setWindowCaption(captiontext);

Posted: Wed Oct 26, 2005 6:18 pm
by zgock
Irrlicht cannot display multibyte language in standard font system.
there is truetype extention for Irrlicht.
see this thread.

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3995

if you are Japanese(or you can read Japanese),
also u'd better see author's tutorial
http://www.zgock-lab.net/irrlicht

#I am trying to build CJK supported Irrlicht Branch. wait a while.

Posted: Wed Oct 26, 2005 6:33 pm
by nasedo
Yes, I tried this too but in vain. As I mentioned that setCaptionText() function is fine but the problem lies in addStaticText() function.

Code: Select all

wchar_t text[255]; 
swprintf(text, 255, L"オフィス翻訳"); //without L, it wouldn't compile
guienv->addStaticText(text, core::rect<int>(20,20,200,200), true, true, container); 
or

Code: Select all

#include <tchar.h>
....
.......
..........
wchar_t text[255]; 
swprintf(text, 255, _T("オフィス翻訳") ); 
guienv->addStaticText(text, core::rect<int>(20,20,200,200), true, true, container); 
The above didn't work too. All the displayed characters become "blocky squares". Anyway, Thanks for the advices.

Posted: Wed Oct 26, 2005 6:36 pm
by nasedo
Thank you, Zgock. The CGUIFont class seems very useful and the demo looks great. I will try this out. Looking forward to the CJK supported Irrlicht :D