:github_url: hide

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

.. _class_TLShapedAttributedString:

TLShapedAttributedString
========================

**Inherits:** :ref:`TLShapedString<class_TLShapedString>`

**Category:** Core

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

Golds shaped line of text with associated attributes.

Properties
----------

+---------+---------------------------------------------------------------------------------+
| Array   | :ref:`attributes_dict<class_TLShapedAttributedString_property_attributes_dict>` |
+---------+---------------------------------------------------------------------------------+
| int     | :ref:`attribute/type<class_TLShapedAttributedString_property_attribute/type>`   |
+---------+---------------------------------------------------------------------------------+
| Variant | :ref:`attribute/value<class_TLShapedAttributedString_property_attribute/value>` |
+---------+---------------------------------------------------------------------------------+
| int     | :ref:`attribute/start<class_TLShapedAttributedString_property_attribute/start>` |
+---------+---------------------------------------------------------------------------------+
| int     | :ref:`attribute/end<class_TLShapedAttributedString_property_attribute/end>`     |
+---------+---------------------------------------------------------------------------------+

Methods
-------

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

   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | void    | :ref:`add_attribute<class_TLShapedAttributedString_method_add_attribute>` **(** int attribute, Variant value, int start, int end **)** |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | void    | :ref:`clear_attributes<class_TLShapedAttributedString_method_clear_attributes>` **(** **)**                                            |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | void    | :ref:`commit_attribute<class_TLShapedAttributedString_method_commit_attribute>` **(** **)**                                            |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Variant | :ref:`get_attribute<class_TLShapedAttributedString_method_get_attribute>` **(** int attribute, int index **)** const                   |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | int     | :ref:`get_attribute_end<class_TLShapedAttributedString_method_get_attribute_end>` **(** int attribute, int index **)** const           |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | int     | :ref:`get_attribute_start<class_TLShapedAttributedString_method_get_attribute_start>` **(** int attribute, int index **)** const       |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Array   | :ref:`get_embedded_rects<class_TLShapedAttributedString_method_get_embedded_rects>` **(** **)**                                        |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | bool    | :ref:`has_attribute<class_TLShapedAttributedString_method_has_attribute>` **(** int attribute, int index **)** const                   |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | void    | :ref:`load_attributes_dict<class_TLShapedAttributedString_method_load_attributes_dict>` **(** Array array **)**                        |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | void    | :ref:`remove_attribute<class_TLShapedAttributedString_method_remove_attribute>` **(** int attribute, int start, int end **)**          |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | void    | :ref:`remove_attributes<class_TLShapedAttributedString_method_remove_attributes>` **(** int start, int end **)**                       |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Array   | :ref:`save_attributes_dict<class_TLShapedAttributedString_method_save_attributes_dict>` **(** **)** const                              |
   +---------+----------------------------------------------------------------------------------------------------------------------------------------+

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

.. _enum_TLShapedAttributedString_TextAttribute:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_FONT:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_FONT_STYLE:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_FONT_SIZE:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_FONT_FEATURES:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_LANGUAGE:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_REPLACEMENT_IMAGE:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_REPLACEMENT_RECT:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_REPLACEMENT_ID:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_REPLACEMENT_VALIGN:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_COLOR:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_OUTLINE_COLOR:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_UNDERLINE_COLOR:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_UNDERLINE_WIDTH:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_STRIKETHROUGH_COLOR:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_STRIKETHROUGH_WIDTH:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_OVERLINE_COLOR:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_OVERLINE_WIDTH:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_HIGHLIGHT_COLOR:

.. _class_TLShapedAttributedString_constant_TEXT_ATTRIBUTE_META:

enum **TextAttribute**:

- **TEXT_ATTRIBUTE_FONT** = **1** --- Font family. Attribute type: :ref:`TLFontFamily<class_TLFontFamily>`

- **TEXT_ATTRIBUTE_FONT_STYLE** = **2** --- Font style (Regular, Bold, Italic, Oblique etc.). Attribute type: String

- **TEXT_ATTRIBUTE_FONT_SIZE** = **3** --- Font size. Attribute type: ``int``

- **TEXT_ATTRIBUTE_FONT_FEATURES** = **4** --- Comma separated list of OpenType feature tags. More info: https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags. Attribute type: String

- **TEXT_ATTRIBUTE_LANGUAGE** = **5** --- Language code for line-breaking and text shaping algorithms. Attribute type: String

- **TEXT_ATTRIBUTE_REPLACEMENT_IMAGE** = **6** --- Embedded image. Attribute type: Texture

- **TEXT_ATTRIBUTE_REPLACEMENT_RECT** = **7** --- Reserved space for custom embedded object. Attribute type: Vector2

- **TEXT_ATTRIBUTE_REPLACEMENT_ID** = **8** --- Embedded object id key. Attribute type: Variant

- **TEXT_ATTRIBUTE_REPLACEMENT_VALIGN** = **9** --- Embedded image/object inline alignment. Attribute type: ``TEXT_VALIGN_*``

- **TEXT_ATTRIBUTE_COLOR** = **31** --- Text color. Attribute type: Color

- **TEXT_ATTRIBUTE_OUTLINE_COLOR** = **32** --- Text outline color. Attribute type: Color

- **TEXT_ATTRIBUTE_UNDERLINE_COLOR** = **41** --- Underline color. Attribute type: Color

- **TEXT_ATTRIBUTE_UNDERLINE_WIDTH** = **42** --- Underline width. Attribute type: ``int``

- **TEXT_ATTRIBUTE_STRIKETHROUGH_COLOR** = **51** --- Strike through line color. Attribute type: Color

- **TEXT_ATTRIBUTE_STRIKETHROUGH_WIDTH** = **52** --- Strike through line width. Attribute type: ``int``

- **TEXT_ATTRIBUTE_OVERLINE_COLOR** = **61** --- Overline color/ Attribute type: Color

- **TEXT_ATTRIBUTE_OVERLINE_WIDTH** = **62** --- Overline width. Attribute type: ``int``

- **TEXT_ATTRIBUTE_HIGHLIGHT_COLOR** = **71** --- Highlight color. Attribute type: Color

- **TEXT_ATTRIBUTE_META** = **100** --- User defined data, use ``TEXT_ATTRIBUTE_META + x`` to define multiple user attributes. Attribute type: Variant

----

.. _enum_TLShapedAttributedString_TextVAlign:

.. _class_TLShapedAttributedString_constant_TEXT_VALIGN_TOP:

.. _class_TLShapedAttributedString_constant_TEXT_VALIGN_CENTER:

.. _class_TLShapedAttributedString_constant_TEXT_VALIGN_BOTTOM:

enum **TextVAlign**:

- **TEXT_VALIGN_TOP** = **0** --- Inline vertical top alignment.

- **TEXT_VALIGN_CENTER** = **1** --- Inline vertical center alignment.

- **TEXT_VALIGN_BOTTOM** = **2** --- Inline vertical bottom alignment.

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

.. _class_TLShapedAttributedString_property_attributes_dict:

- Array **attributes_dict**

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

   +----------+-----------------------------+
   | *Setter* | load_attributes_dict(value) |
   +----------+-----------------------------+
   | *Getter* | save_attributes_dict()      |
   +----------+-----------------------------+

Array of attribute Dictionary.

----

.. _class_TLShapedAttributedString_property_attribute/type:

- int **attribute/type**

Temporary attribute type, temporary attributes can be committed to the string by calling :ref:`commit_attribute<class_TLShapedAttributedString_method_commit_attribute>`.

----

.. _class_TLShapedAttributedString_property_attribute/value:

- Variant **attribute/value**

Temporary attribute value, temporary attributes can be committed to the string by calling :ref:`commit_attribute<class_TLShapedAttributedString_method_commit_attribute>`.

----

.. _class_TLShapedAttributedString_property_attribute/start:

- int **attribute/start**

Temporary attribute start offset, temporary attributes can be committed to the string by calling :ref:`commit_attribute<class_TLShapedAttributedString_method_commit_attribute>`.

----

.. _class_TLShapedAttributedString_property_attribute/end:

- int **attribute/end**

Temporary attribute end offset, temporary attributes can be committed to the string by calling :ref:`commit_attribute<class_TLShapedAttributedString_method_commit_attribute>`.

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

.. _class_TLShapedAttributedString_method_add_attribute:

- void **add_attribute** **(** int attribute, Variant value, int start, int end **)**

Sets ``attribute`` attribute to ``value`` for specified text range.

----

.. _class_TLShapedAttributedString_method_clear_attributes:

- void **clear_attributes** **(** **)**

Removes all attributes.

----

.. _class_TLShapedAttributedString_method_commit_attribute:

- void **commit_attribute** **(** **)**

----

.. _class_TLShapedAttributedString_method_get_attribute:

- Variant **get_attribute** **(** int attribute, int index **)** const

Returns ``attribute`` attribute value for specified text position.

----

.. _class_TLShapedAttributedString_method_get_attribute_end:

- int **get_attribute_end** **(** int attribute, int index **)** const

Returns last position of ``attribute`` attribute run enclosing specified position.

----

.. _class_TLShapedAttributedString_method_get_attribute_start:

- int **get_attribute_start** **(** int attribute, int index **)** const

Returns first position of ``attribute`` attribute run enclosing specified position.

----

.. _class_TLShapedAttributedString_method_get_embedded_rects:

- Array **get_embedded_rects** **(** **)**

Returns bounding rectangles of embedded objects (``TEXT_ATTRIBUTE_REPLACEMENT_RECT`` attributes).

----

.. _class_TLShapedAttributedString_method_has_attribute:

- bool **has_attribute** **(** int attribute, int index **)** const

Returns ``true`` if specified position has ``attribute`` attribute set.

----

.. _class_TLShapedAttributedString_method_load_attributes_dict:

- void **load_attributes_dict** **(** Array array **)**

Loads attributes from Array of Dictionary.

----

.. _class_TLShapedAttributedString_method_remove_attribute:

- void **remove_attribute** **(** int attribute, int start, int end **)**

Removes ``attribute`` attribute for specified text range.

----

.. _class_TLShapedAttributedString_method_remove_attributes:

- void **remove_attributes** **(** int start, int end **)**

Removes all attributes for specified text range.

----

.. _class_TLShapedAttributedString_method_save_attributes_dict:

- Array **save_attributes_dict** **(** **)** const

Stores string attributes into Array of Dictionary.

