Text Adjusting by Width in TorqueScript, GUI
by beyond · in Torque Game Engine Advanced · 02/15/2011 (4:24 am) · 3 replies
Hello!
I need to create text dialogs for game-quests
and text in text-field must be adjusting by
width (such as in MS_Word).
I have idea to set precalculated count of spaces
between words, but in most fonts symbols has
different sizes.. It requires pixel-level manipulations..
Afraid, TorqueScript there is no functions in Torque Script
for getting sizes of Font Symbols in pixels...
How to Solve this problem?
Thanks for any help..
Sorry for bad english...
I need to create text dialogs for game-quests
and text in text-field must be adjusting by
width (such as in MS_Word).
I have idea to set precalculated count of spaces
between words, but in most fonts symbols has
different sizes.. It requires pixel-level manipulations..
Afraid, TorqueScript there is no functions in Torque Script
for getting sizes of Font Symbols in pixels...
How to Solve this problem?
Thanks for any help..
Sorry for bad english...
#2
I tried to use GuiMLTextCtrl, but it's not enough...
Result Example with GuiMLTextCtrl using:
"
It_is_Simple_Example
The_Second_Line
The_Third_Line
"
But I Need other Result, like this (with Width Alignment):
"
It_is_Simple_Example
The___Second__Line
The____Third___Line
"
"_" is Space.
How get this Result?
02/16/2011 (4:40 am)
Thanks..I tried to use GuiMLTextCtrl, but it's not enough...
Result Example with GuiMLTextCtrl using:
"
It_is_Simple_Example
The_Second_Line
The_Third_Line
"
But I Need other Result, like this (with Width Alignment):
"
It_is_Simple_Example
The___Second__Line
The____Third___Line
"
"_" is Space.
How get this Result?
#3
03/06/2011 (10:27 pm)
In the GuiMLTextCtrl cpp file, there should be a variable to check if the width is more than certain value, then it will auto newline.
Torque 3D Owner vincent kway
Playware Studios
Change all your text to use GuiMLTextCtrl. It will break to next line if your text is over the width of the text-field.
In the engine\source, there is this GuiMLTextCtrl class that has the value of maximum height needed for the text-field for your text. You just need to expose it using consoleMethod, if you want to get the total height needed for you text-field.
You can also get the font height also, the font height is base on the font you use from your profile.
hope this will help.