2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-08-05 16:51:38 +00:00
<class name= "Label" inherits= "Control" version= "3.6" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 20:42:36 +00:00
<brief_description >
2017-09-16 09:54:44 +00:00
Displays plain text in a line or wrapped inside a rectangle. For formatted text, use [RichTextLabel].
2017-09-12 20:42:36 +00:00
</brief_description>
<description >
2021-07-23 14:24:57 +00:00
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.
2019-06-21 23:04:47 +00:00
[b]Note:[/b] Contrarily to most other [Control]s, Label's [member Control.mouse_filter] 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 [member Control.hint_tooltip], unless you change its mouse filter.
2021-09-15 16:52:21 +00:00
[b]Note:[/b] Unicode characters after [code]0xffff[/code] (such as most emoji) are [i]not[/i] supported on Windows. They will display as unknown characters instead. This will be resolved in Godot 4.0.
2017-09-12 20:42:36 +00:00
</description>
<tutorials >
2020-10-01 08:34:47 +00:00
<link title= "2D Dodge The Creeps Demo" > https://godotengine.org/asset-library/asset/515</link>
2017-09-12 20:42:36 +00:00
</tutorials>
<methods >
<method name= "get_line_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2017-09-16 09:54:44 +00:00
Returns the amount of lines of text the Label has.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_line_height" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2017-09-16 09:54:44 +00:00
Returns the font size in pixels.
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_total_character_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2018-11-15 11:34:08 +00:00
Returns the total number of printable characters in the text (excluding spaces and newlines).
2017-09-12 20:42:36 +00:00
</description>
</method>
<method name= "get_visible_line_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2017-09-12 20:42:36 +00:00
<description >
2019-06-21 23:04:47 +00:00
Returns the number of lines shown. Useful if the [Label]'s height cannot currently display all lines.
2017-09-12 20:42:36 +00:00
</description>
</method>
</methods>
<members >
2019-06-29 10:38:01 +00:00
<member name= "align" type= "int" setter= "set_align" getter= "get_align" enum= "Label.Align" default= "0" >
2019-12-06 22:09:20 +00:00
Controls the text's horizontal align. Supports left, center, right, and fill, or justify. Set it to one of the [enum Align] constants.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "autowrap" type= "bool" setter= "set_autowrap" getter= "has_autowrap" default= "false" >
2019-06-29 13:24:23 +00:00
If [code]true[/code], 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.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "clip_text" type= "bool" setter= "set_clip_text" getter= "is_clipping_text" default= "false" >
2021-06-26 03:33:00 +00:00
If [code]true[/code], the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "lines_skipped" type= "int" setter= "set_lines_skipped" getter= "get_lines_skipped" default= "0" >
2017-09-16 09:54:44 +00:00
The node ignores the first [code]lines_skipped[/code] lines before it starts to display text.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "max_lines_visible" type= "int" setter= "set_max_lines_visible" getter= "get_max_lines_visible" default= "-1" >
2017-09-16 09:54:44 +00:00
Limits the lines of text the node shows on screen.
2017-09-12 20:42:36 +00:00
</member>
2021-12-02 20:15:17 +00:00
<member name= "mouse_filter" type= "int" setter= "set_mouse_filter" getter= "get_mouse_filter" overrides= "Control" enum= "Control.MouseFilter" default= "2" />
2019-06-29 10:38:01 +00:00
<member name= "percent_visible" type= "float" setter= "set_percent_visible" getter= "get_percent_visible" default= "1.0" >
2020-06-13 21:40:44 +00:00
Limits the amount of visible characters. If you set [code]percent_visible[/code] 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.
2017-09-12 20:42:36 +00:00
</member>
2021-12-02 20:15:17 +00:00
<member name= "size_flags_vertical" type= "int" setter= "set_v_size_flags" getter= "get_v_size_flags" overrides= "Control" default= "4" />
2019-06-29 10:38:01 +00:00
<member name= "text" type= "String" setter= "set_text" getter= "get_text" default= """" >
2017-09-16 09:54:44 +00:00
The text to display on screen.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "uppercase" type= "bool" setter= "set_uppercase" getter= "is_uppercase" default= "false" >
2017-09-16 09:54:44 +00:00
If [code]true[/code], all the text displays as UPPERCASE.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "valign" type= "int" setter= "set_valign" getter= "get_valign" enum= "Label.VAlign" default= "0" >
2019-12-06 22:09:20 +00:00
Controls the text's vertical align. Supports top, center, bottom, and fill. Set it to one of the [enum VAlign] constants.
2017-09-12 20:42:36 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "visible_characters" type= "int" setter= "set_visible_characters" getter= "get_visible_characters" default= "-1" >
2018-01-11 22:38:35 +00:00
Restricts the number of characters to display. Set to -1 to disable.
</member>
2017-09-12 20:42:36 +00:00
</members>
<constants >
2017-11-24 22:16:30 +00:00
<constant name= "ALIGN_LEFT" value= "0" enum= "Align" >
2017-09-12 20:42:36 +00:00
Align rows to the left (default).
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ALIGN_CENTER" value= "1" enum= "Align" >
2017-09-12 20:42:36 +00:00
Align rows centered.
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ALIGN_RIGHT" value= "2" enum= "Align" >
2019-06-21 23:04:47 +00:00
Align rows to the right.
2017-09-12 20:42:36 +00:00
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "ALIGN_FILL" value= "3" enum= "Align" >
2017-09-12 20:42:36 +00:00
Expand row whitespaces to fit the width.
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "VALIGN_TOP" value= "0" enum= "VAlign" >
2017-09-12 20:42:36 +00:00
Align the whole text to the top.
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "VALIGN_CENTER" value= "1" enum= "VAlign" >
2017-09-12 20:42:36 +00:00
Align the whole text to the center.
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "VALIGN_BOTTOM" value= "2" enum= "VAlign" >
2017-09-12 20:42:36 +00:00
Align the whole text to the bottom.
</constant>
2017-11-24 22:16:30 +00:00
<constant name= "VALIGN_FILL" value= "3" enum= "VAlign" >
2017-09-12 20:42:36 +00:00
Align the whole text by spreading the rows.
</constant>
</constants>
<theme_items >
2021-08-06 15:07:21 +00:00
<theme_item name= "font_color" data_type= "color" type= "Color" default= "Color( 1, 1, 1, 1 )" >
2020-01-27 01:15:37 +00:00
Default text [Color] of the [Label].
2017-09-12 20:42:36 +00:00
</theme_item>
2021-08-06 15:07:21 +00:00
<theme_item name= "font_color_shadow" data_type= "color" type= "Color" default= "Color( 0, 0, 0, 0 )" >
2020-01-27 01:15:37 +00:00
[Color] of the text's shadow effect.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-08-06 15:07:21 +00:00
<theme_item name= "font_outline_modulate" data_type= "color" type= "Color" default= "Color( 1, 1, 1, 1 )" >
2020-01-27 01:15:37 +00:00
The tint of [Font]'s outline. See [member DynamicFont.outline_color].
2018-05-12 07:38:00 +00:00
</theme_item>
2021-08-06 15:07:21 +00:00
<theme_item name= "line_spacing" data_type= "constant" type= "int" default= "3" >
2020-01-27 01:15:37 +00:00
Vertical space between lines in multiline [Label].
2017-09-12 20:42:36 +00:00
</theme_item>
2021-08-06 15:07:21 +00:00
<theme_item name= "shadow_as_outline" data_type= "constant" type= "int" default= "0" >
2020-01-27 01:15:37 +00:00
Boolean value. If set to 1 ([code]true[/code]), the shadow will be displayed around the whole text as an outline.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-08-06 15:07:21 +00:00
<theme_item name= "shadow_offset_x" data_type= "constant" type= "int" default= "1" >
2020-01-27 01:15:37 +00:00
The horizontal offset of the text's shadow.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-08-06 15:07:21 +00:00
<theme_item name= "shadow_offset_y" data_type= "constant" type= "int" default= "1" >
2020-01-27 01:15:37 +00:00
The vertical offset of the text's shadow.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-12-01 19:45:12 +00:00
<theme_item name= "font" data_type= "font" type= "Font" >
[Font] used for the [Label]'s text.
</theme_item>
<theme_item name= "normal" data_type= "style" type= "StyleBox" >
Background [StyleBox] for the [Label].
</theme_item>
2017-09-12 20:42:36 +00:00
</theme_items>
</class>