Label
Inherits: Control < CanvasItem < Node < Object RichTextLabel.
Description
RichTextLabel instead.
Note: Contrarily to most other Controls, Label’s Control.mouse_filter defaults to 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.hint_tooltip, unless you change its mouse filter.
Note: Unicode characters after 0xffff (such as most emoji) are not supported on Windows. They will display as unknown characters instead. This will be resolved in Godot 4.0.
Tutorials
- 2D Dodge The Creeps Demo
Properties
Methods
Theme Properties
Enumerations
Align: - ALIGN_LEFT = 0 —- Align rows to the left (default).
- ALIGN_CENTER = 1 —- Align rows centered.
- ALIGN_RIGHT = 2 —- Align rows to the right.
- ALIGN_FILL = 3 —- Expand row whitespaces to fit the width.
VAlign:
- VALIGN_TOP = 0 —- Align the whole text to the top.
- VALIGN_CENTER = 1 —- Align the whole text to the center.
- VALIGN_BOTTOM = 2 —- Align the whole text to the bottom.
- VALIGN_FILL = 3 —- Align the whole text by spreading the rows.
Property Descriptions
- Align align Align constants.
- bool autowrap
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.
- bool clip_text
true, the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
- int lines_skipped
lines_skippedlines before it starts to display text.
- int max_lines_visible Limits the lines of text the node shows on screen.
- float percent_visible
percent_visibleto 0.5, only up to half of the text’s characters will display on screen. Useful to animate the text in a dialog box.
- String text The text to display on screen.
- bool uppercase
true, all the text displays as UPPERCASE.
- VAlign valign VAlign constants.
- int visible_characters
Restricts the number of characters to display. Set to -1 to disable.
Method Descriptions
- int get_line_count ( ) const Returns the amount of lines of text the Label has.
- int get_line_height ( ) const Returns the font size in pixels.
- int get_total_character_count ( ) const Returns the total number of printable characters in the text (excluding spaces and newlines).
- int get_visible_line_count ( ) const
Label‘s height cannot currently display all lines.Theme Property Descriptions
- Font font
Font used for the
Label‘s text.
- Color font_color
Color of the
Label.
- Color font_color_shadow Color of the text’s shadow effect.
- Color font_outline_modulate Font‘s outline. See DynamicFont.outline_color.
- int line_spacing
Label.
- StyleBox normal
StyleBox for the
Label.
- int shadow_as_outline
true), the shadow will be displayed around the whole text as an outline.
- int shadow_offset_x The horizontal offset of the text’s shadow.
- int shadow_offset_y The vertical offset of the text’s shadow.
