[Solved]Can't display NonEnglish character

wilsonwing

12-12-2008 03:59:58

I am a beginner of QuickQUI.
I've searched the form and find some similar problem.
I use QuickGUI 8.09 version and Ogre1.6.0.
This is what I do in my code:


QuickGUI::Sheet* defaultSheet = m_pGUIManager->getActiveSheet();
QuickGUI::ButtonDesc bd;
bd.name = "MyButton";
bd.dimensions.size = QuickGUI::Size(200,50);
bd.dimensions.position = QuickGUI::Point(50,50);
bd.textDesc.segments.push_back(QuickGUI::TextSegment("MeFont",Ogre::ColourValue::Red,("中文測試")));
QuickGUI::Button* myButton = defaultSheet->createButton(bd);


I got runtime error with the code above.

[url=http://img389.imageshack.us/my.php?image=errdg9.jpg][img="http://img389.imageshack.us/img389/6109/errdg9.th.jpg" alt=""]


I searched and found someone add code:

bd.textDesc.segments.push_back(QuickGUI::TextSegment("MeFont",Ogre::ColourValue::Red,ConvertToUTF("中文測試")));

Ogre::UTFString ConvertToUTF(Ogre::String String)
{
Ogre::UTFString UTFString;
int i;
Ogre::UTFString::code_point cp;
for (i=0; i<(int)String.size(); ++i)
{
cp = String[i];
cp &= 0xFF;
UTFString.append(1, cp);
}
return UTFString;
}

This time I can run my work but the output characters looked square, not the character I want to present.
(Button at the top left)


This is my fontdef:

MeFont
{
type truetype
source cfmingeb.ttf
size 12
resolution 96
code_points 33-166 12290-12291 19986-40959 65280-65312
}

And also it seems no difference if I add code_points 33-166 12290-12291 19986-40959 65280-65312 or not.

I really wants to try QuickGUI because it looks great.
Please help ,great thanks in advance :D

darkdragon

12-12-2008 05:30:30

Well, it could be the wrong font that not supporting the unicode strings.
The mingliu(新細明體) is the default font wicth supported in Windows.
Also, you could download the free unicode fonts here
http://www.wazu.jp/gallery/Fonts_ChineseTraditional.html

In fact, you should ask this question in MainForum.
It's not the QuckGUI's question. :P

wilsonwing

12-12-2008 06:33:34

Well, it could be the wrong font that not supporting the unicode strings.
The mingliu(新細明體) is the default font wicth supported in Windows.
Also, you could download the free unicode fonts here
http://www.wazu.jp/gallery/Fonts_ChineseTraditional.html

In fact, you should ask this question in MainForum.
It's not the QuckGUI's question. :P

Thanks for your help.
I've download about 5 .ttf files from the web you gave above.
But none of then works in showing Chinese.
(All Ok for English and numbers)

Maybe there's other reason make it failed? :(

kungfoomasta

12-12-2008 07:33:13

Sorry, I'm not very knowledgable in this area. Can you try to create an Ogre Overlay using Chinese characters? I make use of the Ogre UTFString class; basically I should be able to display anything an Ogre Overlay can.

darkdragon

12-12-2008 09:37:23

Sorry, I'm not very knowledgable in this area. Can you try to create an Ogre Overlay using Chinese characters? I make use of the Ogre UTFString class; basically I should be able to display anything an Ogre Overlay can.
But don't try to write utf-8 chinese words into overlay files.
It caused to shutdown, because the Ogre script reading class is not supported utf8 code.
And the same thing happened to the layout script of QuickGUI.
It is derived from ScriptReader of Ogre.
:cry:

kungfoomasta

12-12-2008 18:28:42

Unfortunately I don't know enough about utf8 and far eastern languages to try to add in support for this, but I welcome any additions. Sorry..

wilsonwing

13-12-2008 01:34:54

Don't know why this morning I start my program and it now shows Chinese.... :shock:

Unfortunately I don't know enough about utf8 and far eastern languages to try to add in support for this, but I welcome any additions. Sorry..
Please don't be sorry for that, you already make a good work of QuickGUI.
I will continue to study this GUI :D

ps. If I have problem to ready NonEnglish from keyboard and it doesn't work(for example, read only English). Should I post it here or MainForm. I would probebly run into this someday soon.....

kungfoomasta

13-12-2008 21:24:42

There are two aspects, the first is the .fontdef file, where you specify which code points are used to generate the glyphs from the true type font. The second is QuickGUI::GUIManager::setSupportedCodePoints, which outline the acceptable inputs GUIManager will inject into Text Widgets. If you've checked both the .fontdef and added the code point to the list of supported code points in the GUIManager and nothing shows, its probably a question meant for Ogre forums.

wilsonwing

14-12-2008 01:48:11

There are two aspects, the first is the .fontdef file, where you specify which code points are used to generate the glyphs from the true type font. The second is QuickGUI::GUIManager::setSupportedCodePoints, which outline the acceptable inputs GUIManager will inject into Text Widgets. If you've checked both the .fontdef and added the code point to the list of supported code points in the GUIManager and nothing shows, its probably a question meant for Ogre forums.
I love QuickGUI. Great thanks!! :D