Home  Contents

gcx:textformat

Graphics Core4 Lua Commands

SYNOPSIS

  1. gcx:textformat(newflags)
  2. flags = gcx:textformat()

DESCRIPTION

If specified, newflags sets up the default flags string used by the command gcx:text(). The default flags are processed by the text output function before any specific flags that where passed to gcx:text() are processed.

With no arguments, returns the default flags currently configured or nil.

By explicitly passing nil for newflags, the default flags are cleared.

The newflags parameter is expected to be a string. Each character in newflags modifies the behaviour of the text drawing:

Alignment flags
't' Top alignment
'b' Bottom alignment
'l' Left alignment
'r' Right alignment
'c' In combination with 't' or 'b': horizontally centered. In combination with 'l' or 'r': vertically centered. To center in both directions, give two 'c' characters.
Word-wise alignment
'w' Automatically word-wrap the text inside the given horizontal width.
'j' Justified text, implies word-wrap.
Text parsing
'J' Perform arabic joining.
'A' Any ASCII digits that are encountered within arabic text are converted to arabic numerals.
'R' Default rendering direction is Right-To-Left.
'L' Default rendering direction is Left-To-Right.

Any of the letter 'J', 'A', 'R' or 'L' will cause the text to be processed by the bidirectional algorithm. See string.utf8bidi() for more information.

RETURN VALUE

The default text format flags string or nil if no default is set.

ERRORS

Raises an error if gcx is not a graphics context.

SEE ALSO