Declaration;
function render_text(message, [vspace:4], [tspace:64]) => vid, lineheights
This function takes a format string and renders it into an image. The optional arguments vspace and tspace defines how many pixels extra space there should be added between lines and how many pixels each tab should represent.
String format:
Each format character begins with a backslash (\\ escapes).
\b enable bold output
\!b disable bold output
\i enable italic output
\!i disable italic output
\u enable underlined output
\!u disable underlined output
\t insert tab
\n insert newline
\r return caret to beginning of string
\#rrggbb change colour
\presname, embed image (simple)
\Presname,w,h, embed image (scale)
\ffontname,size set font and size
Example use:
Write the text 'test' in bold bright red, with the font resources/fonts/default.ttf
vid, lineheights = render_text("\ffonts/default.ttf,18\#ff0000test);
Deprecations / Planned changes:
The engine currently allows to set a list of tab-spaces, but it is currently not exposed to the Lua API. Future versions will also include a \image command, allowing a static image to be embedded into the final result (emoticons, ...)
Caveats:
If the message string would result in a texture that's too large for the GL subsystem, the engine will forcibly terminate with the offending file:line as its message.