The Torque engine has a nice markup language TorqueML (see below, copied from a post in the garagegames forum). It makes it possible to incorporate some simple layout and format information in pure text, which can be used to build a text widget for help, or dialogs, in a game.
I would like to know if one can suggest a most efficient way to build/get the same feature in Haxe (especially within the HaxeFlixel framework).
Here is the markup language info available in Torque, for reference:
<font:fontName:fontSize> - sets the font and fontsize as indicated. Example: <font:Arial Bold:20>
<tag:???> - not sure what this does
<color:rrggbb> - sets text color in hex format. Example: <color:ff0000> will display red text
<bitmap:filePath> - displays a bitmap image indicated by the file path. Example: <bitmap:demo/client/ui/seperator>
<spush> - saves the current text formatting so that temporary changes to formatting can be made. Used with spop.
<spop> - restores the previously saved text formatting. Used with spush. See the file "3. Gui Editor.hlf" included with the TGE demo for an example of usage.
<sbreak> - not sure what this does
<just:left> - left justify
<just:right> - right justify
<just:center> - center justify
<a:ExternalURL>LinkTitle</a> - inserts a hyperlink into the text which will open the user's browser.
The external URL does not need the "http://" format. Example: <a:www.garagegames.com>Garage Games Website</a>
<lmargin: ##> - sets the left margin
<lmargin%: ##> - sets the left margin (not sure what the % does)
<rmargin: ##> - sets the right margin
<rmargin%: ##> - sets the right margin (not sure what the % does)
<clip:> - not sure what this does
<div:> - not sure what this does
<tab:##(,##,etc)> - sets the tab stops (multiple tabs are separated by commas)
- Breaks the current line and begins a new one.
As a starting point, there is a rudimentary function already available in HaxeFlixel's FlxText.hx that lets you apply simple markup:
https://github.com/HaxeFlixel/flixel/blob/dev/flixel/text/FlxText.hx#L274