.. default-domain:: java .. highlight:: java .. package:: krpc.client.services.UI Text ==== .. type:: public class Text A text label. Added to a :type:`Canvas` or a :type:`Panel`. .. method:: RectTransform getRectTransform() The rect transform for the UI object. .. method:: LayoutElement getLayoutElement() How much space the UI object asks a layout for. .. 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. .. method:: boolean getVisible() .. method:: void setVisible(boolean value) Whether the UI object is visible. .. 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. .. method:: String getContent() .. method:: void setContent(String value) The text string .. method:: boolean getWordWrap() .. method:: void setWordWrap(boolean 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. .. method:: String getFont() .. method:: void setFont(String value) Name of the font .. note:: Empty if the game provided no font to draw the text with, in which case it is not drawn. See :meth:`Text.getAvailableFonts()` for the names that can be set. .. method:: java.util.List getAvailableFonts() A list of all available fonts. .. method:: int getSize() .. method:: void setSize(int value) Font size. .. method:: FontStyle getStyle() .. method:: void setStyle(FontStyle value) Font style. .. method:: StdLib.ColorRGBA getColor() .. method:: void setColor(StdLib.ColorRGBA value) The color the text is drawn in. .. method:: TextAnchor getAlignment() .. method:: void setAlignment(TextAnchor value) Alignment. .. method:: float getLineSpacing() .. method:: void setLineSpacing(float value) Line spacing. .. method:: void remove() Remove the UI object. .. type:: public enum FontStyle Font style. .. field:: public FontStyle NORMAL Normal. .. field:: public FontStyle BOLD Bold. .. field:: public FontStyle ITALIC Italic. .. field:: public FontStyle BOLD_AND_ITALIC Bold and italic. .. type:: public enum TextAlignment Text alignment. .. field:: public TextAlignment LEFT Left aligned. .. field:: public TextAlignment RIGHT Right aligned. .. field:: public TextAlignment CENTER Center aligned. .. type:: public enum TextAnchor Text alignment. .. field:: public TextAnchor LOWER_CENTER Lower center. .. field:: public TextAnchor LOWER_LEFT Lower left. .. field:: public TextAnchor LOWER_RIGHT Lower right. .. field:: public TextAnchor MIDDLE_CENTER Middle center. .. field:: public TextAnchor MIDDLE_LEFT Middle left. .. field:: public TextAnchor MIDDLE_RIGHT Middle right. .. field:: public TextAnchor UPPER_CENTER Upper center. .. field:: public TextAnchor UPPER_LEFT Upper left. .. field:: public TextAnchor UPPER_RIGHT Upper right.