AttributedText

Text with styles.

Modulerequire("yue.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