2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-02-01 01:03:48 +00:00
<class name= "Label" inherits= "Control" version= "4.0" >
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.
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 >
2020-08-12 11:49:10 +00:00
<method name= "clear_opentype_features" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2020-08-12 11:49:10 +00:00
<description >
Removes all OpenType features.
</description>
</method>
2017-09-12 20:42:36 +00:00
<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" />
<argument index= "0" name= "line" type= "int" default= "-1" />
2020-08-12 11:49:10 +00:00
<description >
Returns the height of the line [code]line[/code].
2021-03-18 11:04:28 +00:00
If [code]line[/code] is set to [code]-1[/code], returns the biggest line height.
2020-08-12 11:49:10 +00:00
If there're no lines returns font size in pixels.
</description>
</method>
<method name= "get_opentype_feature" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
<argument index= "0" name= "tag" type= "String" />
2017-09-12 20:42:36 +00:00
<description >
2020-08-12 11:49:10 +00:00
Returns OpenType feature [code]tag[/code].
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>
2020-08-12 11:49:10 +00:00
<method name= "set_opentype_feature" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
<argument index= "0" name= "tag" type= "String" />
<argument index= "1" name= "value" type= "int" />
2020-08-12 11:49:10 +00:00
<description >
Returns OpenType feature [code]tag[/code]. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url].
</description>
</method>
2017-09-12 20:42:36 +00:00
</methods>
<members >
2021-07-04 14:43:55 +00:00
<member name= "autowrap_mode" type= "int" setter= "set_autowrap_mode" getter= "get_autowrap_mode" enum= "Label.AutowrapMode" default= "0" >
If set to something other than [constant 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 [enum AutowrapMode].
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>
2021-11-25 02:58:47 +00:00
<member name= "horizontal_alignment" type= "int" setter= "set_horizontal_alignment" getter= "get_horizontal_alignment" enum= "HorizontalAlignment" default= "0" >
Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the [enum HorizontalAlignment] constants.
</member>
2020-08-12 11:49:10 +00:00
<member name= "language" type= "String" setter= "set_language" getter= "get_language" default= """" >
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
</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 19:38:49 +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.
2021-12-05 12:28:32 +00:00
[b]Note:[/b] Setting this property updates [member visible_characters] based on current [method get_total_character_count].
2017-09-12 20:42:36 +00:00
</member>
2021-12-02 19:38:49 +00:00
<member name= "size_flags_vertical" type= "int" setter= "set_v_size_flags" getter= "get_v_size_flags" overrides= "Control" default= "4" />
2020-08-12 11:49:10 +00:00
<member name= "structured_text_bidi_override" type= "int" setter= "set_structured_text_bidi_override" getter= "get_structured_text_bidi_override" enum= "Control.StructuredTextParser" default= "0" >
Set BiDi algorithm override for the structured text.
</member>
2019-09-24 17:45:03 +00:00
<member name= "structured_text_bidi_override_options" type= "Array" setter= "set_structured_text_bidi_override_options" getter= "get_structured_text_bidi_override_options" default= "[]" >
2020-08-12 11:49:10 +00:00
Set additional options for BiDi override.
</member>
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>
2020-08-12 11:49:10 +00:00
<member name= "text_direction" type= "int" setter= "set_text_direction" getter= "get_text_direction" enum= "Control.TextDirection" default= "0" >
Base text writing direction.
</member>
2021-07-04 14:43:55 +00:00
<member name= "text_overrun_behavior" type= "int" setter= "set_text_overrun_behavior" getter= "get_text_overrun_behavior" enum= "Label.OverrunBehavior" default= "0" >
Sets the clipping behavior when the text exceeds the node's bounding rectangle. See [enum OverrunBehavior] for a description of all modes.
</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>
2021-11-25 02:58:47 +00:00
<member name= "vertical_alignment" type= "int" setter= "set_vertical_alignment" getter= "get_vertical_alignment" enum= "VerticalAlignment" default= "0" >
Controls the text's vertical alignment. Supports top, center, bottom, and fill. Set it to one of the [enum VerticalAlignment] 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.
2021-12-05 12:28:32 +00:00
[b]Note:[/b] Setting this property updates [member percent_visible] based on current [method get_total_character_count].
</member>
<member name= "visible_characters_behavior" type= "int" setter= "set_visible_characters_behavior" getter= "get_visible_characters_behavior" enum= "Label.VisibleCharactersBehavior" default= "0" >
Sets the clipping behavior when [member visible_characters] or [member percent_visible] is set. See [enum VisibleCharactersBehavior] for more info.
2018-01-11 22:38:35 +00:00
</member>
2017-09-12 20:42:36 +00:00
</members>
<constants >
2021-07-04 14:43:55 +00:00
<constant name= "AUTOWRAP_OFF" value= "0" enum= "AutowrapMode" >
Autowrap is disabled.
</constant>
<constant name= "AUTOWRAP_ARBITRARY" value= "1" enum= "AutowrapMode" >
Wraps the text inside the node's bounding rectangle by allowing to break lines at arbitrary positions, which is useful when very limited space is available.
</constant>
<constant name= "AUTOWRAP_WORD" value= "2" enum= "AutowrapMode" >
Wraps the text inside the node's bounding rectangle by soft-breaking between words.
</constant>
<constant name= "AUTOWRAP_WORD_SMART" value= "3" enum= "AutowrapMode" >
Behaves similarly to [constant AUTOWRAP_WORD], but force-breaks a word if that single word does not fit in one line.
</constant>
<constant name= "OVERRUN_NO_TRIMMING" value= "0" enum= "OverrunBehavior" >
No text trimming is performed.
</constant>
<constant name= "OVERRUN_TRIM_CHAR" value= "1" enum= "OverrunBehavior" >
Trims the text per character.
</constant>
<constant name= "OVERRUN_TRIM_WORD" value= "2" enum= "OverrunBehavior" >
Trims the text per word.
</constant>
<constant name= "OVERRUN_TRIM_ELLIPSIS" value= "3" enum= "OverrunBehavior" >
Trims the text per character and adds an ellipsis to indicate that parts are hidden.
</constant>
<constant name= "OVERRUN_TRIM_WORD_ELLIPSIS" value= "4" enum= "OverrunBehavior" >
Trims the text per word and adds an ellipsis to indicate that parts are hidden.
</constant>
2021-12-05 12:28:32 +00:00
<constant name= "VC_CHARS_BEFORE_SHAPING" value= "0" enum= "VisibleCharactersBehavior" >
Trims text before the shaping. e.g, increasing [member visible_characters] value is visually identical to typing the text.
</constant>
<constant name= "VC_CHARS_AFTER_SHAPING" value= "1" enum= "VisibleCharactersBehavior" >
Displays glyphs that are mapped to the first [member visible_characters] characters from the beginning of the text.
</constant>
<constant name= "VC_GLYPHS_AUTO" value= "2" enum= "VisibleCharactersBehavior" >
Displays [member percent_visible] glyphs, starting from the left or from the right, depending on [member Control.layout_direction] value.
</constant>
<constant name= "VC_GLYPHS_LTR" value= "3" enum= "VisibleCharactersBehavior" >
Displays [member percent_visible] glyphs, starting from the left.
</constant>
<constant name= "VC_GLYPHS_RTL" value= "4" enum= "VisibleCharactersBehavior" >
Displays [member percent_visible] glyphs, starting from the right.
</constant>
2017-09-12 20:42:36 +00:00
</constants>
<theme_items >
2021-08-04 16:54:41 +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-04 16:54:41 +00:00
<theme_item name= "font_outline_color" data_type= "color" type= "Color" default= "Color(1, 1, 1, 1)" >
2020-09-03 11:22:16 +00:00
The tint of [Font]'s outline.
2018-05-12 07:38:00 +00:00
</theme_item>
2021-08-04 16:54:41 +00:00
<theme_item name= "font_shadow_color" data_type= "color" type= "Color" default= "Color(0, 0, 0, 0)" >
2020-12-08 13:11:45 +00:00
[Color] of the text's shadow effect.
</theme_item>
2021-08-04 16:54:41 +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-04 16:54:41 +00:00
<theme_item name= "outline_size" data_type= "constant" type= "int" default= "0" >
2020-08-12 11:49:10 +00:00
Text outline size.
2017-09-12 20:42:36 +00:00
</theme_item>
2021-08-04 16:54:41 +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-04 16:54:41 +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-08-04 16:54:41 +00:00
<theme_item name= "shadow_outline_size" data_type= "constant" type= "int" default= "1" >
2021-11-05 22:28:48 +00:00
The size of the shadow outline.
2020-08-12 11:49:10 +00:00
</theme_item>
2021-12-01 18:02:20 +00:00
<theme_item name= "font" data_type= "font" type= "Font" >
[Font] used for the [Label]'s text.
</theme_item>
<theme_item name= "font_size" data_type= "font_size" type= "int" >
Font size of 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>