Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
Label¶
Inherits: Control < CanvasItem < Node < Object
A control for displaying plain text.
Description¶
A control for displaying plain text. 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 rich text formatting. For that, use RichTextLabel instead.
Tutorials¶
Properties¶
|
||
|
||
|
||
BitField<JustificationFlag> |
|
|
|
||
|
||
|
||
mouse_filter |
|
|
BitField<SizeFlags> |
size_flags_vertical |
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
get_line_count ( ) const |
|
get_line_height ( int line=-1 ) const |
|
get_total_character_count ( ) const |
|
get_visible_line_count ( ) const |
Theme Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Property Descriptions¶
AutowrapMode autowrap_mode = 0
void set_autowrap_mode ( AutowrapMode value )
AutowrapMode get_autowrap_mode ( )
If set to something other than TextServer.AUTOWRAP_OFF, the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text. To see how each mode behaves, see AutowrapMode.
bool clip_text = false
If true
, the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
HorizontalAlignment horizontal_alignment = 0
void set_horizontal_alignment ( HorizontalAlignment value )
HorizontalAlignment get_horizontal_alignment ( )
Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the HorizontalAlignment constants.
BitField<JustificationFlag> justification_flags = 163
void set_justification_flags ( BitField<JustificationFlag> value )
BitField<JustificationFlag> get_justification_flags ( )
Line fill alignment rules. For more info see JustificationFlag.
LabelSettings label_settings
void set_label_settings ( LabelSettings value )
LabelSettings get_label_settings ( )
A LabelSettings resource that can be shared between multiple Label nodes. Takes priority over theme properties.
String language = ""
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
int lines_skipped = 0
The number of the lines ignored and not displayed from the start of the text value.
int max_lines_visible = -1
Limits the lines of text the node shows on screen.
StructuredTextParser structured_text_bidi_override = 0
void set_structured_text_bidi_override ( StructuredTextParser value )