.. default-domain:: js .. highlight:: js .. module:: UI :no-index: 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`: :meth:`getRectTransform `, :meth:`getLayoutElement `, :meth:`getVisible `, :meth:`setVisible `, :meth:`remove ` .. method:: getContent() setContent(value) The text string :Property: Can be read or written :rtype: ``string`` .. method:: getWordWrap() setWordWrap(value) 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. :Property: Can be read or written :rtype: ``boolean`` .. method:: getFont() setFont(value) Name of the font :Property: 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 :meth:`UI.Text.getAvailableFonts` for the names that can be set. .. method:: getAvailableFonts() A list of all available fonts. :Property: Read-only, cannot be set :rtype: ``Array`` of ``string`` .. method:: getSize() setSize(value) Font size. :Property: Can be read or written :rtype: ``number`` .. method:: getStyle() setStyle(value) Font style. :Property: Can be read or written :rtype: :class:`UI.FontStyle` .. method:: getColor() setColor(value) The color the text is drawn in. :Property: Can be read or written :rtype: :class:`StdLib.ColorRGBA` .. method:: getAlignment() setAlignment(value) Alignment. :Property: Can be read or written :rtype: :class:`UI.TextAnchor` .. method:: getLineSpacing() setLineSpacing(value) Line spacing. :Property: Can be read or written :rtype: ``number`` .. class:: FontStyle Font style. .. attribute:: normal Normal. .. attribute:: bold Bold. .. attribute:: italic Italic. .. attribute:: boldAndItalic Bold and italic. .. class:: TextAlignment Text alignment. .. attribute:: left Left aligned. .. attribute:: right Right aligned. .. attribute:: center Center aligned. .. class:: TextAnchor Text alignment. .. attribute:: lowerCenter Lower center. .. attribute:: lowerLeft Lower left. .. attribute:: lowerRight Lower right. .. attribute:: middleCenter Middle center. .. attribute:: middleLeft Middle left. .. attribute:: middleRight Middle right. .. attribute:: upperCenter Upper center. .. attribute:: upperLeft Upper left. .. attribute:: upperRight Upper right.