:github_url: hide

.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the TLLabel.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.

.. _class_TLLabel:

TLLabel
=======

**Inherits:** 

**Category:** Core

Brief Description
-----------------

Displays plain text in a line or wrapped inside a rectangle. For formatted text, use :ref:`TLRichTextEdit<class_TLRichTextEdit>`.

Copy of Godot Label with the shaping support. TLLabel uses the same theme items as the Label.

Properties
----------

+-----------------------------------------+----------------------------------------------------------------------+-----------+
| int                                     | :ref:`align<class_TLLabel_property_align>`                           | 0         |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| bool                                    | :ref:`autowrap<class_TLLabel_property_autowrap>`                     | false     |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| :ref:`TLFontFamily<class_TLFontFamily>` | :ref:`base_font<class_TLLabel_property_base_font>`                   |           |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| int                                     | :ref:`base_font_size<class_TLLabel_property_base_font_size>`         | 12        |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| String                                  | :ref:`base_font_style<class_TLLabel_property_base_font_style>`       | "Regular" |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| bool                                    | :ref:`clip_text<class_TLLabel_property_clip_text>`                   | false     |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| String                                  | :ref:`language<class_TLLabel_property_language>`                     | ""        |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| int                                     | :ref:`lines_skipped<class_TLLabel_property_lines_skipped>`           | 0         |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| int                                     | :ref:`max_lines_visible<class_TLLabel_property_max_lines_visible>`   | -1        |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| int                                     | mouse_filter                                                         | **O:** 2  |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| String                                  | :ref:`ot_features<class_TLLabel_property_ot_features>`               | ""        |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| float                                   | :ref:`percent_visible<class_TLLabel_property_percent_visible>`       | 1.0       |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| int                                     | size_flags_vertical                                                  | **O:** 4  |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| String                                  | :ref:`text<class_TLLabel_property_text>`                             | ""        |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| int                                     | :ref:`text_direction<class_TLLabel_property_text_direction>`         | 3         |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| bool                                    | :ref:`uppercase<class_TLLabel_property_uppercase>`                   | false     |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| int                                     | :ref:`valign<class_TLLabel_property_valign>`                         | 0         |
+-----------------------------------------+----------------------------------------------------------------------+-----------+
| int                                     | :ref:`visible_characters<class_TLLabel_property_visible_characters>` | -1        |
+-----------------------------------------+----------------------------------------------------------------------+-----------+

Methods
-------

.. table::
   :class: longtable
   :widths: 7 20

   +-----+----------------------------------------------------------------------------------------------------+
   | int | :ref:`get_line_count<class_TLLabel_method_get_line_count>` **(** **)** const                       |
   +-----+----------------------------------------------------------------------------------------------------+
   | int | :ref:`get_line_height<class_TLLabel_method_get_line_height>` **(** **)** const                     |
   +-----+----------------------------------------------------------------------------------------------------+
   | int | :ref:`get_total_character_count<class_TLLabel_method_get_total_character_count>` **(** **)** const |
   +-----+----------------------------------------------------------------------------------------------------+
   | int | :ref:`get_visible_line_count<class_TLLabel_method_get_visible_line_count>` **(** **)** const       |
   +-----+----------------------------------------------------------------------------------------------------+

Enumerations
------------

.. _enum_TLLabel_Align:

.. _class_TLLabel_constant_ALIGN_LEFT:

.. _class_TLLabel_constant_ALIGN_CENTER:

.. _class_TLLabel_constant_ALIGN_RIGHT:

.. _class_TLLabel_constant_ALIGN_FILL:

enum **Align**:

- **ALIGN_LEFT** = **0** --- Align rows to the left (default).

- **ALIGN_CENTER** = **1** --- Align rows centered.

- **ALIGN_RIGHT** = **2** --- Align rows to the right.

- **ALIGN_FILL** = **3** --- Expand row white spaces to fit the width.

----

.. _enum_TLLabel_VAlign:

.. _class_TLLabel_constant_VALIGN_TOP:

.. _class_TLLabel_constant_VALIGN_CENTER:

.. _class_TLLabel_constant_VALIGN_BOTTOM:

.. _class_TLLabel_constant_VALIGN_FILL:

enum **VAlign**:

- **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 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.

Property Descriptions
---------------------

.. _class_TLLabel_property_align:

- int **align**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+------------------+
   | *Default* | 0                |
   +-----------+------------------+
   | *Setter*  | set_align(value) |
   +-----------+------------------+
   | *Getter*  | get_align()      |
   +-----------+------------------+

Controls the text's horizontal align. Supports left, center, right, and fill, or justify. Set it to one of the ``ALIGN_*`` constants.

----

.. _class_TLLabel_property_autowrap:

- bool **autowrap**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+---------------------+
   | *Default* | false               |
   +-----------+---------------------+
   | *Setter*  | set_autowrap(value) |
   +-----------+---------------------+
   | *Getter*  | has_autowrap()      |
   +-----------+---------------------+

If ``true``, wraps the text inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text.

----

.. _class_TLLabel_property_base_font:

- :ref:`TLFontFamily<class_TLFontFamily>` **base_font**

.. table::
   :class: longtable
   :widths: 7 20

   +----------+----------------------+
   | *Setter* | set_base_font(value) |
   +----------+----------------------+
   | *Getter* | get_base_font()      |
   +----------+----------------------+

Base font.

----

.. _class_TLLabel_property_base_font_size:

- int **base_font_size**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+---------------------------+
   | *Default* | 12                        |
   +-----------+---------------------------+
   | *Setter*  | set_base_font_size(value) |
   +-----------+---------------------------+
   | *Getter*  | get_base_font_size()      |
   +-----------+---------------------------+

Base font size.

----

.. _class_TLLabel_property_base_font_style:

- String **base_font_style**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+----------------------------+
   | *Default* | "Regular"                  |
   +-----------+----------------------------+
   | *Setter*  | set_base_font_style(value) |
   +-----------+----------------------------+
   | *Getter*  | get_base_font_style()      |
   +-----------+----------------------------+

Base font style.

----

.. _class_TLLabel_property_clip_text:

- bool **clip_text**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+----------------------+
   | *Default* | false                |
   +-----------+----------------------+
   | *Setter*  | set_clip_text(value) |
   +-----------+----------------------+
   | *Getter*  | is_clipping_text()   |
   +-----------+----------------------+

If ``true``, the Label only shows the text that fits inside its bounding rectangle. It also lets you scale the node down freely.

----

.. _class_TLLabel_property_language:

- String **language**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+---------------------+
   | *Default* | ""                  |
   +-----------+---------------------+
   | *Setter*  | set_language(value) |
   +-----------+---------------------+
   | *Getter*  | get_language()      |
   +-----------+---------------------+

Language code for line-breaking and text shaping algorithms.

----

.. _class_TLLabel_property_lines_skipped:

- int **lines_skipped**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+--------------------------+
   | *Default* | 0                        |
   +-----------+--------------------------+
   | *Setter*  | set_lines_skipped(value) |
   +-----------+--------------------------+
   | *Getter*  | get_lines_skipped()      |
   +-----------+--------------------------+

The node ignores the first ``lines_skipped`` lines before it starts to display text.

----

.. _class_TLLabel_property_max_lines_visible:

- int **max_lines_visible**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+------------------------------+
   | *Default* | -1                           |
   +-----------+------------------------------+
   | *Setter*  | set_max_lines_visible(value) |
   +-----------+------------------------------+
   | *Getter*  | get_max_lines_visible()      |
   +-----------+------------------------------+

Limits the lines of text the node shows on screen.

----

.. _class_TLLabel_property_ot_features:

- String **ot_features**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+------------------------+
   | *Default* | ""                     |
   +-----------+------------------------+
   | *Setter*  | set_ot_features(value) |
   +-----------+------------------------+
   | *Getter*  | get_ot_features()      |
   +-----------+------------------------+

Comma separated list of OpenType feature tags.

----

.. _class_TLLabel_property_percent_visible:

- float **percent_visible**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+----------------------------+
   | *Default* | 1.0                        |
   +-----------+----------------------------+
   | *Setter*  | set_percent_visible(value) |
   +-----------+----------------------------+
   | *Getter*  | get_percent_visible()      |
   +-----------+----------------------------+

Limits the count of visible characters. If you set ``percent_visible`` to 50, only up to half of the text's characters will display on screen. Useful to animate the text in a dialog box.

----

.. _class_TLLabel_property_text:

- String **text**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+-----------------+
   | *Default* | ""              |
   +-----------+-----------------+
   | *Setter*  | set_text(value) |
   +-----------+-----------------+
   | *Getter*  | get_text()      |
   +-----------+-----------------+

The text to display on screen.

----

.. _class_TLLabel_property_text_direction:

- int **text_direction**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+---------------------------+
   | *Default* | 3                         |
   +-----------+---------------------------+
   | *Setter*  | set_text_direction(value) |
   +-----------+---------------------------+
   | *Getter*  | get_text_direction()      |
   +-----------+---------------------------+

Base direction of the text.

----

.. _class_TLLabel_property_uppercase:

- bool **uppercase**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+----------------------+
   | *Default* | false                |
   +-----------+----------------------+
   | *Setter*  | set_uppercase(value) |
   +-----------+----------------------+
   | *Getter*  | is_uppercase()       |
   +-----------+----------------------+

If ``true``, all the text displays as UPPERCASE.

----

.. _class_TLLabel_property_valign:

- int **valign**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+-------------------+
   | *Default* | 0                 |
   +-----------+-------------------+
   | *Setter*  | set_valign(value) |
   +-----------+-------------------+
   | *Getter*  | get_valign()      |
   +-----------+-------------------+

Controls the text's vertical align. Supports top, center, bottom, and fill. Set it to one of the ``VALIGN_*`` constants.

----

.. _class_TLLabel_property_visible_characters:

- int **visible_characters**

.. table::
   :class: longtable
   :widths: 7 20

   +-----------+-------------------------------+
   | *Default* | -1                            |
   +-----------+-------------------------------+
   | *Setter*  | set_visible_characters(value) |
   +-----------+-------------------------------+
   | *Getter*  | get_visible_characters()      |
   +-----------+-------------------------------+

Restricts the number of characters to display. Set to -1 to disable.

Method Descriptions
-------------------

.. _class_TLLabel_method_get_line_count:

- int **get_line_count** **(** **)** const

Returns the amount of lines of text the Label has.

----

.. _class_TLLabel_method_get_line_height:

- int **get_line_height** **(** **)** const

Returns the of the line in pixels.

----

.. _class_TLLabel_method_get_total_character_count:

- int **get_total_character_count** **(** **)** const

Returns the total number of printable characters in the text.

----

.. _class_TLLabel_method_get_visible_line_count:

- int **get_visible_line_count** **(** **)** const

Returns the number of lines shown. Useful if the Label's height cannot currently display all lines.

