class_textparagraph.rst 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/TextParagraph.xml.
  6. .. _class_TextParagraph:
  7. TextParagraph
  8. =============
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Holds a paragraph of text.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Abstraction over :ref:`TextServer<class_TextServer>` for handling a single paragraph of text.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  21. | :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`alignment<class_TextParagraph_property_alignment>` | ``0`` |
  22. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  23. | |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] | :ref:`break_flags<class_TextParagraph_property_break_flags>` | ``3`` |
  24. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  25. | :ref:`String<class_String>` | :ref:`custom_punctuation<class_TextParagraph_property_custom_punctuation>` | ``""`` |
  26. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  27. | :ref:`Direction<enum_TextServer_Direction>` | :ref:`direction<class_TextParagraph_property_direction>` | ``0`` |
  28. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  29. | :ref:`String<class_String>` | :ref:`ellipsis_char<class_TextParagraph_property_ellipsis_char>` | ``"โ€ฆ"`` |
  30. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  31. | |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] | :ref:`justification_flags<class_TextParagraph_property_justification_flags>` | ``163`` |
  32. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  33. | :ref:`int<class_int>` | :ref:`max_lines_visible<class_TextParagraph_property_max_lines_visible>` | ``-1`` |
  34. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  35. | :ref:`Orientation<enum_TextServer_Orientation>` | :ref:`orientation<class_TextParagraph_property_orientation>` | ``0`` |
  36. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  37. | :ref:`bool<class_bool>` | :ref:`preserve_control<class_TextParagraph_property_preserve_control>` | ``false`` |
  38. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  39. | :ref:`bool<class_bool>` | :ref:`preserve_invalid<class_TextParagraph_property_preserve_invalid>` | ``true`` |
  40. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  41. | :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` | :ref:`text_overrun_behavior<class_TextParagraph_property_text_overrun_behavior>` | ``0`` |
  42. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  43. | :ref:`float<class_float>` | :ref:`width<class_TextParagraph_property_width>` | ``-1.0`` |
  44. +---------------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  45. .. rst-class:: classref-reftable-group
  46. Methods
  47. -------
  48. .. table::
  49. :widths: auto
  50. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`add_object<class_TextParagraph_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\ ) |
  52. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`add_string<class_TextParagraph_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\ ) |
  54. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | |void| | :ref:`clear<class_TextParagraph_method_clear>`\ (\ ) |
  56. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | |void| | :ref:`clear_dropcap<class_TextParagraph_method_clear_dropcap>`\ (\ ) |
  58. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | |void| | :ref:`draw<class_TextParagraph_method_draw>`\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), dc_color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| |
  60. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | |void| | :ref:`draw_dropcap<class_TextParagraph_method_draw_dropcap>`\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| |
  62. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | |void| | :ref:`draw_dropcap_outline<class_TextParagraph_method_draw_dropcap_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| |
  64. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | |void| | :ref:`draw_line<class_TextParagraph_method_draw_line>`\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, line\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| |
  66. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | |void| | :ref:`draw_line_outline<class_TextParagraph_method_draw_line_outline>`\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, line\: :ref:`int<class_int>`, outline_size\: :ref:`int<class_int>` = 1, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| |
  68. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | |void| | :ref:`draw_outline<class_TextParagraph_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), dc_color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| |
  70. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`int<class_int>` | :ref:`get_dropcap_lines<class_TextParagraph_method_get_dropcap_lines>`\ (\ ) |const| |
  72. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`RID<class_RID>` | :ref:`get_dropcap_rid<class_TextParagraph_method_get_dropcap_rid>`\ (\ ) |const| |
  74. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`Vector2<class_Vector2>` | :ref:`get_dropcap_size<class_TextParagraph_method_get_dropcap_size>`\ (\ ) |const| |
  76. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`float<class_float>` | :ref:`get_line_ascent<class_TextParagraph_method_get_line_ascent>`\ (\ line\: :ref:`int<class_int>`\ ) |const| |
  78. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`int<class_int>` | :ref:`get_line_count<class_TextParagraph_method_get_line_count>`\ (\ ) |const| |
  80. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`float<class_float>` | :ref:`get_line_descent<class_TextParagraph_method_get_line_descent>`\ (\ line\: :ref:`int<class_int>`\ ) |const| |
  82. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Rect2<class_Rect2>` | :ref:`get_line_object_rect<class_TextParagraph_method_get_line_object_rect>`\ (\ line\: :ref:`int<class_int>`, key\: :ref:`Variant<class_Variant>`\ ) |const| |
  84. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`Array<class_Array>` | :ref:`get_line_objects<class_TextParagraph_method_get_line_objects>`\ (\ line\: :ref:`int<class_int>`\ ) |const| |
  86. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_line_range<class_TextParagraph_method_get_line_range>`\ (\ line\: :ref:`int<class_int>`\ ) |const| |
  88. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`RID<class_RID>` | :ref:`get_line_rid<class_TextParagraph_method_get_line_rid>`\ (\ line\: :ref:`int<class_int>`\ ) |const| |
  90. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Vector2<class_Vector2>` | :ref:`get_line_size<class_TextParagraph_method_get_line_size>`\ (\ line\: :ref:`int<class_int>`\ ) |const| |
  92. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`float<class_float>` | :ref:`get_line_underline_position<class_TextParagraph_method_get_line_underline_position>`\ (\ line\: :ref:`int<class_int>`\ ) |const| |
  94. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`float<class_float>` | :ref:`get_line_underline_thickness<class_TextParagraph_method_get_line_underline_thickness>`\ (\ line\: :ref:`int<class_int>`\ ) |const| |
  96. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`float<class_float>` | :ref:`get_line_width<class_TextParagraph_method_get_line_width>`\ (\ line\: :ref:`int<class_int>`\ ) |const| |
  98. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`Vector2<class_Vector2>` | :ref:`get_non_wrapped_size<class_TextParagraph_method_get_non_wrapped_size>`\ (\ ) |const| |
  100. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`RID<class_RID>` | :ref:`get_rid<class_TextParagraph_method_get_rid>`\ (\ ) |const| |
  102. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`Vector2<class_Vector2>` | :ref:`get_size<class_TextParagraph_method_get_size>`\ (\ ) |const| |
  104. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`int<class_int>` | :ref:`hit_test<class_TextParagraph_method_hit_test>`\ (\ coords\: :ref:`Vector2<class_Vector2>`\ ) |const| |
  106. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`bool<class_bool>` | :ref:`resize_object<class_TextParagraph_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\ ) |
  108. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | |void| | :ref:`set_bidi_override<class_TextParagraph_method_set_bidi_override>`\ (\ override\: :ref:`Array<class_Array>`\ ) |
  110. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`bool<class_bool>` | :ref:`set_dropcap<class_TextParagraph_method_set_dropcap>`\ (\ text\: :ref:`String<class_String>`, font\: :ref:`Font<class_Font>`, font_size\: :ref:`int<class_int>`, dropcap_margins\: :ref:`Rect2<class_Rect2>` = Rect2(0, 0, 0, 0), language\: :ref:`String<class_String>` = ""\ ) |
  112. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | |void| | :ref:`tab_align<class_TextParagraph_method_tab_align>`\ (\ tab_stops\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) |
  114. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. .. rst-class:: classref-section-separator
  116. ----
  117. .. rst-class:: classref-descriptions-group
  118. Property Descriptions
  119. ---------------------
  120. .. _class_TextParagraph_property_alignment:
  121. .. rst-class:: classref-property
  122. :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **alignment** = ``0`` :ref:`๐Ÿ”—<class_TextParagraph_property_alignment>`
  123. .. rst-class:: classref-property-setget
  124. - |void| **set_alignment**\ (\ value\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>`\ )
  125. - :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_alignment**\ (\ )
  126. Paragraph horizontal alignment.
  127. .. rst-class:: classref-item-separator
  128. ----
  129. .. _class_TextParagraph_property_break_flags:
  130. .. rst-class:: classref-property
  131. |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] **break_flags** = ``3`` :ref:`๐Ÿ”—<class_TextParagraph_property_break_flags>`
  132. .. rst-class:: classref-property-setget
  133. - |void| **set_break_flags**\ (\ value\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\]\ )
  134. - |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] **get_break_flags**\ (\ )
  135. Line breaking rules. For more info see :ref:`TextServer<class_TextServer>`.
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_TextParagraph_property_custom_punctuation:
  139. .. rst-class:: classref-property
  140. :ref:`String<class_String>` **custom_punctuation** = ``""`` :ref:`๐Ÿ”—<class_TextParagraph_property_custom_punctuation>`
  141. .. rst-class:: classref-property-setget
  142. - |void| **set_custom_punctuation**\ (\ value\: :ref:`String<class_String>`\ )
  143. - :ref:`String<class_String>` **get_custom_punctuation**\ (\ )
  144. Custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.
  145. .. rst-class:: classref-item-separator
  146. ----
  147. .. _class_TextParagraph_property_direction:
  148. .. rst-class:: classref-property
  149. :ref:`Direction<enum_TextServer_Direction>` **direction** = ``0`` :ref:`๐Ÿ”—<class_TextParagraph_property_direction>`
  150. .. rst-class:: classref-property-setget
  151. - |void| **set_direction**\ (\ value\: :ref:`Direction<enum_TextServer_Direction>`\ )
  152. - :ref:`Direction<enum_TextServer_Direction>` **get_direction**\ (\ )
  153. Text writing direction.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_TextParagraph_property_ellipsis_char:
  157. .. rst-class:: classref-property
  158. :ref:`String<class_String>` **ellipsis_char** = ``"โ€ฆ"`` :ref:`๐Ÿ”—<class_TextParagraph_property_ellipsis_char>`
  159. .. rst-class:: classref-property-setget
  160. - |void| **set_ellipsis_char**\ (\ value\: :ref:`String<class_String>`\ )
  161. - :ref:`String<class_String>` **get_ellipsis_char**\ (\ )
  162. Ellipsis character used for text clipping.
  163. .. rst-class:: classref-item-separator
  164. ----
  165. .. _class_TextParagraph_property_justification_flags:
  166. .. rst-class:: classref-property
  167. |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] **justification_flags** = ``163`` :ref:`๐Ÿ”—<class_TextParagraph_property_justification_flags>`
  168. .. rst-class:: classref-property-setget
  169. - |void| **set_justification_flags**\ (\ value\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\]\ )
  170. - |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] **get_justification_flags**\ (\ )
  171. Line fill alignment rules. For more info see :ref:`JustificationFlag<enum_TextServer_JustificationFlag>`.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_TextParagraph_property_max_lines_visible:
  175. .. rst-class:: classref-property
  176. :ref:`int<class_int>` **max_lines_visible** = ``-1`` :ref:`๐Ÿ”—<class_TextParagraph_property_max_lines_visible>`
  177. .. rst-class:: classref-property-setget
  178. - |void| **set_max_lines_visible**\ (\ value\: :ref:`int<class_int>`\ )
  179. - :ref:`int<class_int>` **get_max_lines_visible**\ (\ )
  180. Limits the lines of text shown.
  181. .. rst-class:: classref-item-separator
  182. ----
  183. .. _class_TextParagraph_property_orientation:
  184. .. rst-class:: classref-property
  185. :ref:`Orientation<enum_TextServer_Orientation>` **orientation** = ``0`` :ref:`๐Ÿ”—<class_TextParagraph_property_orientation>`
  186. .. rst-class:: classref-property-setget
  187. - |void| **set_orientation**\ (\ value\: :ref:`Orientation<enum_TextServer_Orientation>`\ )
  188. - :ref:`Orientation<enum_TextServer_Orientation>` **get_orientation**\ (\ )
  189. Text orientation.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_TextParagraph_property_preserve_control:
  193. .. rst-class:: classref-property
  194. :ref:`bool<class_bool>` **preserve_control** = ``false`` :ref:`๐Ÿ”—<class_TextParagraph_property_preserve_control>`
  195. .. rst-class:: classref-property-setget
  196. - |void| **set_preserve_control**\ (\ value\: :ref:`bool<class_bool>`\ )
  197. - :ref:`bool<class_bool>` **get_preserve_control**\ (\ )
  198. If set to ``true`` text will display control characters.
  199. .. rst-class:: classref-item-separator
  200. ----
  201. .. _class_TextParagraph_property_preserve_invalid:
  202. .. rst-class:: classref-property
  203. :ref:`bool<class_bool>` **preserve_invalid** = ``true`` :ref:`๐Ÿ”—<class_TextParagraph_property_preserve_invalid>`
  204. .. rst-class:: classref-property-setget
  205. - |void| **set_preserve_invalid**\ (\ value\: :ref:`bool<class_bool>`\ )
  206. - :ref:`bool<class_bool>` **get_preserve_invalid**\ (\ )
  207. If set to ``true`` text will display invalid characters.
  208. .. rst-class:: classref-item-separator
  209. ----
  210. .. _class_TextParagraph_property_text_overrun_behavior:
  211. .. rst-class:: classref-property
  212. :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **text_overrun_behavior** = ``0`` :ref:`๐Ÿ”—<class_TextParagraph_property_text_overrun_behavior>`
  213. .. rst-class:: classref-property-setget
  214. - |void| **set_text_overrun_behavior**\ (\ value\: :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>`\ )
  215. - :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **get_text_overrun_behavior**\ (\ )
  216. Sets the clipping behavior when the text exceeds the paragraph's set width. See :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` for a description of all modes.
  217. .. rst-class:: classref-item-separator
  218. ----
  219. .. _class_TextParagraph_property_width:
  220. .. rst-class:: classref-property
  221. :ref:`float<class_float>` **width** = ``-1.0`` :ref:`๐Ÿ”—<class_TextParagraph_property_width>`
  222. .. rst-class:: classref-property-setget
  223. - |void| **set_width**\ (\ value\: :ref:`float<class_float>`\ )
  224. - :ref:`float<class_float>` **get_width**\ (\ )
  225. Paragraph width.
  226. .. rst-class:: classref-section-separator
  227. ----
  228. .. rst-class:: classref-descriptions-group
  229. Method Descriptions
  230. -------------------
  231. .. _class_TextParagraph_method_add_object:
  232. .. rst-class:: classref-method
  233. :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_TextParagraph_method_add_object>`
  234. Adds inline object to the text buffer, ``key`` must be unique. In the text, object is represented as ``length`` object replacement characters.
  235. .. rst-class:: classref-item-separator
  236. ----
  237. .. _class_TextParagraph_method_add_string:
  238. .. rst-class:: classref-method
  239. :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_TextParagraph_method_add_string>`
  240. Adds text span and font to draw it.
  241. .. rst-class:: classref-item-separator
  242. ----
  243. .. _class_TextParagraph_method_clear:
  244. .. rst-class:: classref-method
  245. |void| **clear**\ (\ ) :ref:`๐Ÿ”—<class_TextParagraph_method_clear>`
  246. Clears text paragraph (removes text and inline objects).
  247. .. rst-class:: classref-item-separator
  248. ----
  249. .. _class_TextParagraph_method_clear_dropcap:
  250. .. rst-class:: classref-method
  251. |void| **clear_dropcap**\ (\ ) :ref:`๐Ÿ”—<class_TextParagraph_method_clear_dropcap>`
  252. Removes dropcap.
  253. .. rst-class:: classref-item-separator
  254. ----
  255. .. _class_TextParagraph_method_draw:
  256. .. rst-class:: classref-method
  257. |void| **draw**\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1), dc_color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_draw>`
  258. 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.
  259. .. rst-class:: classref-item-separator
  260. ----
  261. .. _class_TextParagraph_method_draw_dropcap:
  262. .. rst-class:: classref-method
  263. |void| **draw_dropcap**\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_draw_dropcap>`
  264. Draw drop cap into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
  265. .. rst-class:: classref-item-separator
  266. ----
  267. .. _class_TextParagraph_method_draw_dropcap_outline:
  268. .. rst-class:: classref-method
  269. |void| **draw_dropcap_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_TextParagraph_method_draw_dropcap_outline>`
  270. Draw drop cap outline into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
  271. .. rst-class:: classref-item-separator
  272. ----
  273. .. _class_TextParagraph_method_draw_line:
  274. .. rst-class:: classref-method
  275. |void| **draw_line**\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, line\: :ref:`int<class_int>`, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_draw_line>`
  276. 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.
  277. .. rst-class:: classref-item-separator
  278. ----
  279. .. _class_TextParagraph_method_draw_line_outline:
  280. .. rst-class:: classref-method
  281. |void| **draw_line_outline**\ (\ canvas\: :ref:`RID<class_RID>`, pos\: :ref:`Vector2<class_Vector2>`, line\: :ref:`int<class_int>`, outline_size\: :ref:`int<class_int>` = 1, color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_draw_line_outline>`
  282. 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.
  283. .. rst-class:: classref-item-separator
  284. ----
  285. .. _class_TextParagraph_method_draw_outline:
  286. .. rst-class:: classref-method
  287. |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), dc_color\: :ref:`Color<class_Color>` = Color(1, 1, 1, 1)\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_draw_outline>`
  288. 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.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_TextParagraph_method_get_dropcap_lines:
  292. .. rst-class:: classref-method
  293. :ref:`int<class_int>` **get_dropcap_lines**\ (\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_dropcap_lines>`
  294. Returns number of lines used by dropcap.
  295. .. rst-class:: classref-item-separator
  296. ----
  297. .. _class_TextParagraph_method_get_dropcap_rid:
  298. .. rst-class:: classref-method
  299. :ref:`RID<class_RID>` **get_dropcap_rid**\ (\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_dropcap_rid>`
  300. Returns drop cap text buffer RID.
  301. .. rst-class:: classref-item-separator
  302. ----
  303. .. _class_TextParagraph_method_get_dropcap_size:
  304. .. rst-class:: classref-method
  305. :ref:`Vector2<class_Vector2>` **get_dropcap_size**\ (\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_dropcap_size>`
  306. Returns drop cap bounding box size.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. _class_TextParagraph_method_get_line_ascent:
  310. .. rst-class:: classref-method
  311. :ref:`float<class_float>` **get_line_ascent**\ (\ line\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_ascent>`
  312. Returns the text line ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
  313. .. rst-class:: classref-item-separator
  314. ----
  315. .. _class_TextParagraph_method_get_line_count:
  316. .. rst-class:: classref-method
  317. :ref:`int<class_int>` **get_line_count**\ (\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_count>`
  318. Returns number of lines in the paragraph.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_TextParagraph_method_get_line_descent:
  322. .. rst-class:: classref-method
  323. :ref:`float<class_float>` **get_line_descent**\ (\ line\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_descent>`
  324. Returns the text line descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
  325. .. rst-class:: classref-item-separator
  326. ----
  327. .. _class_TextParagraph_method_get_line_object_rect:
  328. .. rst-class:: classref-method
  329. :ref:`Rect2<class_Rect2>` **get_line_object_rect**\ (\ line\: :ref:`int<class_int>`, key\: :ref:`Variant<class_Variant>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_object_rect>`
  330. Returns bounding rectangle of the inline object.
  331. .. rst-class:: classref-item-separator
  332. ----
  333. .. _class_TextParagraph_method_get_line_objects:
  334. .. rst-class:: classref-method
  335. :ref:`Array<class_Array>` **get_line_objects**\ (\ line\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_objects>`
  336. Returns array of inline objects in the line.
  337. .. rst-class:: classref-item-separator
  338. ----
  339. .. _class_TextParagraph_method_get_line_range:
  340. .. rst-class:: classref-method
  341. :ref:`Vector2i<class_Vector2i>` **get_line_range**\ (\ line\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_range>`
  342. Returns character range of the line.
  343. .. rst-class:: classref-item-separator
  344. ----
  345. .. _class_TextParagraph_method_get_line_rid:
  346. .. rst-class:: classref-method
  347. :ref:`RID<class_RID>` **get_line_rid**\ (\ line\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_rid>`
  348. Returns TextServer line buffer RID.
  349. .. rst-class:: classref-item-separator
  350. ----
  351. .. _class_TextParagraph_method_get_line_size:
  352. .. rst-class:: classref-method
  353. :ref:`Vector2<class_Vector2>` **get_line_size**\ (\ line\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_size>`
  354. Returns size of the bounding box of the line of text. Returned size is rounded up.
  355. .. rst-class:: classref-item-separator
  356. ----
  357. .. _class_TextParagraph_method_get_line_underline_position:
  358. .. rst-class:: classref-method
  359. :ref:`float<class_float>` **get_line_underline_position**\ (\ line\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_underline_position>`
  360. Returns pixel offset of the underline below the baseline.
  361. .. rst-class:: classref-item-separator
  362. ----
  363. .. _class_TextParagraph_method_get_line_underline_thickness:
  364. .. rst-class:: classref-method
  365. :ref:`float<class_float>` **get_line_underline_thickness**\ (\ line\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_underline_thickness>`
  366. Returns thickness of the underline.
  367. .. rst-class:: classref-item-separator
  368. ----
  369. .. _class_TextParagraph_method_get_line_width:
  370. .. rst-class:: classref-method
  371. :ref:`float<class_float>` **get_line_width**\ (\ line\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_line_width>`
  372. Returns width (for horizontal layout) or height (for vertical) of the line of text.
  373. .. rst-class:: classref-item-separator
  374. ----
  375. .. _class_TextParagraph_method_get_non_wrapped_size:
  376. .. rst-class:: classref-method
  377. :ref:`Vector2<class_Vector2>` **get_non_wrapped_size**\ (\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_non_wrapped_size>`
  378. Returns the size of the bounding box of the paragraph, without line breaks.
  379. .. rst-class:: classref-item-separator
  380. ----
  381. .. _class_TextParagraph_method_get_rid:
  382. .. rst-class:: classref-method
  383. :ref:`RID<class_RID>` **get_rid**\ (\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_rid>`
  384. Returns TextServer full string buffer RID.
  385. .. rst-class:: classref-item-separator
  386. ----
  387. .. _class_TextParagraph_method_get_size:
  388. .. rst-class:: classref-method
  389. :ref:`Vector2<class_Vector2>` **get_size**\ (\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_get_size>`
  390. Returns the size of the bounding box of the paragraph.
  391. .. rst-class:: classref-item-separator
  392. ----
  393. .. _class_TextParagraph_method_hit_test:
  394. .. rst-class:: classref-method
  395. :ref:`int<class_int>` **hit_test**\ (\ coords\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`๐Ÿ”—<class_TextParagraph_method_hit_test>`
  396. Returns caret character offset at the specified coordinates. This function always returns a valid position.
  397. .. rst-class:: classref-item-separator
  398. ----
  399. .. _class_TextParagraph_method_resize_object:
  400. .. rst-class:: classref-method
  401. :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_TextParagraph_method_resize_object>`
  402. Sets new size and alignment of embedded object.
  403. .. rst-class:: classref-item-separator
  404. ----
  405. .. _class_TextParagraph_method_set_bidi_override:
  406. .. rst-class:: classref-method
  407. |void| **set_bidi_override**\ (\ override\: :ref:`Array<class_Array>`\ ) :ref:`๐Ÿ”—<class_TextParagraph_method_set_bidi_override>`
  408. Overrides BiDi for the structured text.
  409. Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.
  410. .. rst-class:: classref-item-separator
  411. ----
  412. .. _class_TextParagraph_method_set_dropcap:
  413. .. rst-class:: classref-method
  414. :ref:`bool<class_bool>` **set_dropcap**\ (\ text\: :ref:`String<class_String>`, font\: :ref:`Font<class_Font>`, font_size\: :ref:`int<class_int>`, dropcap_margins\: :ref:`Rect2<class_Rect2>` = Rect2(0, 0, 0, 0), language\: :ref:`String<class_String>` = ""\ ) :ref:`๐Ÿ”—<class_TextParagraph_method_set_dropcap>`
  415. 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.
  416. .. rst-class:: classref-item-separator
  417. ----
  418. .. _class_TextParagraph_method_tab_align:
  419. .. rst-class:: classref-method
  420. |void| **tab_align**\ (\ tab_stops\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ ) :ref:`๐Ÿ”—<class_TextParagraph_method_tab_align>`
  421. Aligns paragraph to the given tab-stops.
  422. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  423. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  424. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  425. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  426. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  427. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  428. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  429. .. |void| replace:: :abbr:`void (No return value.)`