.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_Label: Label ===== **Inherits:** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Control that displays formatted text. Member Functions ---------------- +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_align` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_line_count` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_line_height` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_lines_skipped` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_max_lines_visible` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_percent_visible` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_text` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_total_character_count` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_valign` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_visible_characters` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_visible_line_count` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_autowrap` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_clipping_text` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_uppercase` **(** **)** const | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_align` **(** :ref:`int` align **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_autowrap` **(** :ref:`bool` enable **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_clip_text` **(** :ref:`bool` enable **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_lines_skipped` **(** :ref:`int` lines_skipped **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_max_lines_visible` **(** :ref:`int` lines_visible **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_percent_visible` **(** :ref:`float` percent_visible **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_text` **(** :ref:`String` text **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_uppercase` **(** :ref:`bool` enable **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_valign` **(** :ref:`int` valign **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_visible_characters` **(** :ref:`int` amount **)** | +------------------------------+---------------------------------------------------------------------------------------------------------------------+ Member Variables ---------------- - :ref:`int` **align** - :ref:`bool` **autowrap** - :ref:`bool` **clip_text** - :ref:`int` **lines_skipped** - :ref:`int` **max_lines_visible** - :ref:`float` **percent_visible** - :ref:`String` **text** - :ref:`bool` **uppercase** - :ref:`int` **valign** Numeric Constants ----------------- - **ALIGN_LEFT** = **0** --- Align rows to the left (default). - **ALIGN_CENTER** = **1** --- Align rows centered. - **ALIGN_RIGHT** = **2** --- Align rows to the right (default). - **ALIGN_FILL** = **3** --- Expand row whitespaces to fit the width. - **VALIGN_TOP** = **0** --- Align the whole text to the top. - **VALIGN_CENTER** = **1** --- Align the whole text to the center. - **VALIGN_BOTTOM** = **2** --- Align the whole text to the bottom. - **VALIGN_FILL** = **3** --- Align the whole text by spreading the rows. Description ----------- Label is a control that displays formatted text, optionally autowrapping it to the :ref:`Control` area. It inherits from range to be able to scroll wrapped text vertically. Member Function Description --------------------------- .. _class_Label_get_align: - :ref:`int` **get_align** **(** **)** const Return the alignment mode (any of the ALIGN\_\* enumeration values). .. _class_Label_get_line_count: - :ref:`int` **get_line_count** **(** **)** const Return the amount of lines. .. _class_Label_get_line_height: - :ref:`int` **get_line_height** **(** **)** const Return the height of a line. .. _class_Label_get_lines_skipped: - :ref:`int` **get_lines_skipped** **(** **)** const Return the the number of lines to skipped before displaying. .. _class_Label_get_max_lines_visible: - :ref:`int` **get_max_lines_visible** **(** **)** const Return the restricted number of lines to display. Returns -1 if unrestricted. .. _class_Label_get_percent_visible: - :ref:`float` **get_percent_visible** **(** **)** const Return the restricted number of characters to display (as a percentage of the total text). .. _class_Label_get_text: - :ref:`String` **get_text** **(** **)** const Return the label text. Text can contain newlines. .. _class_Label_get_total_character_count: - :ref:`int` **get_total_character_count** **(** **)** const Return the total length of the text. .. _class_Label_get_valign: - :ref:`int` **get_valign** **(** **)** const Return the vertical alignment mode (any of the VALIGN\_\* enumeration values). .. _class_Label_get_visible_characters: - :ref:`int` **get_visible_characters** **(** **)** const Return the restricted number of characters to display. Returns -1 if unrestricted. .. _class_Label_get_visible_line_count: - :ref:`int` **get_visible_line_count** **(** **)** const .. _class_Label_has_autowrap: - :ref:`bool` **has_autowrap** **(** **)** const Return the state of the *autowrap* mode (see :ref:`set_autowrap`). .. _class_Label_is_clipping_text: - :ref:`bool` **is_clipping_text** **(** **)** const Return true if text would be cut off if it is too wide. .. _class_Label_is_uppercase: - :ref:`bool` **is_uppercase** **(** **)** const Return true if text is displayed in all capitals. .. _class_Label_set_align: - void **set_align** **(** :ref:`int` align **)** Sets the alignment mode to any of the ALIGN\_\* enumeration values. .. _class_Label_set_autowrap: - void **set_autowrap** **(** :ref:`bool` enable **)** Set *autowrap* mode. When enabled, autowrap will fit text to the control width, breaking sentences when they exceed the available horizontal space. When disabled, the label minimum width becomes the width of the longest row, and the minimum height large enough to fit all rows. .. _class_Label_set_clip_text: - void **set_clip_text** **(** :ref:`bool` enable **)** Cuts off the rest of the text if it is too wide. .. _class_Label_set_lines_skipped: - void **set_lines_skipped** **(** :ref:`int` lines_skipped **)** Sets the number of lines to skip before displaying. Useful for scrolling text. .. _class_Label_set_max_lines_visible: - void **set_max_lines_visible** **(** :ref:`int` lines_visible **)** Restricts the number of lines to display. Set to -1 to disable. .. _class_Label_set_percent_visible: - void **set_percent_visible** **(** :ref:`float` percent_visible **)** Restricts the number of characters to display (as a percentage of the total text). .. _class_Label_set_text: - void **set_text** **(** :ref:`String` text **)** Set the label text. Text can contain newlines. .. _class_Label_set_uppercase: - void **set_uppercase** **(** :ref:`bool` enable **)** Display text in all capitals. .. _class_Label_set_valign: - void **set_valign** **(** :ref:`int` valign **)** Sets the vertical alignment mode to any of the VALIGN\_\* enumeration values. .. _class_Label_set_visible_characters: - void **set_visible_characters** **(** :ref:`int` amount **)** Restricts the number of characters to display. Set to -1 to disable.