summaryrefslogtreecommitdiff
path: root/doc/classes/Label.xml
blob: 3c349e052fe1efcbcb7f4dc9cfa598c292015887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Label" inherits="Control" version="4.0">
	<brief_description>
		Displays plain text in a line or wrapped inside a rectangle. For formatted text, use [RichTextLabel].
	</brief_description>
	<description>
		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.
		[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.
	</description>
	<tutorials>
		<link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
	</tutorials>
	<methods>
		<method name="clear_opentype_features">
			<return type="void" />
			<description>
				Removes all OpenType features.
			</description>
		</method>
		<method name="get_line_count" qualifiers="const">
			<return type="int" />
			<description>
				Returns the amount of lines of text the Label has.
			</description>
		</method>
		<method name="get_line_height" qualifiers="const">
			<return type="int" />
			<argument index="0" name="line" type="int" default="-1" />
			<description>
				Returns the height of the line [code]line[/code].
				If [code]line[/code] is set to [code]-1[/code], returns the biggest line height.
				If there're no lines returns font size in pixels.
			</description>
		</method>
		<method name="get_opentype_feature" qualifiers="const">
			<return type="int" />
			<argument index="0" name="tag" type="String" />
			<description>
				Returns OpenType feature [code]tag[/code].
			</description>
		</method>
		<method name="get_total_character_count" qualifiers="const">
			<return type="int" />
			<description>
				Returns the total number of printable characters in the text (excluding spaces and newlines).
			</description>
		</method>
		<method name="get_visible_line_count" qualifiers="const">
			<return type="int" />
			<description>
				Returns the number of lines shown. Useful if the [Label]'s height cannot currently display all lines.
			</description>
		</method>
		<method name="set_opentype_feature">
			<return type="void" />
			<argument index="0" name="tag" type="String" />
			<argument index="1" name="value" type="int" />
			<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>
	</methods>
	<members>
		<member name="align" type="int" setter="set_align" getter="get_align" enum="Label.Align" default="0">
			Controls the text's horizontal align. Supports left, center, right, and fill, or justify. Set it to one of the [enum Align] constants.
		</member>
		<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].
		</member>
		<member name="clip_text" type="bool" setter="set_clip_text" getter="is_clipping_text" default="false">
			If [code]true[/code], the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
		</member>
		<member name="language" type="String" setter="set_language" getter="get_language" default="&quot;&quot;">
			Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
		</member>
		<member name="lines_skipped" type="int" setter="set_lines_skipped" getter="get_lines_skipped" default="0">
			The node ignores the first [code]lines_skipped[/code] lines before it starts to display text.
		</member>
		<member name="max_lines_visible" type="int" setter="set_max_lines_visible" getter="get_max_lines_visible" default="-1">
			Limits the lines of text the node shows on screen.
		</member>
		<member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" override="true" enum="Control.MouseFilter" default="2" />
		<member name="percent_visible" type="float" setter="set_percent_visible" getter="get_percent_visible" default="1.0">
			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.
		</member>
		<member name="size_flags_vertical" type="int" setter="set_v_size_flags" getter="get_v_size_flags" override="true" default="4" />
		<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>
		<member name="structured_text_bidi_override_options" type="Array" setter="set_structured_text_bidi_override_options" getter="get_structured_text_bidi_override_options" default="[]">
			Set additional options for BiDi override.
		</member>
		<member name="text" type="String" setter="set_text" getter="get_text" default="&quot;&quot;">
			The text to display on screen.
		</member>
		<member name="text_direction" type="int" setter="set_text_direction" getter="get_text_direction" enum="Control.TextDirection" default="0">
			Base text writing direction.
		</member>
		<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>
		<member name="uppercase" type="bool" setter="set_uppercase" getter="is_uppercase" default="false">
			If [code]true[/code], all the text displays as UPPERCASE.
		</member>
		<member name="valign" type="int" setter="set_valign" getter="get_valign" enum="Label.VAlign" default="0">
			Controls the text's vertical align. Supports top, center, bottom, and fill. Set it to one of the [enum VAlign] constants.
		</member>
		<member name="visible_characters" type="int" setter="set_visible_characters" getter="get_visible_characters" default="-1">
			Restricts the number of characters to display. Set to -1 to disable.
		</member>
	</members>
	<constants>
		<constant name="ALIGN_LEFT" value="0" enum="Align">
			Align rows to the left (default).
		</constant>
		<constant name="ALIGN_CENTER" value="1" enum="Align">
			Align rows centered.
		</constant>
		<constant name="ALIGN_RIGHT" value="2" enum="Align">
			Align rows to the right.
		</constant>
		<constant name="ALIGN_FILL" value="3" enum="Align">
			Expand row to fit the width.
		</constant>
		<constant name="VALIGN_TOP" value="0" enum="VAlign">
			Align the whole text to the top.
		</constant>
		<constant name="VALIGN_CENTER" value="1" enum="VAlign">
			Align the whole text to the center.
		</constant>
		<constant name="VALIGN_BOTTOM" value="2" enum="VAlign">
			Align the whole text to the bottom.
		</constant>
		<constant name="VALIGN_FILL" value="3" enum="VAlign">
			Align the whole text by spreading the rows.
		</constant>
		<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>
	</constants>
	<theme_items>
		<theme_item name="font" data_type="font" type="Font">
			[Font] used for the [Label]'s text.
		</theme_item>
		<theme_item name="font_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
			Default text [Color] of the [Label].
		</theme_item>
		<theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
			The tint of [Font]'s outline.
		</theme_item>
		<theme_item name="font_shadow_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
			[Color] of the text's shadow effect.
		</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="line_spacing" data_type="constant" type="int" default="3">
			Vertical space between lines in multiline [Label].
		</theme_item>
		<theme_item name="normal" data_type="style" type="StyleBox">
			Background [StyleBox] for the [Label].
		</theme_item>
		<theme_item name="outline_size" data_type="constant" type="int" default="0">
			Text outline size.
		</theme_item>
		<theme_item name="shadow_offset_x" data_type="constant" type="int" default="1">
			The horizontal offset of the text's shadow.
		</theme_item>
		<theme_item name="shadow_offset_y" data_type="constant" type="int" default="1">
			The vertical offset of the text's shadow.
		</theme_item>
		<theme_item name="shadow_outline_size" data_type="constant" type="int" default="1">
			Shadow outline size. If set to 1 or greater, the shadow will be displayed around the whole text as an outline.
		</theme_item>
	</theme_items>
</class>