.. default-domain:: lua .. highlight:: lua .. currentmodule:: UI Text ==== .. class:: Text A text label. Added to a :class:`UI.Canvas` or a :class:`UI.Panel`. .. attribute:: rect_transform: UI.RectTransform The rect transform for the UI object. :Attribute: Read-only, cannot be set :rtype: :class:`UI.RectTransform` .. attribute:: layout_element: UI.LayoutElement How much space the UI object asks a layout for. :Attribute: Read-only, cannot be set :rtype: :class:`UI.LayoutElement` .. note:: Only has an effect when the object is in a panel that has a layout. A canvas is not inside a layout and does not have one. .. attribute:: visible: boolean Whether the UI object is visible. :Attribute: Can be read or written :rtype: boolean .. note:: This is the object's own setting, which is what it was last set to. An object is only drawn when everything it is inside is visible as well, so an interface can be built with its parts visible, inside a panel that is not, and shown all at once by making that panel visible. .. attribute:: content: string The text string :Attribute: Can be read or written :rtype: string .. 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 :rtype: boolean .. attribute:: font: string Name of the font :Attribute: Can be read or written :rtype: string .. 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 :rtype: List .. attribute:: size: number Font size. :Attribute: Can be read or written :rtype: number .. attribute:: style: UI.FontStyle Font style. :Attribute: Can be read or written :rtype: :class:`UI.FontStyle` .. attribute:: color: StdLib.ColorRGBA The color the text is drawn in. :Attribute: Can be read or written :rtype: :class:`StdLib.ColorRGBA` .. attribute:: alignment: UI.TextAnchor Alignment. :Attribute: Can be read or written :rtype: :class:`UI.TextAnchor` .. attribute:: line_spacing: number Line spacing. :Attribute: Can be read or written :rtype: number .. method:: remove() Remove the UI object. .. 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.