:github_url: hide

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

.. _class_TLRichTextEdit:

TLRichTextEdit
==============

**Inherits:** 

**Category:** Core

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

Rich text display and input control.

Rich text can contain custom text, fonts, images and formatting.

Properties
----------

+---------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
| Color                                             | :ref:`back_color<class_TLRichTextEdit_property_back_color>`                 | Color( 1, 1, 1, 0 ) |
+---------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
| Control.FocusMode                                 | focus_mode                                                                  | **O:** 2            |
+---------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
| float                                             | :ref:`paragraph_spacing<class_TLRichTextEdit_property_paragraph_spacing>`   | 3.0                 |
+---------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
| bool                                              | :ref:`readonly<class_TLRichTextEdit_property_readonly>`                     | false               |
+---------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
| bool                                              | :ref:`selectable<class_TLRichTextEdit_property_selectable>`                 | true                |
+---------------------------------------------------+-----------------------------------------------------------------------------+---------------------+
| :ref:`TLShapedParagraph<class_TLShapedParagraph>` | :ref:`paragraphs/{index}<class_TLRichTextEdit_property_paragraphs/{index}>` |                     |
+---------------------------------------------------+-----------------------------------------------------------------------------+---------------------+

Methods
-------

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

   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`add_attribute<class_TLRichTextEdit_method_add_attribute>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int attribute, Variant value **)**                         |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`clear<class_TLRichTextEdit_method_clear>` **(** **)**                                                                                                                                               |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`debug_draw<class_TLRichTextEdit_method_debug_draw>` **(** RID rid, Vector2 position, Vector2 hit_position, bool draw_brk_ops, bool draw_jst_ops **)**                                               |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`debug_draw_as_hex<class_TLRichTextEdit_method_debug_draw_as_hex>` **(** RID rid, Vector2 position, Vector2 hit_position, bool draw_brk_ops, bool draw_jst_ops **)**                                 |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`debug_draw_logical_as_hex<class_TLRichTextEdit_method_debug_draw_logical_as_hex>` **(** RID rid, Vector2 position, Vector2 hit_position, bool draw_brk_ops, bool draw_jst_ops **)**                 |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | Vector2                                                       | :ref:`get_caret_position<class_TLRichTextEdit_method_get_caret_position>` **(** **)**                                                                                                                     |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | String                                                        | :ref:`get_cluster_debug_info_hit_test<class_TLRichTextEdit_method_get_cluster_debug_info_hit_test>` **(** Vector2 position **)**                                                                          |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | Array                                                         | :ref:`get_cluster_glyphs_hit_test<class_TLRichTextEdit_method_get_cluster_glyphs_hit_test>` **(** Vector2 position **)**                                                                                  |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | Rect2                                                         | :ref:`get_cluster_rect_hit_test<class_TLRichTextEdit_method_get_cluster_rect_hit_test>` **(** Vector2 position **)**                                                                                      |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | :ref:`TLShapedParagraph<class_TLShapedParagraph>`             | :ref:`get_paragraph<class_TLRichTextEdit_method_get_paragraph>` **(** int index **)** const                                                                                                               |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | int                                                           | :ref:`get_paragraphs<class_TLRichTextEdit_method_get_paragraphs>` **(** **)**                                                                                                                             |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` | :ref:`get_selection<class_TLRichTextEdit_method_get_selection>` **(** **)** const                                                                                                                         |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | int                                                           | :ref:`insert_paragraph<class_TLRichTextEdit_method_insert_paragraph>` **(** :ref:`TLShapedParagraph<class_TLShapedParagraph>` para, int index **)**                                                       |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`remove_attribute<class_TLRichTextEdit_method_remove_attribute>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int attribute **)**                                  |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`remove_attributes<class_TLRichTextEdit_method_remove_attributes>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection **)**                                               |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`remove_paragraph<class_TLRichTextEdit_method_remove_paragraph>` **(** int index **)**                                                                                                               |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`replace_sstring<class_TLRichTextEdit_method_replace_sstring>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, :ref:`TLShapedString<class_TLShapedString>` text **)** |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`replace_text<class_TLRichTextEdit_method_replace_text>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, String text **)**                                            |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`replace_utf16<class_TLRichTextEdit_method_replace_utf16>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, PoolByteArray text **)**                                   |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`replace_utf32<class_TLRichTextEdit_method_replace_utf32>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, PoolByteArray text **)**                                   |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`replace_utf8<class_TLRichTextEdit_method_replace_utf8>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, PoolByteArray text **)**                                     |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`set_paragraph<class_TLRichTextEdit_method_set_paragraph>` **(** :ref:`TLShapedParagraph<class_TLShapedParagraph>` para, int index **)**                                                             |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`set_paragraph_back_color<class_TLRichTextEdit_method_set_paragraph_back_color>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, Color bcolor **)**                   |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`set_paragraph_brk_flags<class_TLRichTextEdit_method_set_paragraph_brk_flags>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int flags **)**                        |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`set_paragraph_halign<class_TLRichTextEdit_method_set_paragraph_halign>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int halign **)**                             |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`set_paragraph_indent<class_TLRichTextEdit_method_set_paragraph_indent>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, float indent **)**                           |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`set_paragraph_jst_flags<class_TLRichTextEdit_method_set_paragraph_jst_flags>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int flags **)**                        |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`set_paragraph_line_spacing<class_TLRichTextEdit_method_set_paragraph_line_spacing>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, float line_spacing **)**         |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`set_paragraph_width<class_TLRichTextEdit_method_set_paragraph_width>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, float width **)**                              |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | void                                                          | :ref:`set_selection<class_TLRichTextEdit_method_set_selection>` **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection **)**                                                       |
   +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Signals
-------

.. _class_TLRichTextEdit_signal_cursor_changed:

- **cursor_changed** **(** **)**

Emitted when caret moves or selection changes.

----

.. _class_TLRichTextEdit_signal_paragraph_changed:

- **paragraph_changed** **(** **)**

Emitted when paragraph text or attributes changes.

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

.. _class_TLRichTextEdit_property_back_color:

- Color **back_color**

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

   +-----------+-----------------------+
   | *Default* | Color( 1, 1, 1, 0 )   |
   +-----------+-----------------------+
   | *Setter*  | set_back_color(value) |
   +-----------+-----------------------+
   | *Getter*  | get_back_color()      |
   +-----------+-----------------------+

Background color of the control.

----

.. _class_TLRichTextEdit_property_paragraph_spacing:

- float **paragraph_spacing**

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

   +-----------+------------------------------+
   | *Default* | 3.0                          |
   +-----------+------------------------------+
   | *Setter*  | set_paragraph_spacing(value) |
   +-----------+------------------------------+
   | *Getter*  | get_paragraph_spacing()      |
   +-----------+------------------------------+

Spacing between the paragraphs in pixels.

----

.. _class_TLRichTextEdit_property_readonly:

- bool **readonly**

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

   +-----------+---------------------+
   | *Default* | false               |
   +-----------+---------------------+
   | *Setter*  | set_readonly(value) |
   +-----------+---------------------+
   | *Getter*  | get_readonly()      |
   +-----------+---------------------+

If ``true``, existing text cannot be modified and new text cannot be added.

----

.. _class_TLRichTextEdit_property_selectable:

- bool **selectable**

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

   +-----------+-----------------------+
   | *Default* | true                  |
   +-----------+-----------------------+
   | *Setter*  | set_selectable(value) |
   +-----------+-----------------------+
   | *Getter*  | get_selectable()      |
   +-----------+-----------------------+

If ``true``, the control allows text selection.

----

.. _class_TLRichTextEdit_property_paragraphs/{index}:

- :ref:`TLShapedParagraph<class_TLShapedParagraph>` **paragraphs/{index}**

Paragraphs of the text.

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

.. _class_TLRichTextEdit_method_add_attribute:

- void **add_attribute** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int attribute, Variant value **)**

Sets ``attribute`` attribute to ``value`` for the selection.

----

.. _class_TLRichTextEdit_method_clear:

- void **clear** **(** **)**

Clears the attributes and sets text to an empty string.

----

.. _class_TLRichTextEdit_method_debug_draw:

- void **debug_draw** **(** RID rid, Vector2 position, Vector2 hit_position, bool draw_brk_ops, bool draw_jst_ops **)**

``DEBUG:`` Draws text with additional debug information.

----

.. _class_TLRichTextEdit_method_debug_draw_as_hex:

- void **debug_draw_as_hex** **(** RID rid, Vector2 position, Vector2 hit_position, bool draw_brk_ops, bool draw_jst_ops **)**

``DEBUG:`` Draws text using "hexbox" fallback font.

----

.. _class_TLRichTextEdit_method_debug_draw_logical_as_hex:

- void **debug_draw_logical_as_hex** **(** RID rid, Vector2 position, Vector2 hit_position, bool draw_brk_ops, bool draw_jst_ops **)**

``DEBUG:`` Draws logical character codes of the text with additional debug information.

----

.. _class_TLRichTextEdit_method_get_caret_position:

- Vector2 **get_caret_position** **(** **)**

Returns position of the caret, in (paragraph, offset) format.

----

.. _class_TLRichTextEdit_method_get_cluster_debug_info_hit_test:

- String **get_cluster_debug_info_hit_test** **(** Vector2 position **)**

``DEBUG:`` Returns cluster hit test info.

----

.. _class_TLRichTextEdit_method_get_cluster_glyphs_hit_test:

- Array **get_cluster_glyphs_hit_test** **(** Vector2 position **)**

Returns glyph hit test info.

----

.. _class_TLRichTextEdit_method_get_cluster_rect_hit_test:

- Rect2 **get_cluster_rect_hit_test** **(** Vector2 position **)**

Returns replacement object hit test info.

----

.. _class_TLRichTextEdit_method_get_paragraph:

- :ref:`TLShapedParagraph<class_TLShapedParagraph>` **get_paragraph** **(** int index **)** const

Returns paragraph of text.

----

.. _class_TLRichTextEdit_method_get_paragraphs:

- int **get_paragraphs** **(** **)**

Returns number of paragraph in the text.

----

.. _class_TLRichTextEdit_method_get_selection:

- :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` **get_selection** **(** **)** const

Returns current selection and caret position.

----

.. _class_TLRichTextEdit_method_insert_paragraph:

- int **insert_paragraph** **(** :ref:`TLShapedParagraph<class_TLShapedParagraph>` para, int index **)**

Inserts paragraph of text at the index position.

----

.. _class_TLRichTextEdit_method_remove_attribute:

- void **remove_attribute** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int attribute **)**

Returns ``attribute`` attribute value in the selection.

----

.. _class_TLRichTextEdit_method_remove_attributes:

- void **remove_attributes** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection **)**

Removes all attributes in the selection.

----

.. _class_TLRichTextEdit_method_remove_paragraph:

- void **remove_paragraph** **(** int index **)**

Removes paragraph of the text.

----

.. _class_TLRichTextEdit_method_replace_sstring:

- void **replace_sstring** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, :ref:`TLShapedString<class_TLShapedString>` text **)**

Replaces selection with the shaped string.

----

.. _class_TLRichTextEdit_method_replace_text:

- void **replace_text** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, String text **)**

Replaces selection with the plain string.

----

.. _class_TLRichTextEdit_method_replace_utf16:

- void **replace_utf16** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, PoolByteArray text **)**

Replaces selection with the contents of the raw UTF-16 encoded string.

----

.. _class_TLRichTextEdit_method_replace_utf32:

- void **replace_utf32** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, PoolByteArray text **)**

Replaces selection with the contents of the raw UTF-32 encoded string.

----

.. _class_TLRichTextEdit_method_replace_utf8:

- void **replace_utf8** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, PoolByteArray text **)**

Replaces selection with the contents of the raw UTF-8 encoded string.

----

.. _class_TLRichTextEdit_method_set_paragraph:

- void **set_paragraph** **(** :ref:`TLShapedParagraph<class_TLShapedParagraph>` para, int index **)**

Sets content of the specific paragraph.

----

.. _class_TLRichTextEdit_method_set_paragraph_back_color:

- void **set_paragraph_back_color** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, Color bcolor **)**

Sets background color of the paragraph.

----

.. _class_TLRichTextEdit_method_set_paragraph_brk_flags:

- void **set_paragraph_brk_flags** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int flags **)**

Sets line breaking flags of the paragraph.

----

.. _class_TLRichTextEdit_method_set_paragraph_halign:

- void **set_paragraph_halign** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int halign **)**

Sets horizontal alignment of the paragraph.

----

.. _class_TLRichTextEdit_method_set_paragraph_indent:

- void **set_paragraph_indent** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, float indent **)**

Sets indentation of the paragraph.

----

.. _class_TLRichTextEdit_method_set_paragraph_jst_flags:

- void **set_paragraph_jst_flags** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, int flags **)**

Sets justification flags of the paragraph.

----

.. _class_TLRichTextEdit_method_set_paragraph_line_spacing:

- void **set_paragraph_line_spacing** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, float line_spacing **)**

Sets line spacing of the paragraph.

----

.. _class_TLRichTextEdit_method_set_paragraph_width:

- void **set_paragraph_width** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection, float width **)**

Sets max width of the paragraph.

----

.. _class_TLRichTextEdit_method_set_selection:

- void **set_selection** **(** :ref:`TLRichTextEditSelection<class_TLRichTextEditSelection>` selection **)**

Sets current selection.

