render_text - Convert a format string to a new video object.
vid, lineheights, width, height, ascent
render_text(
dststore, message, vspacing, tspacing,
tabs )
Render a format string into a texture assigned to a new video object. Return
this object along with a table of individual line-heights. The optional
dststore can be used to update a previous result from render_text,
which cuts down on costs for dynamic allocation and recreating or rebuilding
related vid hierarchies, with the caveat that custom texture coordinates from
cropping and similar operations may still need to be reapplied. Render
behavior varies with the type of message , which can be string or a
n-indexed table of strings. Anything else is a terminal state transition. If
message is a string, all contents will be treated as a format string
which is dangerous with user supplied content as escaping and dynamic string
construction is costly. If message is a table of strings, strings at
odd indices will be treated as format strings and even indices are treated as
raw UTF 8. Vspacing indicates the default padding between lines, and
tspacing the horizontal spacing between tabs. If vspacing is set to nil
or 0, the added padding will be taken from the font. Each formatting sequence
is initiated with a single backslash, followed with a command code (see table
below). Stateful commands (b, i, u) can be negated with a preluding
exclamation point.
- 1
- Some format string states carry over between render_text calls, such as
the currently active font/size (to cut down on ontfile.ttf,num style
preludes.
- 2
- returned width and height does not necessarily match the values returned
by text_dimensions
- 3
- Pfname,w,h function clamp to a built in limit (typically 256x256).