class_textparagraph.rst 42 KB

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