mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-03 05:48:42 +03:00
588 lines
43 KiB
ReStructuredText
588 lines
43 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the TextParagraph.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_TextParagraph:
|
|
|
|
TextParagraph
|
|
=============
|
|
|
|
**Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
Holds a paragraph of text.
|
|
|
|
Description
|
|
-----------
|
|
|
|
Abstraction over :ref:`TextServer<class_TextServer>` for handling paragraph of text.
|
|
|
|
Properties
|
|
----------
|
|
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`alignment<class_TextParagraph_property_alignment>` | ``0`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`String<class_String>` | :ref:`custom_punctuation<class_TextParagraph_property_custom_punctuation>` | ``""`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`Direction<enum_TextServer_Direction>` | :ref:`direction<class_TextParagraph_property_direction>` | ``0`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`int<class_int>` | :ref:`flags<class_TextParagraph_property_flags>` | ``99`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`int<class_int>` | :ref:`max_lines_visible<class_TextParagraph_property_max_lines_visible>` | ``-1`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`Orientation<enum_TextServer_Orientation>` | :ref:`orientation<class_TextParagraph_property_orientation>` | ``0`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`bool<class_bool>` | :ref:`preserve_control<class_TextParagraph_property_preserve_control>` | ``false`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`bool<class_bool>` | :ref:`preserve_invalid<class_TextParagraph_property_preserve_invalid>` | ``true`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`OverrunBehavior<enum_TextParagraph_OverrunBehavior>` | :ref:`text_overrun_behavior<class_TextParagraph_property_text_overrun_behavior>` | ``0`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`float<class_float>` | :ref:`width<class_TextParagraph_property_width>` | ``-1.0`` |
|
|
+-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
|
|
|
|
Methods
|
|
-------
|
|
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`add_object<class_TextParagraph_method_add_object>` **(** :ref:`Variant<class_Variant>` key, :ref:`Vector2<class_Vector2>` size, :ref:`InlineAlignment<enum_@GlobalScope_InlineAlignment>` inline_align=5, :ref:`int<class_int>` length=1 **)** |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`add_string<class_TextParagraph_method_add_string>` **(** :ref:`String<class_String>` text, :ref:`Font<class_Font>` fonts, :ref:`int<class_int>` size, :ref:`Dictionary<class_Dictionary>` opentype_features={}, :ref:`String<class_String>` language="", :ref:`Variant<class_Variant>` meta=null **)** |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`clear<class_TextParagraph_method_clear>` **(** **)** |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`clear_dropcap<class_TextParagraph_method_clear_dropcap>` **(** **)** |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`draw<class_TextParagraph_method_draw>` **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1), :ref:`Color<class_Color>` dc_color=Color(1, 1, 1, 1) **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`draw_dropcap<class_TextParagraph_method_draw_dropcap>` **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1) **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`draw_dropcap_outline<class_TextParagraph_method_draw_dropcap_outline>` **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` outline_size=1, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1) **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`draw_line<class_TextParagraph_method_draw_line>` **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` line, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1) **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`draw_line_outline<class_TextParagraph_method_draw_line_outline>` **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` line, :ref:`int<class_int>` outline_size=1, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1) **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`draw_outline<class_TextParagraph_method_draw_outline>` **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` outline_size=1, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1), :ref:`Color<class_Color>` dc_color=Color(1, 1, 1, 1) **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_dropcap_lines<class_TextParagraph_method_get_dropcap_lines>` **(** **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`get_dropcap_rid<class_TextParagraph_method_get_dropcap_rid>` **(** **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_dropcap_size<class_TextParagraph_method_get_dropcap_size>` **(** **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_line_ascent<class_TextParagraph_method_get_line_ascent>` **(** :ref:`int<class_int>` line **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_line_count<class_TextParagraph_method_get_line_count>` **(** **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_line_descent<class_TextParagraph_method_get_line_descent>` **(** :ref:`int<class_int>` line **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Rect2<class_Rect2>` | :ref:`get_line_object_rect<class_TextParagraph_method_get_line_object_rect>` **(** :ref:`int<class_int>` line, :ref:`Variant<class_Variant>` key **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Array<class_Array>` | :ref:`get_line_objects<class_TextParagraph_method_get_line_objects>` **(** :ref:`int<class_int>` line **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2i<class_Vector2i>` | :ref:`get_line_range<class_TextParagraph_method_get_line_range>` **(** :ref:`int<class_int>` line **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`get_line_rid<class_TextParagraph_method_get_line_rid>` **(** :ref:`int<class_int>` line **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_line_size<class_TextParagraph_method_get_line_size>` **(** :ref:`int<class_int>` line **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_line_underline_position<class_TextParagraph_method_get_line_underline_position>` **(** :ref:`int<class_int>` line **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_line_underline_thickness<class_TextParagraph_method_get_line_underline_thickness>` **(** :ref:`int<class_int>` line **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_line_width<class_TextParagraph_method_get_line_width>` **(** :ref:`int<class_int>` line **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_non_wrapped_size<class_TextParagraph_method_get_non_wrapped_size>` **(** **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`get_rid<class_TextParagraph_method_get_rid>` **(** **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_size<class_TextParagraph_method_get_size>` **(** **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_spacing_bottom<class_TextParagraph_method_get_spacing_bottom>` **(** **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_spacing_top<class_TextParagraph_method_get_spacing_top>` **(** **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`hit_test<class_TextParagraph_method_hit_test>` **(** :ref:`Vector2<class_Vector2>` coords **)** |const| |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`resize_object<class_TextParagraph_method_resize_object>` **(** :ref:`Variant<class_Variant>` key, :ref:`Vector2<class_Vector2>` size, :ref:`InlineAlignment<enum_@GlobalScope_InlineAlignment>` inline_align=5 **)** |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_bidi_override<class_TextParagraph_method_set_bidi_override>` **(** :ref:`Array<class_Array>` override **)** |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`set_dropcap<class_TextParagraph_method_set_dropcap>` **(** :ref:`String<class_String>` text, :ref:`Font<class_Font>` fonts, :ref:`int<class_int>` size, :ref:`Rect2<class_Rect2>` dropcap_margins=Rect2(0, 0, 0, 0), :ref:`Dictionary<class_Dictionary>` opentype_features={}, :ref:`String<class_String>` language="" **)** |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`tab_align<class_TextParagraph_method_tab_align>` **(** :ref:`PackedFloat32Array<class_PackedFloat32Array>` tab_stops **)** |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Enumerations
|
|
------------
|
|
|
|
.. _enum_TextParagraph_OverrunBehavior:
|
|
|
|
.. _class_TextParagraph_constant_OVERRUN_NO_TRIMMING:
|
|
|
|
.. _class_TextParagraph_constant_OVERRUN_TRIM_CHAR:
|
|
|
|
.. _class_TextParagraph_constant_OVERRUN_TRIM_WORD:
|
|
|
|
.. _class_TextParagraph_constant_OVERRUN_TRIM_ELLIPSIS:
|
|
|
|
.. _class_TextParagraph_constant_OVERRUN_TRIM_WORD_ELLIPSIS:
|
|
|
|
enum **OverrunBehavior**:
|
|
|
|
- **OVERRUN_NO_TRIMMING** = **0** --- No text trimming is performed.
|
|
|
|
- **OVERRUN_TRIM_CHAR** = **1** --- Trims the text per character.
|
|
|
|
- **OVERRUN_TRIM_WORD** = **2** --- Trims the text per word.
|
|
|
|
- **OVERRUN_TRIM_ELLIPSIS** = **3** --- Trims the text per character and adds an ellipsis to indicate that parts are hidden.
|
|
|
|
- **OVERRUN_TRIM_WORD_ELLIPSIS** = **4** --- Trims the text per word and adds an ellipsis to indicate that parts are hidden.
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_TextParagraph_property_alignment:
|
|
|
|
- :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **alignment**
|
|
|
|
+-----------+----------------------+
|
|
| *Default* | ``0`` |
|
|
+-----------+----------------------+
|
|
| *Setter* | set_alignment(value) |
|
|
+-----------+----------------------+
|
|
| *Getter* | get_alignment() |
|
|
+-----------+----------------------+
|
|
|
|
Paragraph horizontal alignment.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_property_custom_punctuation:
|
|
|
|
- :ref:`String<class_String>` **custom_punctuation**
|
|
|
|
+-----------+-------------------------------+
|
|
| *Default* | ``""`` |
|
|
+-----------+-------------------------------+
|
|
| *Setter* | set_custom_punctuation(value) |
|
|
+-----------+-------------------------------+
|
|
| *Getter* | get_custom_punctuation() |
|
|
+-----------+-------------------------------+
|
|
|
|
Custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_property_direction:
|
|
|
|
- :ref:`Direction<enum_TextServer_Direction>` **direction**
|
|
|
|
+-----------+----------------------+
|
|
| *Default* | ``0`` |
|
|
+-----------+----------------------+
|
|
| *Setter* | set_direction(value) |
|
|
+-----------+----------------------+
|
|
| *Getter* | get_direction() |
|
|
+-----------+----------------------+
|
|
|
|
Text writing direction.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_property_flags:
|
|
|
|
- :ref:`int<class_int>` **flags**
|
|
|
|
+-----------+------------------+
|
|
| *Default* | ``99`` |
|
|
+-----------+------------------+
|
|
| *Setter* | set_flags(value) |
|
|
+-----------+------------------+
|
|
| *Getter* | get_flags() |
|
|
+-----------+------------------+
|
|
|
|
Line breaking and alignment rules. For more info see :ref:`TextServer<class_TextServer>`.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_property_max_lines_visible:
|
|
|
|
- :ref:`int<class_int>` **max_lines_visible**
|
|
|
|
+-----------+------------------------------+
|
|
| *Default* | ``-1`` |
|
|
+-----------+------------------------------+
|
|
| *Setter* | set_max_lines_visible(value) |
|
|
+-----------+------------------------------+
|
|
| *Getter* | get_max_lines_visible() |
|
|
+-----------+------------------------------+
|
|
|
|
Limits the lines of text shown.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_property_orientation:
|
|
|
|
- :ref:`Orientation<enum_TextServer_Orientation>` **orientation**
|
|
|
|
+-----------+------------------------+
|
|
| *Default* | ``0`` |
|
|
+-----------+------------------------+
|
|
| *Setter* | set_orientation(value) |
|
|
+-----------+------------------------+
|
|
| *Getter* | get_orientation() |
|
|
+-----------+------------------------+
|
|
|
|
Text orientation.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_property_preserve_control:
|
|
|
|
- :ref:`bool<class_bool>` **preserve_control**
|
|
|
|
+-----------+-----------------------------+
|
|
| *Default* | ``false`` |
|
|
+-----------+-----------------------------+
|
|
| *Setter* | set_preserve_control(value) |
|
|
+-----------+-----------------------------+
|
|
| *Getter* | get_preserve_control() |
|
|
+-----------+-----------------------------+
|
|
|
|
If set to ``true`` text will display control characters.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_property_preserve_invalid:
|
|
|
|
- :ref:`bool<class_bool>` **preserve_invalid**
|
|
|
|
+-----------+-----------------------------+
|
|
| *Default* | ``true`` |
|
|
+-----------+-----------------------------+
|
|
| *Setter* | set_preserve_invalid(value) |
|
|
+-----------+-----------------------------+
|
|
| *Getter* | get_preserve_invalid() |
|
|
+-----------+-----------------------------+
|
|
|
|
If set to ``true`` text will display invalid characters.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_property_text_overrun_behavior:
|
|
|
|
- :ref:`OverrunBehavior<enum_TextParagraph_OverrunBehavior>` **text_overrun_behavior**
|
|
|
|
+-----------+----------------------------------+
|
|
| *Default* | ``0`` |
|
|
+-----------+----------------------------------+
|
|
| *Setter* | set_text_overrun_behavior(value) |
|
|
+-----------+----------------------------------+
|
|
| *Getter* | get_text_overrun_behavior() |
|
|
+-----------+----------------------------------+
|
|
|
|
Sets the clipping behavior when the text exceeds the paragraph's set width. See :ref:`OverrunBehavior<enum_TextParagraph_OverrunBehavior>` for a description of all modes.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_property_width:
|
|
|
|
- :ref:`float<class_float>` **width**
|
|
|
|
+-----------+------------------+
|
|
| *Default* | ``-1.0`` |
|
|
+-----------+------------------+
|
|
| *Setter* | set_width(value) |
|
|
+-----------+------------------+
|
|
| *Getter* | get_width() |
|
|
+-----------+------------------+
|
|
|
|
Paragraph width.
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_TextParagraph_method_add_object:
|
|
|
|
- :ref:`bool<class_bool>` **add_object** **(** :ref:`Variant<class_Variant>` key, :ref:`Vector2<class_Vector2>` size, :ref:`InlineAlignment<enum_@GlobalScope_InlineAlignment>` inline_align=5, :ref:`int<class_int>` length=1 **)**
|
|
|
|
Adds inline object to the text buffer, ``key`` must be unique. In the text, object is represented as ``length`` object replacement characters.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_add_string:
|
|
|
|
- :ref:`bool<class_bool>` **add_string** **(** :ref:`String<class_String>` text, :ref:`Font<class_Font>` fonts, :ref:`int<class_int>` size, :ref:`Dictionary<class_Dictionary>` opentype_features={}, :ref:`String<class_String>` language="", :ref:`Variant<class_Variant>` meta=null **)**
|
|
|
|
Adds text span and font to draw it.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_clear:
|
|
|
|
- void **clear** **(** **)**
|
|
|
|
Clears text paragraph (removes text and inline objects).
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_clear_dropcap:
|
|
|
|
- void **clear_dropcap** **(** **)**
|
|
|
|
Removes dropcap.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_draw:
|
|
|
|
- void **draw** **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1), :ref:`Color<class_Color>` dc_color=Color(1, 1, 1, 1) **)** |const|
|
|
|
|
Draw all lines of the text and drop cap into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_draw_dropcap:
|
|
|
|
- void **draw_dropcap** **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1) **)** |const|
|
|
|
|
Draw drop cap into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_draw_dropcap_outline:
|
|
|
|
- void **draw_dropcap_outline** **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` outline_size=1, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1) **)** |const|
|
|
|
|
Draw drop cap outline into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_draw_line:
|
|
|
|
- void **draw_line** **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` line, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1) **)** |const|
|
|
|
|
Draw single line of text into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_draw_line_outline:
|
|
|
|
- void **draw_line_outline** **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` line, :ref:`int<class_int>` outline_size=1, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1) **)** |const|
|
|
|
|
Draw outline of the single line of text into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_draw_outline:
|
|
|
|
- void **draw_outline** **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`int<class_int>` outline_size=1, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1), :ref:`Color<class_Color>` dc_color=Color(1, 1, 1, 1) **)** |const|
|
|
|
|
Draw outlines of all lines of the text and drop cap into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_dropcap_lines:
|
|
|
|
- :ref:`int<class_int>` **get_dropcap_lines** **(** **)** |const|
|
|
|
|
Returns number of lines used by dropcap.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_dropcap_rid:
|
|
|
|
- :ref:`RID<class_RID>` **get_dropcap_rid** **(** **)** |const|
|
|
|
|
Returns drop cap text buffer RID.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_dropcap_size:
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_dropcap_size** **(** **)** |const|
|
|
|
|
Returns drop cap bounding box size.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_ascent:
|
|
|
|
- :ref:`float<class_float>` **get_line_ascent** **(** :ref:`int<class_int>` line **)** |const|
|
|
|
|
Returns the text line ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_count:
|
|
|
|
- :ref:`int<class_int>` **get_line_count** **(** **)** |const|
|
|
|
|
Returns number of lines in the paragraph.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_descent:
|
|
|
|
- :ref:`float<class_float>` **get_line_descent** **(** :ref:`int<class_int>` line **)** |const|
|
|
|
|
Returns the text line descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_object_rect:
|
|
|
|
- :ref:`Rect2<class_Rect2>` **get_line_object_rect** **(** :ref:`int<class_int>` line, :ref:`Variant<class_Variant>` key **)** |const|
|
|
|
|
Returns bounding rectangle of the inline object.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_objects:
|
|
|
|
- :ref:`Array<class_Array>` **get_line_objects** **(** :ref:`int<class_int>` line **)** |const|
|
|
|
|
Returns array of inline objects in the line.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_range:
|
|
|
|
- :ref:`Vector2i<class_Vector2i>` **get_line_range** **(** :ref:`int<class_int>` line **)** |const|
|
|
|
|
Returns character range of the line.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_rid:
|
|
|
|
- :ref:`RID<class_RID>` **get_line_rid** **(** :ref:`int<class_int>` line **)** |const|
|
|
|
|
Returns TextServer line buffer RID.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_size:
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_line_size** **(** :ref:`int<class_int>` line **)** |const|
|
|
|
|
Returns size of the bounding box of the line of text.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_underline_position:
|
|
|
|
- :ref:`float<class_float>` **get_line_underline_position** **(** :ref:`int<class_int>` line **)** |const|
|
|
|
|
Returns pixel offset of the underline below the baseline.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_underline_thickness:
|
|
|
|
- :ref:`float<class_float>` **get_line_underline_thickness** **(** :ref:`int<class_int>` line **)** |const|
|
|
|
|
Returns thickness of the underline.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_line_width:
|
|
|
|
- :ref:`float<class_float>` **get_line_width** **(** :ref:`int<class_int>` line **)** |const|
|
|
|
|
Returns width (for horizontal layout) or height (for vertical) of the line of text.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_non_wrapped_size:
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_non_wrapped_size** **(** **)** |const|
|
|
|
|
Returns the size of the bounding box of the paragraph, without line breaks.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_rid:
|
|
|
|
- :ref:`RID<class_RID>` **get_rid** **(** **)** |const|
|
|
|
|
Returns TextServer full string buffer RID.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_size:
|
|
|
|
- :ref:`Vector2<class_Vector2>` **get_size** **(** **)** |const|
|
|
|
|
Returns the size of the bounding box of the paragraph.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_spacing_bottom:
|
|
|
|
- :ref:`int<class_int>` **get_spacing_bottom** **(** **)** |const|
|
|
|
|
Returns extra spacing at the bottom of the line. See :ref:`Font.spacing_bottom<class_Font_property_spacing_bottom>`.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_get_spacing_top:
|
|
|
|
- :ref:`int<class_int>` **get_spacing_top** **(** **)** |const|
|
|
|
|
Returns extra spacing at the top of the line. See :ref:`Font.spacing_top<class_Font_property_spacing_top>`.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_hit_test:
|
|
|
|
- :ref:`int<class_int>` **hit_test** **(** :ref:`Vector2<class_Vector2>` coords **)** |const|
|
|
|
|
Returns caret character offset at the specified coordinates. This function always returns a valid position.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_resize_object:
|
|
|
|
- :ref:`bool<class_bool>` **resize_object** **(** :ref:`Variant<class_Variant>` key, :ref:`Vector2<class_Vector2>` size, :ref:`InlineAlignment<enum_@GlobalScope_InlineAlignment>` inline_align=5 **)**
|
|
|
|
Sets new size and alignment of embedded object.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_set_bidi_override:
|
|
|
|
- void **set_bidi_override** **(** :ref:`Array<class_Array>` override **)**
|
|
|
|
Overrides BiDi for the structured text.
|
|
|
|
Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_set_dropcap:
|
|
|
|
- :ref:`bool<class_bool>` **set_dropcap** **(** :ref:`String<class_String>` text, :ref:`Font<class_Font>` fonts, :ref:`int<class_int>` size, :ref:`Rect2<class_Rect2>` dropcap_margins=Rect2(0, 0, 0, 0), :ref:`Dictionary<class_Dictionary>` opentype_features={}, :ref:`String<class_String>` language="" **)**
|
|
|
|
Sets drop cap, overrides previously set drop cap. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.
|
|
|
|
----
|
|
|
|
.. _class_TextParagraph_method_tab_align:
|
|
|
|
- void **tab_align** **(** :ref:`PackedFloat32Array<class_PackedFloat32Array>` tab_stops **)**
|
|
|
|
Aligns paragraph to the given tab-stops.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
|
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
|
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|