Japanese Text Display error

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
nasedo
Posts: 5
Joined: Tue Oct 11, 2005 3:32 pm

Japanese Text Display error

Post 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.
[SOM]Roberto.

Re: Japanese Text Display error

Post by [SOM]Roberto. »

U must using utf6 code table witn develop program..

éőíőáéóűü :)

[SOM]Roberto
nasedo
Posts: 5
Joined: Tue Oct 11, 2005 3:32 pm

Post 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.
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post 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);
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
zgock
Posts: 12
Joined: Wed Sep 29, 2004 2:06 pm
Location: Japan
Contact:

Post 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.
nasedo
Posts: 5
Joined: Tue Oct 11, 2005 3:32 pm

Post 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.
nasedo
Posts: 5
Joined: Tue Oct 11, 2005 3:32 pm

Post 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
Post Reply