Name
TextOut -- output text to a fixed position
Synopsis
TextOut(x, y, text$[, table])
Function
This function outputs the text specified by text$ to the position specified by coordinates x and y. This function has the advantage that you can use Hollywood's special constants as the coordinates (e.g. #CENTER, #BOTTOM...) which is not possible with Print() because the Locate() function does not handle them.

If layers are enabled, this command will add a new layer of the type #TEXTOUT to the layer stack.

Starting with Hollywood 2.5, you can use format tags in the string you pass to TextOut(). Using these tags you can control the font style and color of your text on-the-fly. Format tags always start and end with a square bracket ('['). In case you just want to print a square bracket, you will have to use two square brackets. If there is only one square bracket Hollywood will always expect a format tag. See Format tags for details.

In Hollywood 4.0 the syntax of this function changed slightly. While the old syntax is still supported for compatibility, new scripts should use the new syntax which accepts a table as argument 4. The table can contain the following elements:

Align:
Allows you to specify the text's alignment. The following alignments are currently supported:

#LEFT
Left alignment.

#RIGHT
Right alignment.

#CENTER
Center lines.

#JUSTIFIED
Lay out text in justified lines. (V7.0)

The default value for Align is #LEFT.

WordWrap:
TextOut() can do automatic word-wrapping for you if you specify this additional parameter. You can use this parameter to specify a maximum width for your text. TextOut() will then use word wrapping to make sure that no text runs beyond this limit. If you do not set this argument or set it to 0 (which is also the default), the text will be as wide as it is required.

Encoding:
This argument can be used to specify the character encoding inside text$. This defaults to the text library default encoding as set by SetDefaultEncoding()). See SetDefaultEncoding for details. (V4.7)

Color:
This tag allows you to specify the text color. The color must be provided as an ARGB value. If you do not specify this tag, TextOut() will use the color value that was set using the SetFontColor() command instead. (V5.0)

Furthermore, the optional table argument can also contain one or more of the standard tags for all drawing commands. See Standard draw tags for details.

Note that Hollywood currently only supports standard left-to-right based text aligned on horizontal lines. Right to left and vertical text is currently not supported.

Inputs
x
x position for the text
y
y position for the text
text$
string to output
table
optional: table containing additional configuration parameters (see above) (V4.0)
Example
TextOut(#CENTER, #CENTER, "Hello World!")
WaitLeftMouse
Undo(#TEXTOUT)
The above code prints "Hello World!" in the center of your display. Then it waits for the left mouse button and removes the "Hello World!" from the display.

Show TOC