Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- BaseButton (3)
- ColorRect
- Container (13)
- GraphEdit
- ItemList
- Label
- LineEdit
- MenuBar
- NinePatchRect
- Panel
- Range (6)
- ReferenceRect
- RichTextLabel
- Separator (2)
- TabBar
- TextEdit (1)
- TextureRect
- Tree
- VideoStreamPlayer
Table of contents
-
var autowrap_mode = AUTOWRAP_OFF -
var clip_text: bool = false -
var ellipsis_char: String = "…" -
var horizontal_alignment: int = 0 -
var justification_flags: int = 163 -
var label_settings: LabelSettings -
var language: String = "" -
var lines_skipped: int = 0 -
var max_lines_visible: int = -1 -
var mouse_filter = MOUSE_FILTER_IGNORE -
var paragraph_separator: String = "\\n" -
var size_flags_vertical = SIZE_SHRINK_CENTER -
var structured_text_bidi_override = STRUCTURED_TEXT_DEFAULT -
var structured_text_bidi_override_options: Array = [] -
var tab_stops: PackedFloat32Array = PackedFloat32Array() -
var text: String = "" -
var text_direction = TEXT_DIRECTION_AUTO -
var text_overrun_behavior = OVERRUN_NO_TRIMMING -
var uppercase: bool = false -
var vertical_alignment: int = 0 -
var visible_characters: int = -1 -
var visible_characters_behavior = VC_CHARS_BEFORE_SHAPING -
var visible_ratio: float = 1.0 -
const func get_character_bounds(pos: int) -> Rect2 -
const func get_line_count() -> int -
const func get_line_height(line: int = -1) -> int -
const func get_total_character_count() -> int -
const func get_visible_line_count() -> int -
self["theme_override_colors/font_color"] = Color(1, 1, 1, 1) as Color -
self["theme_override_colors/font_outline_color"] = Color(0, 0, 0, 1) as Color -
self["theme_override_colors/font_shadow_color"] = Color(0, 0, 0, 0) as Color -
self["theme_override_constants/line_spacing"] = 3 as int -
self["theme_override_constants/outline_size"] = 0 as int -
self["theme_override_constants/paragraph_spacing"] = 0 as int -
self["theme_override_constants/shadow_offset_x"] = 1 as int -
self["theme_override_constants/shadow_offset_y"] = 1 as int -
self["theme_override_constants/shadow_outline_size"] = 1 as int -
self["theme_override_fonts/font"] = font as Font -
self["theme_override_font_sizes/font_size"] = font_size as int -
self["theme_override_styles/normal"] = style as StyleBox
Label #
is_instantiable, Node, core, not_builtin_classes
A control for displaying plain text.
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.
Members #
var autowrap_mode = AUTOWRAP_OFF#
If set to something other than 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 TextServer.AutowrapMode.
var clip_text: bool = false#
If true, the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
var ellipsis_char: String = "…"#
Ellipsis character used for text clipping.
var horizontal_alignment: int = 0#
Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the HorizontalAlignment constants.
var justification_flags: int = 163#
Line fill alignment rules. See TextServer.JustificationFlag for more information.
var label_settings: LabelSettings#
A LabelSettings resource that can be shared between multiple Label nodes. Takes priority over theme properties.
var language: String = ""#
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
var lines_skipped: int = 0#
The number of the lines ignored and not displayed from the start of the text value.
var max_lines_visible: int = -1#
Limits the lines of text the node shows on screen.
var mouse_filter = MOUSE_FILTER_IGNORE#
var paragraph_separator: String = "\\n"#
String used as a paragraph separator. Each paragraph is processed independently, in its own BiDi context.
var size_flags_vertical = SIZE_SHRINK_CENTER#
var structured_text_bidi_override = STRUCTURED_TEXT_DEFAULT#
Set BiDi algorithm override for the structured text.
var structured_text_bidi_override_options: Array = []#
Set additional options for BiDi override.
var tab_stops: PackedFloat32Array = PackedFloat32Array()#
Aligns text to the given tab-stops.
var text: String = ""#
The text to display on screen.
var text_direction = TEXT_DIRECTION_AUTO#
Base text writing direction.
var text_overrun_behavior = OVERRUN_NO_TRIMMING#
Sets the clipping behavior when the text exceeds the node's bounding rectangle. See TextServer.OverrunBehavior for a description of all modes.
var uppercase: bool = false#
If true, all the text displays as UPPERCASE.
var vertical_alignment: int = 0#
Controls the text's vertical alignment. Supports top, center, bottom, and fill. Set it to one of the VerticalAlignment constants.
var visible_characters: int = -1#
The number of characters to display. If set to -1, all characters are displayed. This can be useful when animating the text appearing in a dialog box.
Note: Setting this property updates visible_ratio accordingly.
var visible_characters_behavior = VC_CHARS_BEFORE_SHAPING#
Sets the clipping behavior when visible_characters or visible_ratio is set. See TextServer.VisibleCharactersBehavior for more info.
var visible_ratio: float = 1.0#
The fraction of characters to display, relative to the total number of characters (see get_total_character_count). If set to 1.0, all characters are displayed. If set to 0.5, only half of the characters will be displayed. This can be useful when animating the text appearing in a dialog box.
Note: Setting this property updates visible_characters accordingly.
Methods #
const func get_character_bounds(pos: int) -> Rect2#
Returns the bounding rectangle of the character at position pos in the label's local coordinate system. If the character is a non-visual character or 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.
const func get_line_count() -> int#
Returns the number of lines of text the Label has.
const func get_line_height(line: int = -1) -> int#
Returns the height of the line line.
If line is set to -1, returns the biggest line height.
If there are no lines, returns font size in pixels.
const func get_total_character_count() -> int#
Returns the total number of printable characters in the text (excluding spaces and newlines).
const func get_visible_line_count() -> int#
Returns the number of lines shown. Useful if the Label's height cannot currently display all lines.
Annotations #
Constants #
Constructors #
Enums #
Operators #
Signals #
Theme Items #
self["theme_override_colors/font_color"] = Color(1, 1, 1, 1) as Color#
Default text Color of the Label.
self["theme_override_colors/font_outline_color"] = Color(0, 0, 0, 1) as Color#
The color of text outline.
self["theme_override_colors/font_shadow_color"] = Color(0, 0, 0, 0) as Color#
Color of the text's shadow effect.
self["theme_override_constants/line_spacing"] = 3 as int#
Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.
self["theme_override_constants/outline_size"] = 0 as int#
Text outline size.
Note: If using a font with FontFile.multichannel_signed_distance_field enabled, its FontFile.msdf_pixel_range must be set to at least twice the value of outline_size for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
Note: 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.
self["theme_override_constants/paragraph_spacing"] = 0 as int#
Vertical space between paragraphs. Added on top of line_spacing.
self["theme_override_constants/shadow_offset_x"] = 1 as int#
The horizontal offset of the text's shadow.
self["theme_override_constants/shadow_offset_y"] = 1 as int#
The vertical offset of the text's shadow.
self["theme_override_constants/shadow_outline_size"] = 1 as int#
The size of the shadow outline.
self["theme_override_fonts/font"] = font as Font#
Font used for the Label's text.
self["theme_override_font_sizes/font_size"] = font_size as int#
Font size of the Label's text.
self["theme_override_styles/normal"] = style as StyleBox#
Background StyleBox for the Label.