123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/TextLine.xml.
- .. _class_TextLine:
- TextLine
- ========
- **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- Holds a line of text.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- Abstraction over :ref:`TextServer<class_TextServer>` for handling a single line of text.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- | :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`alignment<class_TextLine_property_alignment>` | ``0`` |
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- | :ref:`Direction<enum_TextServer_Direction>` | :ref:`direction<class_TextLine_property_direction>` | ``0`` |
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- | :ref:`String<class_String>` | :ref:`ellipsis_char<class_TextLine_property_ellipsis_char>` | ``"…"`` |
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- | |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] | :ref:`flags<class_TextLine_property_flags>` | ``3`` |
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- | :ref:`Orientation<enum_TextServer_Orientation>` | :ref:`orientation<class_TextLine_property_orientation>` | ``0`` |
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`preserve_control<class_TextLine_property_preserve_control>` | ``false`` |
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`preserve_invalid<class_TextLine_property_preserve_invalid>` | ``true`` |
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- | :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` | :ref:`text_overrun_behavior<class_TextLine_property_text_overrun_behavior>` | ``3`` |
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`width<class_TextLine_property_width>` | ``-1.0`` |
- +---------------------------------------------------------------------------+-----------------------------------------------------------------------------+-----------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`add_object<class_TextLine_method_add_object>`\ (\ key\: :ref:`Variant<class_Variant>`, size\: :ref:`Vector2<class_Vector2>`, inline_align\: :ref:`InlineAlignment<enum_@GlobalScope_InlineAlignment>` = 5, length\: :ref:`int<class_int>` = 1, baseline\: :ref:`float<class_float>` = 0.0\ ) |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`add_string<class_TextLine_method_add_string>`\ (\ text\: :ref:`String<class_String>`, font\: :ref:`Font<class_Font>`, font_size\: :ref:`int<class_int>`, language\: :ref:`String<class_String>` = "", meta\: :ref:`Variant<class_Variant>` = null\ ) |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`clear<class_TextLine_method_clear>`\ (\ ) |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`draw<class_TextLine_method_draw>`\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`draw_outline<class_TextLine_method_draw_outline>`\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, outline_size\: :ref:`int<class_int>` = 1, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_line_ascent<class_TextLine_method_get_line_ascent>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_line_descent<class_TextLine_method_get_line_descent>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_line_underline_position<class_TextLine_method_get_line_underline_position>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_line_underline_thickness<class_TextLine_method_get_line_underline_thickness>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_line_width<class_TextLine_method_get_line_width>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Rect2<class_Rect2>` | :ref:`get_object_rect<class_TextLine_method_get_object_rect>`\ (\ key\: :ref:`Variant<class_Variant>`\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Array<class_Array>` | :ref:`get_objects<class_TextLine_method_get_objects>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`RID<class_RID>` | :ref:`get_rid<class_TextLine_method_get_rid>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Vector2<class_Vector2>` | :ref:`get_size<class_TextLine_method_get_size>`\ (\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`hit_test<class_TextLine_method_hit_test>`\ (\ coords\: :ref:`float<class_float>`\ ) |const| |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`resize_object<class_TextLine_method_resize_object>`\ (\ key\: :ref:`Variant<class_Variant>`, size\: :ref:`Vector2<class_Vector2>`, inline_align\: :ref:`InlineAlignment<enum_@GlobalScope_InlineAlignment>` = 5, baseline\: :ref:`float<class_float>` = 0.0\ ) |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_bidi_override<class_TextLine_method_set_bidi_override>`\ (\ override\: :ref:`Array<class_Array>`\ ) |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`tab_align<class_TextLine_method_tab_align>`\ (\ tab_stops\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) |
- +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_TextLine_property_alignment:
- .. rst-class:: classref-property
- :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **alignment** = ``0`` :ref:`🔗<class_TextLine_property_alignment>`
- .. rst-class:: classref-property-setget
- - |void| **set_horizontal_alignment**\ (\ value\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>`\ )
- - :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_horizontal_alignment**\ (\ )
- Sets text alignment within the line as if the line was horizontal.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_property_direction:
- .. rst-class:: classref-property
- :ref:`Direction<enum_TextServer_Direction>` **direction** = ``0`` :ref:`🔗<class_TextLine_property_direction>`
- .. rst-class:: classref-property-setget
- - |void| **set_direction**\ (\ value\: :ref:`Direction<enum_TextServer_Direction>`\ )
- - :ref:`Direction<enum_TextServer_Direction>` **get_direction**\ (\ )
- Text writing direction.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_property_ellipsis_char:
- .. rst-class:: classref-property
- :ref:`String<class_String>` **ellipsis_char** = ``"…"`` :ref:`🔗<class_TextLine_property_ellipsis_char>`
- .. rst-class:: classref-property-setget
- - |void| **set_ellipsis_char**\ (\ value\: :ref:`String<class_String>`\ )
- - :ref:`String<class_String>` **get_ellipsis_char**\ (\ )
- Ellipsis character used for text clipping.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_property_flags:
- .. rst-class:: classref-property
- |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] **flags** = ``3`` :ref:`🔗<class_TextLine_property_flags>`
- .. rst-class:: classref-property-setget
- - |void| **set_flags**\ (\ value\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\]\ )
- - |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] **get_flags**\ (\ )
- Line alignment rules. For more info see :ref:`TextServer<class_TextServer>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_property_orientation:
- .. rst-class:: classref-property
- :ref:`Orientation<enum_TextServer_Orientation>` **orientation** = ``0`` :ref:`🔗<class_TextLine_property_orientation>`
- .. rst-class:: classref-property-setget
- - |void| **set_orientation**\ (\ value\: :ref:`Orientation<enum_TextServer_Orientation>`\ )
- - :ref:`Orientation<enum_TextServer_Orientation>` **get_orientation**\ (\ )
- Text orientation.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_property_preserve_control:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **preserve_control** = ``false`` :ref:`🔗<class_TextLine_property_preserve_control>`
- .. rst-class:: classref-property-setget
- - |void| **set_preserve_control**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **get_preserve_control**\ (\ )
- If set to ``true`` text will display control characters.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_property_preserve_invalid:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **preserve_invalid** = ``true`` :ref:`🔗<class_TextLine_property_preserve_invalid>`
- .. rst-class:: classref-property-setget
- - |void| **set_preserve_invalid**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **get_preserve_invalid**\ (\ )
- If set to ``true`` text will display invalid characters.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_property_text_overrun_behavior:
- .. rst-class:: classref-property
- :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **text_overrun_behavior** = ``3`` :ref:`🔗<class_TextLine_property_text_overrun_behavior>`
- .. rst-class:: classref-property-setget
- - |void| **set_text_overrun_behavior**\ (\ value\: :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>`\ )
- - :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **get_text_overrun_behavior**\ (\ )
- Sets the clipping behavior when the text exceeds the text line's set width. See :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` for a description of all modes.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_property_width:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **width** = ``-1.0`` :ref:`🔗<class_TextLine_property_width>`
- .. rst-class:: classref-property-setget
- - |void| **set_width**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_width**\ (\ )
- Text line width.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_TextLine_method_add_object:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **add_object**\ (\ key\: :ref:`Variant<class_Variant>`, size\: :ref:`Vector2<class_Vector2>`, inline_align\: :ref:`InlineAlignment<enum_@GlobalScope_InlineAlignment>` = 5, length\: :ref:`int<class_int>` = 1, baseline\: :ref:`float<class_float>` = 0.0\ ) :ref:`🔗<class_TextLine_method_add_object>`
- Adds inline object to the text buffer, ``key`` must be unique. In the text, object is represented as ``length`` object replacement characters.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_add_string:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **add_string**\ (\ text\: :ref:`String<class_String>`, font\: :ref:`Font<class_Font>`, font_size\: :ref:`int<class_int>`, language\: :ref:`String<class_String>` = "", meta\: :ref:`Variant<class_Variant>` = null\ ) :ref:`🔗<class_TextLine_method_add_string>`
- Adds text span and font to draw it.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_clear:
- .. rst-class:: classref-method
- |void| **clear**\ (\ ) :ref:`🔗<class_TextLine_method_clear>`
- Clears text line (removes text and inline objects).
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_draw:
- .. rst-class:: classref-method
- |void| **draw**\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| :ref:`🔗<class_TextLine_method_draw>`
- Draw text into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_draw_outline:
- .. rst-class:: classref-method
- |void| **draw_outline**\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, outline_size\: :ref:`int<class_int>` = 1, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| :ref:`🔗<class_TextLine_method_draw_outline>`
- Draw text into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_get_line_ascent:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_line_ascent**\ (\ ) |const| :ref:`🔗<class_TextLine_method_get_line_ascent>`
- Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_get_line_descent:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_line_descent**\ (\ ) |const| :ref:`🔗<class_TextLine_method_get_line_descent>`
- Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_get_line_underline_position:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_line_underline_position**\ (\ ) |const| :ref:`🔗<class_TextLine_method_get_line_underline_position>`
- Returns pixel offset of the underline below the baseline.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_get_line_underline_thickness:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_line_underline_thickness**\ (\ ) |const| :ref:`🔗<class_TextLine_method_get_line_underline_thickness>`
- Returns thickness of the underline.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_get_line_width:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_line_width**\ (\ ) |const| :ref:`🔗<class_TextLine_method_get_line_width>`
- Returns width (for horizontal layout) or height (for vertical) of the text.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_get_object_rect:
- .. rst-class:: classref-method
- :ref:`Rect2<class_Rect2>` **get_object_rect**\ (\ key\: :ref:`Variant<class_Variant>`\ ) |const| :ref:`🔗<class_TextLine_method_get_object_rect>`
- Returns bounding rectangle of the inline object.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_get_objects:
- .. rst-class:: classref-method
- :ref:`Array<class_Array>` **get_objects**\ (\ ) |const| :ref:`🔗<class_TextLine_method_get_objects>`
- Returns array of inline objects.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_get_rid:
- .. rst-class:: classref-method
- :ref:`RID<class_RID>` **get_rid**\ (\ ) |const| :ref:`🔗<class_TextLine_method_get_rid>`
- Returns TextServer buffer RID.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_get_size:
- .. rst-class:: classref-method
- :ref:`Vector2<class_Vector2>` **get_size**\ (\ ) |const| :ref:`🔗<class_TextLine_method_get_size>`
- Returns size of the bounding box of the text.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_hit_test:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **hit_test**\ (\ coords\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_TextLine_method_hit_test>`
- Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_resize_object:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **resize_object**\ (\ key\: :ref:`Variant<class_Variant>`, size\: :ref:`Vector2<class_Vector2>`, inline_align\: :ref:`InlineAlignment<enum_@GlobalScope_InlineAlignment>` = 5, baseline\: :ref:`float<class_float>` = 0.0\ ) :ref:`🔗<class_TextLine_method_resize_object>`
- Sets new size and alignment of embedded object.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_set_bidi_override:
- .. rst-class:: classref-method
- |void| **set_bidi_override**\ (\ override\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_TextLine_method_set_bidi_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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_TextLine_method_tab_align:
- .. rst-class:: classref-method
- |void| **tab_align**\ (\ tab_stops\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) :ref:`🔗<class_TextLine_method_tab_align>`
- Aligns text 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.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|