AttributedText

Text with styles.

Modulerequire("gui")
TypeClass

On Windows, due to the limitations of GdiPlus, it is only supported to change the whole text's color and font, i.e. the SetFontFor and SetColorFor APIs are unsupported.

Class methods

create(text, attributes)

Create an AttributedText.

Parameters

Return

AttributedText

Methods

setFormat(format)

Overwrite styles with format.

Parameters

getFormat()

Return current styles.

Return

TextFormat

setFont(font)

Set the whole text's font.

Parameters

setFontFor(font, start, end) macOS Linux

Set the font of text between character range [start, end). Passing -1 as end means the rest of the text.

Parameters

setColor(color)

Set the whole text's color.

Parameters

setColorFor(font, start, end) macOS Linux

Set the color of text between character range [start, end). Passing -1 as end means the rest of the text.

Parameters

clear()

Reset font and color to system default.

getBoundsFor(size)

Return the bounds required to draw the text within size.

Parameters

Return

RectF

setText(text)

Change the text content.

Parameters

getText()

Return the plain text.

Return

String