Game Development Community

How to use Unicode Font in TGE 1.4.0?

by Skanda · in Torque Game Engine · 11/24/2005 (11:51 pm) · 11 replies

NOTES:
1 I use TGE 1.4.0 of this Version: the TorqueGameEngineSDK-1-4.exe
2 In TGE,setting the TORQUE_UNICODE and the UNICODE define in the build settings of VC


I'm a Chinese User of TGE!The Chinese Characters Rendering has problem since TGE 1.40RC2.
Now when the TGE 1.40 come,I test it.
My Modify is:
1 Rendering Chinese Chars in GUIControl:
In "mainMenuGui.gui", modify the GUIControl chars:

new GuiButtonCtrl() {
      profile = "GuiButtonProfile";
      horizSizing = "right";
      vertSizing = "top";
      position = "36 413";
      extent = "110 20";
      minExtent = "8 8";
      visible = "1";
      command = "quit();";
      text = "[Some Chinese Chars]";    // --- can't display normally,i express in this way!
      groupNum = "-1";
      buttonType = "PushButton";
         helpTag = "0";
   };

BUGs:
1 When i run torque.exe again,this chars doesn't display!
2 and if i change "mainMenuGui.gui" to UTF8 encoding using UltraEdit,then TGE can't load this file!

3 And when you type Chinese Chars using IME,such as "[Chinese Chars]" in TGE;the string is "a 1 [Chinese Chars]",the proper chars is [Chinese Chars],and you have to delete the chars of "a 1".

How to Fix this problem?

Thanks very much!

#1
11/25/2005 (8:54 am)
I had the same problem on 1.4 cr2 days .I posted on the forum long long ago.
www.garagegames.com/mg/forums/result.thread.php?qt=34464
and it seem to no fix in 1.4.0. I had figured out showing and inputing chinese in TGE 1.3.0.
so I would not use 1.4.0 except they fix the bugs.
#2
11/27/2005 (4:45 pm)
Thanks, Roger Tan!
#3
11/27/2005 (8:02 pm)
I'd love to fix this issue!

Unfortunately, Roger never gave me the information I needed to fix the problem. As I said in my reply on that thread, everything seems to be working fine on my end. We're even using the same code on Marble Blast Ultra, where it works fine under Microsoft's rigorous testing. All I need to do is be able to reproduce the problem, then I can fix it.

That means I need to know what IME you are using, and what keys you're hitting to make the problem happen. Or at least a journal of the problem. What font are you using? Are you using a fresh compile from the installer?

I really want to fix this issue! Please give me the information I need to do this! :)
#4
11/30/2005 (10:56 pm)
// --- Three BUGs about Torque Render Unicode Chars such as Chinese Words --- //

I found three bugs in Torque 1.40 when it render Unicode Chars such as Chinese Words:
[Bug 1] Using UniCode Chars in *.gui Files
I use Microsoft PinYin IME 2003 to type in Chinese Words,
and I saw the article in TDN about "TorqueUnicode", I build the TGE 1.4.0 in WindowsXP Chinese Version SP2 and use the FLAG "TORQUE_UNICODE",but when I modify "mainMenuGui.gui",
the problem is still ON!

new GuiButtonCtrl() {
      profile = "GuiButtonProfile";
      horizSizing = "right";
      vertSizing = "top";
      position = "36 413";
      extent = "110 20";
      minExtent = "8 8";
      visible = "1";
      command = "quit();";
      text = "阿修罗";
      groupNum = "-1";
      buttonType = "PushButton";
         helpTag = "0";
   };

1) the char i type in "Microsoft PinYin IME 2003 " is "a 1" & "xiu 2" & "luo 1", this may create "阿修罗"!
2) when I type in this words,i use UltraEdit to save the file "mainMenuGui.gui" to UTF8 or UTF16 Format.
3) and when i test to run Torque.exe, it gave me a black Screen because the mainMenuGui.gui
is not Loaded correctly!

[Bug 2] Typeing words in GuiTextCtrl
when i ceate user name in torque,i get the string of "a 1阿xiu 2修luo 1罗" in GuiTextCtrl, but when i log in Player.GUI,the name is display normally such as "阿修罗"!

[Bug 3] You can't use IME in MessageHud for talking in Player.GUI, only what you can type are english words!

Hope your help!
And Thanks very much for you and your Team that fix these BUGs!

and Ben, I send you a email for showing the correct Chinese Words!
#5
01/10/2006 (12:57 am)
A. TorqueUnicode
tdn.garagegames.com/wiki/TorqueUnicode

b. TorqueLocalization
tdn.garagegames.com/wiki/TorqueLocalization

These day,I saw these POST,but when i follow the Steps,the Chinese Fonts still can't diplay correctly!

What's the problem?

and in
tdn.garagegames.com/wiki/Torque/1.4/WhatsNew

It say:
Quote:Unicode Support
Torque supports UTF8 encoded Unicode data. Just select a font that has the characters you need in it (not all fonts have the full Unicode range), make sure your files are saved in UTF8 encoding... and you're done.

but when i save file to UTF8 encoding using UltraEdit,such as "mainMenuGui.gui", then TGE can't load it!
#6
01/10/2006 (8:53 am)
Make sure you're not saving a BOM in the file. That will confuse TGE's script parser.
#7
01/10/2006 (6:03 pm)
Tom Bampton, Thanks you very much!

You are all right! When I save the file to UTF8- no BOM,
then the Character is rendering OK!
#8
01/10/2006 (6:14 pm)
No problem. I just clarified the BOM issue in the TorqueUnicode TDN article so hopefully it wont be so tricky to figure out in the future.

T.
#9
10/05/2006 (3:39 am)
Excuse my ignorance, whats BOM?
#10
10/05/2006 (10:48 am)
It's a special character at the start of a Unicode file indicating what endianness and encoding is used (UTF8, UTF16 big endian, UTF16 little endian, UTF32 big endian, UTF32 little endian).
#11
01/11/2007 (4:58 pm)
For any as confused as I was...

If using JEdit: Under the Utilities menu, in General settings select UTF-8 as theDefault character encoding and if you de-select "Auto-detect file encoding when possible", it should expose the BOM character from any improperly saved files so you can get rid of it permanently.