Label

Displays plain text in a line or wrapped inside a rectangle. For formatted text, use RichTextLabel.

Label displays plain text on the screen. It gives you control over the horizontal and vertical alignment and can wrap the text inside the node's bounding rectangle. It doesn't support bold, italics, or other formatting. For that, use RichTextLabel instead. Note: Contrarily to most other Controls, Label's Control.mouseFilter defaults to constant Control.MOUSE_FILTER_IGNORE (i.e. it doesn't react to mouse input events). This implies that a label won't display any configured Control.hintTooltip, unless you change its mouse filter.

@GodotBaseClass
struct Label {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

Align
enum Align
Constants
enum Constants
VAlign
enum VAlign

Functions

getAlign
Label.Align getAlign()
getLineCount
long getLineCount()

Returns the amount of lines of text the Label has.

getLineHeight
long getLineHeight()

Returns the font size in pixels.

getLinesSkipped
long getLinesSkipped()
getMaxLinesVisible
long getMaxLinesVisible()
getPercentVisible
double getPercentVisible()
getText
String getText()
getTotalCharacterCount
long getTotalCharacterCount()

Returns the total number of printable characters in the text (excluding spaces and newlines).

getValign
Label.VAlign getValign()
getVisibleCharacters
long getVisibleCharacters()
getVisibleLineCount
long getVisibleLineCount()

Returns the number of lines shown. Useful if the Label's height cannot currently display all lines.

hasAutowrap
bool hasAutowrap()
isClippingText
bool isClippingText()
isUppercase
bool isUppercase()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(Label other)
opEquals
bool opEquals(typeof(null) n)
setAlign
void setAlign(long _align)
setAutowrap
void setAutowrap(bool enable)
setClipText
void setClipText(bool enable)
setLinesSkipped
void setLinesSkipped(long lines_skipped)
setMaxLinesVisible
void setMaxLinesVisible(long lines_visible)
setPercentVisible
void setPercentVisible(double percent_visible)
setText
void setText(String text)
setUppercase
void setUppercase(bool enable)
setValign
void setValign(long valign)
setVisibleCharacters
void setVisibleCharacters(long amount)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

_align
Label.Align _align [@property getter]
long _align [@property setter]

Controls the text's horizontal align. Supports left, center, right, and fill, or justify. Set it to one of the _align constants.

autowrap
bool autowrap [@property getter]
bool autowrap [@property setter]

If true, wraps the text inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text.

clipText
bool clipText [@property getter]
bool clipText [@property setter]

If true, the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.

linesSkipped
long linesSkipped [@property getter]
long linesSkipped [@property setter]

The node ignores the first lines_skipped lines before it starts to display text.

maxLinesVisible
long maxLinesVisible [@property getter]
long maxLinesVisible [@property setter]

Limits the lines of text the node shows on screen.

percentVisible
double percentVisible [@property getter]
double percentVisible [@property setter]

Limits the amount of visible characters. If you set percent_visible to 0.5, only up to half of the text's characters will display on screen. Useful to animate the text in a dialog box.

text
String text [@property getter]
String text [@property setter]

The text to display on screen.

uppercase
bool uppercase [@property getter]
bool uppercase [@property setter]

If true, all the text displays as UPPERCASE.

valign
Label.VAlign valign [@property getter]
long valign [@property setter]

Controls the text's vertical align. Supports top, center, bottom, and fill. Set it to one of the valign constants.

visibleCharacters
long visibleCharacters [@property getter]
long visibleCharacters [@property setter]

Restricts the number of characters to display. Set to -1 to disable.

Static functions

_new
Label _new()

Construct a new instance of Label. Note: use memnew!Label instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta