Page tree
Skip to end of metadata
Go to start of metadata

Description:

Structured text is a subset of HTML tags, to allow some formatting within hint messages and Dialogs StructuredText.
(While structured text may look similar to the format supported by HTML file, these two are not interchangeable!)

In order for the formatting tags described below to be interpreted, they must be parsed with the parseText command. Unparsed, they are still structured text, but will be displayed in their "source" format, e.g. if we had a Dialogs StructuredText, which will only accept structured text, we could use the following methods:

_ctrlStructText = (findDisplay 20000) displayCtrl 20000; // this is our structured text control

// this would generate an error, as "hello" is just a regular string.
ctrlStructText ctrlSetStructuredText "hello"; 

// this would work (and display "hello"), as the command 'text' converts a string into structured text
ctrlStructText ctrlSetStructuredText text "hello"; 

// the passed string would be displayed as "<t color='#FF0000'>RED</t>", since it isn't parsed
ctrlStructText ctrlSetStructuredText text "<t color='#FF0000'>RED</t>"; 

// the passed string would now be displayed as "RED" (in red color), as parseText interpreted our formatting tag
ctrlStructText ctrlSetStructuredText parseText "<t color='#FF0000'>RED</t>"; 


Related commands: parseText, composeText, ctrlSetStructuredText, hint, hintC

Examples

Output the image on the left.

_text = "
Line 1<br />Line 2<br />
<t size='1.5'>Hello <t color='#ff0000'>World</t></t><br />
<img image='\vbs2\weapons\Launchers\m136_at4\data\equip\w_m136_ca' size='4' /><br />
Jack &amp; Jill<br />
He said &quot;Really?&quot;<br />
Linebreak is &lt;br /&gt;<br /><br />
<t align='center'>Centered</t><br />
<t color='#ff7f00'>Orange Text &amp; Orange Image</t><br />
<img color='#ff7f00' image='\vbs2\weapons\Launchers\m136_at4\data\equip\w_m136_ca' size='4'/><br />
<t font='vbs2_markings_stencil'>vbs2_markings_stencil</t><br />
<t shadow='true'>Text &amp; Image Shadow</t><br />
<img shadow='true' image='\vbs2\weapons\Launchers\m136_at4\data\equip\w_m136_ca' size='4'/><br />
<t shadow='true' shadowColor='#0000ff'>Blue Shadow</t><br />
<t size='2'>Twice as Big</t><br />
<t underline='true'>Very Important</t><br />
10<t size='0.8' valign='top'>4</t> is Top-Aligned
";
"Structured Text" hintC parseText format["Formatting examples<br />%1",_text];

Output all available font styles (as shown under font):

_text = format["in version %1:<br />",versionNumber];
_fonts = configFile>>"CfgFontFamilies";
for "_i" from 0 to (count _fonts)-1 do {
    _font = _fonts select _i;
    if (isClass _font) then {
        _text = format["%1<t font='%2'>%2</t><br />",_text,configName _font]; 
    };
};
"Available Fonts" hintC parseText (_text+"</t>");


Tags

Tags can be written in two ways: either as a separate opening and closing tag (e.g. <t size='2'>text</t>) or as a single tag with the closing slash in it (e.g. <img image='cat.jpg' />).
Since the text between the opening and closing parts is not interpreted in <br /> and <img /> tags, they are normally written in the shorthand version.

<br>

Line break. (Can also be inserted via the lineBreak command.)

"Line 1<br />Line 2"

<img>

Display image (can also be inserted via the image command]]).
Image name is defined via the "image" attribute, which can contain a path.

"<img image='images\picture.jpg' />"

Be aware the the hint/hintC command will not display just an image - it has to be either preceded or followed by a string (which can be a blank space):

hint parseText "<img image='\vbs2\ui\data\flag_bluefor_co' />"; // will NOT work
hint parseText "<img image='\vbs2\ui\data\flag_bluefor_co' /> "; // WILL work (has a trailing space)

<t>

Paragraph delimiter, used to format enclosed text. Can be nested.

"<t size='1.5'>Hello <t color='#ff0000'>World</t></t>"

Special Characters

To output certain characters that would otherwise be interpreted as a command,
they have to be entered in HTML format, e.g. &charactername;.

Ampersand (&)

Entered as &amp;.

"Jack &amp; Jill"

Double quotations (")

Entered as &quot;.

"He said &quot;Really?&quot;"

Greater/smaller sign (><)

Entered as &gt; and &lt;.

"Linebreak is &lt;br /&gt; Jill"


Attributes

The <t> or <img> tags can have one or more of the following attributes.
Single or double quotes can be used for the argument.

align

Specifies the element's left/right alignment.
Argument can be "left", "center" or "right".

"<t align='center'>centered</t>"

color

Specifies text color, or an image overlay color.
Argument is in format "#rrggbb" (red,green,blue).

"<t color='#ff7f00'>orange</t>"

font

Uses a specific font type. Can be:

  • "Bitstream"
  • "Dina" (V1.69+)
  • "Gunplay48"
  • "LucidaConsoleB"
  • "NewsGothicB"
  • "NewsGothicCn"
  • "TahomaB"
  • "vbs2_digital" (V1.50+)
  • "vbs2_digital_uk" (V1.50+)
  • "vbs2_markings_stencil"
  • "VBS_CenturyGothic72"
  • "VBS_CenturyGothicB72"
  • "VBS_CenturyGothicslim72"
  • "vbs_Titillium_25l_400wt_black" (2.15)
  • "vbs_Titillium_25l_600wt_black" (2.15)
  • "vbs_unicode_lite"
  • "vbs_unicode_med"
  • "Zeppelin32"
  • "Zeppelin33"
  • "Zeppelin33Italic"
"<t font='vbs2_markings_stencil'>vbs2_markings_stencil</t>"

See Fonts for more information on available fonts and characters.

shadow

Puts a drop-shadow on either text or image.
Argument is either "true" or "false".
Not available in V2.0+

"<t shadow='true'>Shadowed</t>"

shadowColor

If a shadow is enabled, define its color.
Arguments as for the color.
Not available in V2.0+

"<t shadowColor='#0000ff'>Blue shadow</t>"

size

Size of text or image.
Default size is 1.

"<t size='2'>Twice as big</t>"

underline

Puts a line under the text.
Argument is either "true" or "false".

"<t underline='true'>Important</t>"

valign

Vertical alignment. Used if different sizes are present on the same line.
Argument can be "top", "middle" or "bottom".

"10<t size='0.8' valign='top'>2</t>"