Text#
- public class Text#
A text label. Added to a
Canvasor aPanel.- RectTransform getRectTransform()#
The rect transform for the UI object.
- 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.
- boolean getVisible()#
- 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.
- boolean getWordWrap()#
- 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.
- 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
Text.getAvailableFonts()for the names that can be set.
- int getSize()#
- void setSize(int value)#
Font size.
- TextAnchor getAlignment()#
- void setAlignment(TextAnchor value)#
Alignment.
- float getLineSpacing()#
- void setLineSpacing(float value)#
Line spacing.
- void remove()#
Remove the UI object.
- public enum FontStyle#
Font style.
- public enum TextAlignment#
Text alignment.
- public TextAlignment LEFT#
Left aligned.
- public TextAlignment RIGHT#
Right aligned.
- public TextAlignment CENTER#
Center aligned.
- public enum TextAnchor#
Text alignment.
- public TextAnchor LOWER_CENTER#
Lower center.
- public TextAnchor LOWER_LEFT#
Lower left.
- public TextAnchor LOWER_RIGHT#
Lower right.
- public TextAnchor MIDDLE_CENTER#
Middle center.
- public TextAnchor MIDDLE_LEFT#
Middle left.
- public TextAnchor MIDDLE_RIGHT#
Middle right.
- public TextAnchor UPPER_CENTER#
Upper center.
- public TextAnchor UPPER_LEFT#
Upper left.
- public TextAnchor UPPER_RIGHT#
Upper right.