2017-09-12 20:42:36 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2024-02-21 17:51:08 +00:00
<class name= "Label" inherits= "Control" keywords= "text" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 20:42:36 +00:00
<brief_description >
2023-04-30 14:26:09 +00:00
A control for displaying plain text.
2017-09-12 20:42:36 +00:00
</brief_description>
<description >
2023-04-30 14:26:09 +00:00
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.
2017-09-12 20:42:36 +00:00
</description>
<tutorials >
2024-03-25 01:20:59 +00:00
<link title= "2D Dodge The Creeps Demo" > https://godotengine.org/asset-library/asset/2712</link>
2017-09-12 20:42:36 +00:00
</tutorials>
<methods >
2023-10-30 12:30:22 +00:00
<method name= "get_character_bounds" qualifiers= "const" >
<return type= "Rect2" />
<param index= "0" name= "pos" type= "int" />
<description >
2024-09-12 15:47:31 +00:00
Returns the bounding rectangle of the character at position [param pos] in the label's local coordinate system. If the character is a non-visual character or [param pos] is outside the valid range, an empty [Rect2] is returned. If the character is a part of a composite grapheme, the bounding rectangle of the whole grapheme is returned.
2023-10-30 12:30:22 +00:00
</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 >
2022-08-17 22:08:09 +00:00
Returns the number 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" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "line" type= "int" default= "-1" />
2020-08-12 11:49:10 +00:00
<description >
2022-08-12 13:36:48 +00:00
Returns the height of the line [param line].
If [param line] is set to [code]-1[/code], returns the biggest line height.
If there are no lines, returns font size in pixels.
2020-08-12 11:49:10 +00:00
</description>
</method>
2017-09-12 20:42:36 +00:00
<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 >
2022-06-15 08:01:45 +00:00
<member name= "autowrap_mode" type= "int" setter= "set_autowrap_mode" getter= "get_autowrap_mode" enum= "TextServer.AutowrapMode" default= "0" >
If set to something other than [constant 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 [enum TextServer.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>
2023-10-01 10:39:13 +00:00
<member name= "ellipsis_char" type= "String" setter= "set_ellipsis_char" getter= "get_ellipsis_char" default= ""…"" >
Ellipsis character used for text clipping.
</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>
2023-06-15 14:06:22 +00:00
<member name= "justification_flags" type= "int" setter= "set_justification_flags" getter= "get_justification_flags" enum= "TextServer.JustificationFlag" is_bitfield= "true" default= "163" >
2024-07-16 08:36:17 +00:00
Line fill alignment rules. See [enum TextServer.JustificationFlag] for more information.
2023-03-23 09:22:37 +00:00
</member>
2022-06-17 08:05:18 +00:00
<member name= "label_settings" type= "LabelSettings" setter= "set_label_settings" getter= "get_label_settings" >
2022-11-21 02:48:36 +00:00
A [LabelSettings] resource that can be shared between multiple [Label] nodes. Takes priority over theme properties.
2022-06-17 08:05:18 +00:00
</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" >
2023-10-02 18:11:43 +00:00
The number of the lines ignored and not displayed from the start of the [member text] value.
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" />
2023-06-15 14:06:22 +00:00
<member name= "size_flags_vertical" type= "int" setter= "set_v_size_flags" getter= "get_v_size_flags" overrides= "Control" enum= "Control.SizeFlags" is_bitfield= "true" default= "4" />
2022-04-19 10:27:18 +00:00
<member name= "structured_text_bidi_override" type= "int" setter= "set_structured_text_bidi_override" getter= "get_structured_text_bidi_override" enum= "TextServer.StructuredTextParser" default= "0" >
2020-08-12 11:49:10 +00:00
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>
2023-04-16 11:48:43 +00:00
<member name= "tab_stops" type= "PackedFloat32Array" setter= "set_tab_stops" getter= "get_tab_stops" default= "PackedFloat32Array()" >
Aligns text to the given tab-stops.
</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>
2022-06-15 08:01:45 +00:00
<member name= "text_overrun_behavior" type= "int" setter= "set_text_overrun_behavior" getter= "get_text_overrun_behavior" enum= "TextServer.OverrunBehavior" default= "0" >
Sets the clipping behavior when the text exceeds the node's bounding rectangle. See [enum TextServer.OverrunBehavior] for a description of all modes.
2021-07-04 14:43:55 +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>
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" >
2022-08-22 13:13:19 +00:00
The number of characters to display. If set to [code]-1[/code], all characters are displayed. This can be useful when animating the text appearing in a dialog box.
2022-08-20 18:06:13 +00:00
[b]Note:[/b] Setting this property updates [member visible_ratio] accordingly.
2021-12-05 12:28:32 +00:00
</member>
2022-06-15 08:01:45 +00:00
<member name= "visible_characters_behavior" type= "int" setter= "set_visible_characters_behavior" getter= "get_visible_characters_behavior" enum= "TextServer.VisibleCharactersBehavior" default= "0" >
2022-08-20 18:06:13 +00:00
Sets the clipping behavior when [member visible_characters] or [member visible_ratio] is set. See [enum TextServer.VisibleCharactersBehavior] for more info.
</member>
<member name= "visible_ratio" type= "float" setter= "set_visible_ratio" getter= "get_visible_ratio" default= "1.0" >
The fraction of characters to display, relative to the total number of characters (see [method get_total_character_count]). If set to [code]1.0[/code], all characters are displayed. If set to [code]0.5[/code], only half of the characters will be displayed. This can be useful when animating the text appearing in a dialog box.
[b]Note:[/b] Setting this property updates [member visible_characters] accordingly.
2018-01-11 22:38:35 +00:00
</member>
2017-09-12 20:42:36 +00:00
</members>
<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-11-05 19:50:01 +00:00
<theme_item name= "font_outline_color" data_type= "color" type= "Color" default= "Color(0, 0, 0, 1)" >
2022-11-21 02:48:36 +00:00
The color of text 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" >
2024-10-09 16:41:03 +00:00
Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.
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.
2022-12-19 16:15:44 +00:00
[b]Note:[/b] If using a font with [member FontFile.multichannel_signed_distance_field] enabled, its [member FontFile.msdf_pixel_range] must be set to at least [i]twice[/i] the value of [theme_item outline_size] for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
2023-12-19 22:13:42 +00:00
[b]Note:[/b] Using a value that is larger than half the font size is not recommended, as the font outline may fail to be fully closed in this case.
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>