.. default-domain:: lua .. highlight:: lua .. currentmodule:: UI Text ==== .. class:: Text A text label. Added to a :class:`UI.Canvas` or a :class:`UI.Panel`. | Base class: :class:`UI.Object` .. container:: inherited-members .. rubric:: Inherited Members * From :class:`UI.Object`: :attr:`rect_transform `, :attr:`layout_element `, :attr:`visible `, :meth:`remove ` .. attribute:: content: string The text string :Attribute: Can be read or written .. attribute:: word_wrap: boolean Whether the text wraps onto further lines when it is wider than the space it has. Text that does not wrap carries on past the edge, and its preferred size is that of a single line, so a changing value leaves a layout in place. :Attribute: Can be read or written .. attribute:: font: string Name of the font :Attribute: Can be read or written .. note:: Empty if the game provided no font to draw the text with, in which case it is not drawn. See :attr:`UI.Text.available_fonts` for the names that can be set. .. attribute:: available_fonts: List A list of all available fonts. :Attribute: Read-only, cannot be set .. attribute:: size: number Font size. :Attribute: Can be read or written .. attribute:: style: UI.FontStyle Font style. :Attribute: Can be read or written .. attribute:: color: StdLib.ColorRGBA The color the text is drawn in. :Attribute: Can be read or written .. attribute:: alignment: UI.TextAnchor Alignment. :Attribute: Can be read or written .. attribute:: line_spacing: number Line spacing. :Attribute: Can be read or written .. class:: FontStyle Font style. .. data:: normal Normal. .. data:: bold Bold. .. data:: italic Italic. .. data:: bold_and_italic Bold and italic. .. class:: TextAlignment Text alignment. .. data:: left Left aligned. .. data:: right Right aligned. .. data:: center Center aligned. .. class:: TextAnchor Text alignment. .. data:: lower_center Lower center. .. data:: lower_left Lower left. .. data:: lower_right Lower right. .. data:: middle_center Middle center. .. data:: middle_left Middle left. .. data:: middle_right Middle right. .. data:: upper_center Upper center. .. data:: upper_left Upper left. .. data:: upper_right Upper right.