Game Development Community

T2D TextObject problem

by Alexandre Ribeiro de Sa · in Torque Game Builder · 05/19/2007 (11:21 pm) · 8 replies

Hi, I have a small problem with T2D text object (not the gui text object), if I write some text with special characters in level editor it works, but if I try to change the text in tgb script with object.text the text don't work...

Anyone know anything about this problem?!


Thanks

#1
05/20/2007 (2:02 am)
You need to replace the font with one that is not fixed to english characters only
#2
05/20/2007 (10:04 am)
Marc, there a bug in this forum if I try to write some text with a special character (I wrote some in example)...
The broblem is, if I write on level editor the text work, but if I use the setText it not... :-/
#3
05/20/2007 (10:17 am)
*EDIT*

Misread your post.
#4
05/20/2007 (1:37 pm)
Just realized that I didn't fully read the posting :-(

How are you sending the text to setText?
Any chance for a simple sample code?
#5
05/21/2007 (7:00 am)
Are you using the Torsion? You should be aware that Torsion doesn't support unicode.
You may use file IO and hold you strings in this files encoded in UTF-8.
#6
05/22/2007 (12:03 pm)
Marc:
object.texto = "isso nao e um teste";   // out: isso n[]o [] um teste
note A from nao has a "~", e has a "'"...
Igor:
I know, I read it in another topic, I'm using context to write my code now...
#7
05/22/2007 (10:37 pm)
You get strange results )
I've use this approach to draw cyrillic symbols.
For example:
%this.test = new t2dTextObject() 
      {
         scenegraph = "scn011aScene";
         canSaveDynamicFields = "1";
         size = "200 50";
         text = "This is a text"; // changes next time
         font = "Arial";
         wordWrap = "0";
         hideOverflow = "1";
         textAlign = "Left";
         lineHeight = "50";
         aspectRatio = "1";
         lineSpacing = "0";
         characterSpacing = "0";
         autoSize = "1";
         fontSizes = "80";
         textColor = "1 1 1 1";
         hideOverlap = "0";
      };

and use:
%file = new FileObject();
   %file.OpenForRead("data/scenario/scn011a/quest/text/t1.txt");
   %file.readLine(); // junk from M$ UTF-8
   %loaded = %file.readLine();
   %this.test.text = %loaded;
#8
05/23/2007 (6:48 pm)
Igor, read from file works :)
You know if can I use a XML file from tgb 1.5 beta too!?