Debian Codegraph @

doc/classes/Label.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="Label" inherits="Control" keywords="text" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A control for displaying plain text.
5 </brief_description>
6 <description>
7 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.
8 [b]Note:[/b] A single Label node is not designed to display huge amounts of text. To display large amounts of text in a single node, consider using [RichTextLabel] instead as it supports features like an integrated scroll bar and threading. [RichTextLabel] generally performs better when displaying large amounts of text (several pages or more).
9 </description>
10 <tutorials>
11 <link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/2712</link>
12 </tutorials>
13 <methods>
14 <method name="get_character_bounds" qualifiers="const">
15 <return type="Rect2" />
16 <param index="0" name="pos" type="int" />
17 <description>
18 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.
19 </description>
20 </method>
21 <method name="get_line_count" qualifiers="const">
22 <return type="int" />
23 <description>
24 Returns the number of lines of text the Label has.
25 </description>
26 </method>
27 <method name="get_line_height" qualifiers="const">
28 <return type="int" />
29 <param index="0" name="line" type="int" default="-1" />
30 <description>
31 Returns the height of the line [param line].
32 If [param line] is set to [code]-1[/code], returns the biggest line height.
33 If there are no lines, returns font size in pixels.
34 </description>
35 </method>
36 <method name="get_total_character_count" qualifiers="const">
37 <return type="int" />
38 <description>
39 Returns the total number of printable characters in the text (excluding spaces and newlines).
40 </description>
41 </method>
42 <method name="get_visible_line_count" qualifiers="const">
43 <return type="int" />
44 <description>
45 Returns the number of lines shown. Useful if the [Label]'s height cannot currently display all lines.
46 </description>
47 </method>
48 </methods>
49 <members>
50 <member name="autowrap_mode" type="int" setter="set_autowrap_mode" getter="get_autowrap_mode" enum="TextServer.AutowrapMode" default="0">
51 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.
52 </member>
53 <member name="autowrap_trim_flags" type="int" setter="set_autowrap_trim_flags" getter="get_autowrap_trim_flags" enum="TextServer.LineBreakFlag" is_bitfield="true" default="192">
54 Autowrap space trimming flags. See [constant TextServer.BREAK_TRIM_START_EDGE_SPACES] and [constant TextServer.BREAK_TRIM_END_EDGE_SPACES] for more info.
55 </member>
56 <member name="clip_text" type="bool" setter="set_clip_text" getter="is_clipping_text" default="false">
57 If [code]true[/code], the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
58 </member>
59 <member name="ellipsis_char" type="String" setter="set_ellipsis_char" getter="get_ellipsis_char" default="&quot;…&quot;">
60 Ellipsis character used for text clipping.
61 </member>
62 <member name="horizontal_alignment" type="int" setter="set_horizontal_alignment" getter="get_horizontal_alignment" enum="HorizontalAlignment" default="0">
63 Controls the text's horizontal alignment. Supports left, center, right, and fill (also known as justify).
64 </member>
65 <member name="justification_flags" type="int" setter="set_justification_flags" getter="get_justification_flags" enum="TextServer.JustificationFlag" is_bitfield="true" default="163">
66 Line fill alignment rules.
67 </member>
68 <member name="label_settings" type="LabelSettings" setter="set_label_settings" getter="get_label_settings">
69 A [LabelSettings] resource that can be shared between multiple [Label] nodes. Takes priority over theme properties.
70 </member>
71 <member name="language" type="String" setter="set_language" getter="get_language" default="&quot;&quot;">
72 Language code used for line-breaking and text shaping algorithms. If left empty, the current locale is used instead.
73 </member>
74 <member name="lines_skipped" type="int" setter="set_lines_skipped" getter="get_lines_skipped" default="0">
75 The number of the lines ignored and not displayed from the start of the [member text] value.
76 </member>
77 <member name="max_lines_visible" type="int" setter="set_max_lines_visible" getter="get_max_lines_visible" default="-1">
78 Limits the lines of text the node shows on screen.
79 </member>
80 <member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" overrides="Control" enum="Control.MouseFilter" default="2" />
81 <member name="paragraph_separator" type="String" setter="set_paragraph_separator" getter="get_paragraph_separator" default="&quot;\\n&quot;">
82 String used as a paragraph separator. Each paragraph is processed independently, in its own BiDi context.
83 </member>
84 <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" />
85 <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">
86 Set BiDi algorithm override for the structured text.
87 </member>
88 <member name="structured_text_bidi_override_options" type="Array" setter="set_structured_text_bidi_override_options" getter="get_structured_text_bidi_override_options" default="[]">
89 Set additional options for BiDi override.
90 </member>
91 <member name="tab_stops" type="PackedFloat32Array" setter="set_tab_stops" getter="get_tab_stops" default="PackedFloat32Array()">
92 Aligns text to the given tab-stops.
93 </member>
94 <member name="text" type="String" setter="set_text" getter="get_text" default="&quot;&quot;">
95 The text to display on screen.
96 </member>
97 <member name="text_direction" type="int" setter="set_text_direction" getter="get_text_direction" enum="Control.TextDirection" default="0">
98 Base text writing direction.
99 </member>
100 <member name="text_overrun_behavior" type="int" setter="set_text_overrun_behavior" getter="get_text_overrun_behavior" enum="TextServer.OverrunBehavior" default="0">
101 The clipping behavior when the text exceeds the node's bounding rectangle.
102 </member>
103 <member name="uppercase" type="bool" setter="set_uppercase" getter="is_uppercase" default="false">
104 If [code]true[/code], all the text displays as UPPERCASE.
105 </member>
106 <member name="vertical_alignment" type="int" setter="set_vertical_alignment" getter="get_vertical_alignment" enum="VerticalAlignment" default="0">
107 Controls the text's vertical alignment. Supports top, center, bottom, and fill.
108 </member>
109 <member name="visible_characters" type="int" setter="set_visible_characters" getter="get_visible_characters" default="-1">
110 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.
111 [b]Note:[/b] Setting this property updates [member visible_ratio] accordingly.
112 [b]Note:[/b] Characters are counted as Unicode codepoints. A single visible grapheme may contain multiple codepoints (e.g. certain emoji use three codepoints). A single codepoint may contain two UTF-16 characters, which are used in C# strings.
113 </member>
114 <member name="visible_characters_behavior" type="int" setter="set_visible_characters_behavior" getter="get_visible_characters_behavior" enum="TextServer.VisibleCharactersBehavior" default="0">
115 The clipping behavior when [member visible_characters] or [member visible_ratio] is set.
116 </member>
117 <member name="visible_ratio" type="float" setter="set_visible_ratio" getter="get_visible_ratio" default="1.0">
118 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.
119 [b]Note:[/b] Setting this property updates [member visible_characters] accordingly.
120 </member>
121 </members>
122 <theme_items>
123 <theme_item name="font_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
124 Default text [Color] of the [Label].
125 </theme_item>
126 <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
127 The color of text outline.
128 </theme_item>
129 <theme_item name="font_shadow_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
130 [Color] of the text's shadow effect.
131 </theme_item>
132 <theme_item name="line_spacing" data_type="constant" type="int" default="3">
133 Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.
134 </theme_item>
135 <theme_item name="outline_size" data_type="constant" type="int" default="0">
136 Text outline size.
137 [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.
138 [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.
139 </theme_item>
140 <theme_item name="paragraph_spacing" data_type="constant" type="int" default="0">
141 Vertical space between paragraphs. Added on top of [theme_item line_spacing].
142 </theme_item>
143 <theme_item name="shadow_offset_x" data_type="constant" type="int" default="1">
144 The horizontal offset of the text's shadow.
145 </theme_item>
146 <theme_item name="shadow_offset_y" data_type="constant" type="int" default="1">
147 The vertical offset of the text's shadow.
148 </theme_item>
149 <theme_item name="shadow_outline_size" data_type="constant" type="int" default="1">
150 The size of the shadow outline.
151 </theme_item>
152 <theme_item name="font" data_type="font" type="Font">
153 [Font] used for the [Label]'s text.
154 </theme_item>
155 <theme_item name="font_size" data_type="font_size" type="int">
156 Font size of the [Label]'s text.
157 </theme_item>
158 <theme_item name="focus" data_type="style" type="StyleBox">
159 [StyleBox] used when the [Label] is focused (when used with assistive apps).
160 </theme_item>
161 <theme_item name="normal" data_type="style" type="StyleBox">
162 Background [StyleBox] for the [Label].
163 </theme_item>
164 </theme_items>
165 </class>