class_textparagraph.rst 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the TextParagraph.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_TextParagraph:
  6. TextParagraph
  7. =============
  8. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  9. Holds a paragraph of text.
  10. Description
  11. -----------
  12. Abstraction over :ref:`TextServer<class_TextServer>` for handling paragraph of text.
  13. Properties
  14. ----------
  15. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  16. | :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`alignment<class_TextParagraph_property_alignment>` | ``0`` |
  17. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  18. | :ref:`String<class_String>` | :ref:`custom_punctuation<class_TextParagraph_property_custom_punctuation>` | ``""`` |
  19. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  20. | :ref:`Direction<enum_TextServer_Direction>` | :ref:`direction<class_TextParagraph_property_direction>` | ``0`` |
  21. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  22. | :ref:`int<class_int>` | :ref:`flags<class_TextParagraph_property_flags>` | ``99`` |
  23. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  24. | :ref:`int<class_int>` | :ref:`max_lines_visible<class_TextParagraph_property_max_lines_visible>` | ``-1`` |
  25. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  26. | :ref:`Orientation<enum_TextServer_Orientation>` | :ref:`orientation<class_TextParagraph_property_orientation>` | ``0`` |
  27. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  28. | :ref:`bool<class_bool>` | :ref:`preserve_control<class_TextParagraph_property_preserve_control>` | ``false`` |
  29. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  30. | :ref:`bool<class_bool>` | :ref:`preserve_invalid<class_TextParagraph_property_preserve_invalid>` | ``true`` |
  31. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  32. | :ref:`OverrunBehavior<enum_TextParagraph_OverrunBehavior>` | :ref:`text_overrun_behavior<class_TextParagraph_property_text_overrun_behavior>` | ``0`` |
  33. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  34. | :ref:`float<class_float>` | :ref:`width<class_TextParagraph_property_width>` | ``-1.0`` |
  35. +-------------------------------------------------------------------+----------------------------------------------------------------------------------+-----------+
  36. Methods
  37. -------
  38. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :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 **)** |
  40. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`add_string<class_TextParagraph_method_add_string>` **(** :ref:`String<class_String>` text, :ref:`Font<class_Font>` fonts, :ref:`int<class_int>` size, :ref:`Dictionary<class_Dictionary>` opentype_features={}, :ref:`String<class_String>` language="", :ref:`Variant<class_Variant>` meta=null **)** |
  42. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`clear<class_TextParagraph_method_clear>` **(** **)** |
  44. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`clear_dropcap<class_TextParagraph_method_clear_dropcap>` **(** **)** |
  46. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | 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| |
  48. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | 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| |
  50. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | 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| |
  52. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | 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| |
  54. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | 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| |
  56. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | 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| |
  58. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`int<class_int>` | :ref:`get_dropcap_lines<class_TextParagraph_method_get_dropcap_lines>` **(** **)** |const| |
  60. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`RID<class_RID>` | :ref:`get_dropcap_rid<class_TextParagraph_method_get_dropcap_rid>` **(** **)** |const| |
  62. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`Vector2<class_Vector2>` | :ref:`get_dropcap_size<class_TextParagraph_method_get_dropcap_size>` **(** **)** |const| |
  64. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`float<class_float>` | :ref:`get_line_ascent<class_TextParagraph_method_get_line_ascent>` **(** :ref:`int<class_int>` line **)** |const| |
  66. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`int<class_int>` | :ref:`get_line_count<class_TextParagraph_method_get_line_count>` **(** **)** |const| |
  68. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`float<class_float>` | :ref:`get_line_descent<class_TextParagraph_method_get_line_descent>` **(** :ref:`int<class_int>` line **)** |const| |
  70. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :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| |
  72. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`Array<class_Array>` | :ref:`get_line_objects<class_TextParagraph_method_get_line_objects>` **(** :ref:`int<class_int>` line **)** |const| |
  74. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_line_range<class_TextParagraph_method_get_line_range>` **(** :ref:`int<class_int>` line **)** |const| |
  76. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`RID<class_RID>` | :ref:`get_line_rid<class_TextParagraph_method_get_line_rid>` **(** :ref:`int<class_int>` line **)** |const| |
  78. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`Vector2<class_Vector2>` | :ref:`get_line_size<class_TextParagraph_method_get_line_size>` **(** :ref:`int<class_int>` line **)** |const| |
  80. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`float<class_float>` | :ref:`get_line_underline_position<class_TextParagraph_method_get_line_underline_position>` **(** :ref:`int<class_int>` line **)** |const| |
  82. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`float<class_float>` | :ref:`get_line_underline_thickness<class_TextParagraph_method_get_line_underline_thickness>` **(** :ref:`int<class_int>` line **)** |const| |
  84. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`float<class_float>` | :ref:`get_line_width<class_TextParagraph_method_get_line_width>` **(** :ref:`int<class_int>` line **)** |const| |
  86. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`Vector2<class_Vector2>` | :ref:`get_non_wrapped_size<class_TextParagraph_method_get_non_wrapped_size>` **(** **)** |const| |
  88. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`RID<class_RID>` | :ref:`get_rid<class_TextParagraph_method_get_rid>` **(** **)** |const| |
  90. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Vector2<class_Vector2>` | :ref:`get_size<class_TextParagraph_method_get_size>` **(** **)** |const| |
  92. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`int<class_int>` | :ref:`get_spacing_bottom<class_TextParagraph_method_get_spacing_bottom>` **(** **)** |const| |
  94. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`int<class_int>` | :ref:`get_spacing_top<class_TextParagraph_method_get_spacing_top>` **(** **)** |const| |
  96. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`int<class_int>` | :ref:`hit_test<class_TextParagraph_method_hit_test>` **(** :ref:`Vector2<class_Vector2>` coords **)** |const| |
  98. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :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 **)** |
  100. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | void | :ref:`set_bidi_override<class_TextParagraph_method_set_bidi_override>` **(** :ref:`Array<class_Array>` override **)** |
  102. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`bool<class_bool>` | :ref:`set_dropcap<class_TextParagraph_method_set_dropcap>` **(** :ref:`String<class_String>` text, :ref:`Font<class_Font>` fonts, :ref:`int<class_int>` size, :ref:`Rect2<class_Rect2>` dropcap_margins=Rect2(0, 0, 0, 0), :ref:`Dictionary<class_Dictionary>` opentype_features={}, :ref:`String<class_String>` language="" **)** |
  104. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | void | :ref:`tab_align<class_TextParagraph_method_tab_align>` **(** :ref:`PackedFloat32Array<class_PackedFloat32Array>` tab_stops **)** |
  106. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. Enumerations
  108. ------------
  109. .. _enum_TextParagraph_OverrunBehavior:
  110. .. _class_TextParagraph_constant_OVERRUN_NO_TRIMMING:
  111. .. _class_TextParagraph_constant_OVERRUN_TRIM_CHAR:
  112. .. _class_TextParagraph_constant_OVERRUN_TRIM_WORD:
  113. .. _class_TextParagraph_constant_OVERRUN_TRIM_ELLIPSIS:
  114. .. _class_TextParagraph_constant_OVERRUN_TRIM_WORD_ELLIPSIS:
  115. enum **OverrunBehavior**:
  116. - **OVERRUN_NO_TRIMMING** = **0** --- No text trimming is performed.
  117. - **OVERRUN_TRIM_CHAR** = **1** --- Trims the text per character.
  118. - **OVERRUN_TRIM_WORD** = **2** --- Trims the text per word.
  119. - **OVERRUN_TRIM_ELLIPSIS** = **3** --- Trims the text per character and adds an ellipsis to indicate that parts are hidden.
  120. - **OVERRUN_TRIM_WORD_ELLIPSIS** = **4** --- Trims the text per word and adds an ellipsis to indicate that parts are hidden.
  121. Property Descriptions
  122. ---------------------
  123. .. _class_TextParagraph_property_alignment:
  124. - :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **alignment**
  125. +-----------+----------------------+
  126. | *Default* | ``0`` |
  127. +-----------+----------------------+
  128. | *Setter* | set_alignment(value) |
  129. +-----------+----------------------+
  130. | *Getter* | get_alignment() |
  131. +-----------+----------------------+
  132. Paragraph horizontal alignment.
  133. ----
  134. .. _class_TextParagraph_property_custom_punctuation:
  135. - :ref:`String<class_String>` **custom_punctuation**
  136. +-----------+-------------------------------+
  137. | *Default* | ``""`` |
  138. +-----------+-------------------------------+
  139. | *Setter* | set_custom_punctuation(value) |
  140. +-----------+-------------------------------+
  141. | *Getter* | get_custom_punctuation() |
  142. +-----------+-------------------------------+
  143. Custom punctuation character list, used for word breaking. If set to empty string, server defaults are used.
  144. ----
  145. .. _class_TextParagraph_property_direction:
  146. - :ref:`Direction<enum_TextServer_Direction>` **direction**
  147. +-----------+----------------------+
  148. | *Default* | ``0`` |
  149. +-----------+----------------------+
  150. | *Setter* | set_direction(value) |
  151. +-----------+----------------------+
  152. | *Getter* | get_direction() |
  153. +-----------+----------------------+
  154. Text writing direction.
  155. ----
  156. .. _class_TextParagraph_property_flags:
  157. - :ref:`int<class_int>` **flags**
  158. +-----------+------------------+
  159. | *Default* | ``99`` |
  160. +-----------+------------------+
  161. | *Setter* | set_flags(value) |
  162. +-----------+------------------+
  163. | *Getter* | get_flags() |
  164. +-----------+------------------+
  165. Line breaking and alignment rules. For more info see :ref:`TextServer<class_TextServer>`.
  166. ----
  167. .. _class_TextParagraph_property_max_lines_visible:
  168. - :ref:`int<class_int>` **max_lines_visible**
  169. +-----------+------------------------------+
  170. | *Default* | ``-1`` |
  171. +-----------+------------------------------+
  172. | *Setter* | set_max_lines_visible(value) |
  173. +-----------+------------------------------+
  174. | *Getter* | get_max_lines_visible() |
  175. +-----------+------------------------------+
  176. Limits the lines of text shown.
  177. ----
  178. .. _class_TextParagraph_property_orientation:
  179. - :ref:`Orientation<enum_TextServer_Orientation>` **orientation**
  180. +-----------+------------------------+
  181. | *Default* | ``0`` |
  182. +-----------+------------------------+
  183. | *Setter* | set_orientation(value) |
  184. +-----------+------------------------+
  185. | *Getter* | get_orientation() |
  186. +-----------+------------------------+
  187. Text orientation.
  188. ----
  189. .. _class_TextParagraph_property_preserve_control:
  190. - :ref:`bool<class_bool>` **preserve_control**
  191. +-----------+-----------------------------+
  192. | *Default* | ``false`` |
  193. +-----------+-----------------------------+
  194. | *Setter* | set_preserve_control(value) |
  195. +-----------+-----------------------------+
  196. | *Getter* | get_preserve_control() |
  197. +-----------+-----------------------------+
  198. If set to ``true`` text will display control characters.
  199. ----
  200. .. _class_TextParagraph_property_preserve_invalid:
  201. - :ref:`bool<class_bool>` **preserve_invalid**
  202. +-----------+-----------------------------+
  203. | *Default* | ``true`` |
  204. +-----------+-----------------------------+
  205. | *Setter* | set_preserve_invalid(value) |
  206. +-----------+-----------------------------+
  207. | *Getter* | get_preserve_invalid() |
  208. +-----------+-----------------------------+
  209. If set to ``true`` text will display invalid characters.
  210. ----
  211. .. _class_TextParagraph_property_text_overrun_behavior:
  212. - :ref:`OverrunBehavior<enum_TextParagraph_OverrunBehavior>` **text_overrun_behavior**
  213. +-----------+----------------------------------+
  214. | *Default* | ``0`` |
  215. +-----------+----------------------------------+
  216. | *Setter* | set_text_overrun_behavior(value) |
  217. +-----------+----------------------------------+
  218. | *Getter* | get_text_overrun_behavior() |
  219. +-----------+----------------------------------+
  220. Sets the clipping behavior when the text exceeds the paragraph's set width. See :ref:`OverrunBehavior<enum_TextParagraph_OverrunBehavior>` for a description of all modes.
  221. ----
  222. .. _class_TextParagraph_property_width:
  223. - :ref:`float<class_float>` **width**
  224. +-----------+------------------+
  225. | *Default* | ``-1.0`` |
  226. +-----------+------------------+
  227. | *Setter* | set_width(value) |
  228. +-----------+------------------+
  229. | *Getter* | get_width() |
  230. +-----------+------------------+
  231. Paragraph width.
  232. Method Descriptions
  233. -------------------
  234. .. _class_TextParagraph_method_add_object:
  235. - :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 **)**
  236. Adds inline object to the text buffer, ``key`` must be unique. In the text, object is represented as ``length`` object replacement characters.
  237. ----
  238. .. _class_TextParagraph_method_add_string:
  239. - :ref:`bool<class_bool>` **add_string** **(** :ref:`String<class_String>` text, :ref:`Font<class_Font>` fonts, :ref:`int<class_int>` size, :ref:`Dictionary<class_Dictionary>` opentype_features={}, :ref:`String<class_String>` language="", :ref:`Variant<class_Variant>` meta=null **)**
  240. Adds text span and font to draw it.
  241. ----
  242. .. _class_TextParagraph_method_clear:
  243. - void **clear** **(** **)**
  244. Clears text paragraph (removes text and inline objects).
  245. ----
  246. .. _class_TextParagraph_method_clear_dropcap:
  247. - void **clear_dropcap** **(** **)**
  248. Removes dropcap.
  249. ----
  250. .. _class_TextParagraph_method_draw:
  251. - 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|
  252. 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.
  253. ----
  254. .. _class_TextParagraph_method_draw_dropcap:
  255. - void **draw_dropcap** **(** :ref:`RID<class_RID>` canvas, :ref:`Vector2<class_Vector2>` pos, :ref:`Color<class_Color>` color=Color(1, 1, 1, 1) **)** |const|
  256. Draw drop cap into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
  257. ----
  258. .. _class_TextParagraph_method_draw_dropcap_outline:
  259. - 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|
  260. Draw drop cap outline into a canvas item at a given position, with ``color``. ``pos`` specifies the top left corner of the bounding box.
  261. ----
  262. .. _class_TextParagraph_method_draw_line:
  263. - 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|
  264. 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.
  265. ----
  266. .. _class_TextParagraph_method_draw_line_outline:
  267. - 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|
  268. 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.
  269. ----
  270. .. _class_TextParagraph_method_draw_outline:
  271. - 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|
  272. 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.
  273. ----
  274. .. _class_TextParagraph_method_get_dropcap_lines:
  275. - :ref:`int<class_int>` **get_dropcap_lines** **(** **)** |const|
  276. Returns number of lines used by dropcap.
  277. ----
  278. .. _class_TextParagraph_method_get_dropcap_rid:
  279. - :ref:`RID<class_RID>` **get_dropcap_rid** **(** **)** |const|
  280. Returns drop cap text buffer RID.
  281. ----
  282. .. _class_TextParagraph_method_get_dropcap_size:
  283. - :ref:`Vector2<class_Vector2>` **get_dropcap_size** **(** **)** |const|
  284. Returns drop cap bounding box size.
  285. ----
  286. .. _class_TextParagraph_method_get_line_ascent:
  287. - :ref:`float<class_float>` **get_line_ascent** **(** :ref:`int<class_int>` line **)** |const|
  288. Returns the text line ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical).
  289. ----
  290. .. _class_TextParagraph_method_get_line_count:
  291. - :ref:`int<class_int>` **get_line_count** **(** **)** |const|
  292. Returns number of lines in the paragraph.
  293. ----
  294. .. _class_TextParagraph_method_get_line_descent:
  295. - :ref:`float<class_float>` **get_line_descent** **(** :ref:`int<class_int>` line **)** |const|
  296. Returns the text line descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical).
  297. ----
  298. .. _class_TextParagraph_method_get_line_object_rect:
  299. - :ref:`Rect2<class_Rect2>` **get_line_object_rect** **(** :ref:`int<class_int>` line, :ref:`Variant<class_Variant>` key **)** |const|
  300. Returns bounding rectangle of the inline object.
  301. ----
  302. .. _class_TextParagraph_method_get_line_objects:
  303. - :ref:`Array<class_Array>` **get_line_objects** **(** :ref:`int<class_int>` line **)** |const|
  304. Returns array of inline objects in the line.
  305. ----
  306. .. _class_TextParagraph_method_get_line_range:
  307. - :ref:`Vector2i<class_Vector2i>` **get_line_range** **(** :ref:`int<class_int>` line **)** |const|
  308. Returns character range of the line.
  309. ----
  310. .. _class_TextParagraph_method_get_line_rid:
  311. - :ref:`RID<class_RID>` **get_line_rid** **(** :ref:`int<class_int>` line **)** |const|
  312. Returns TextServer line buffer RID.
  313. ----
  314. .. _class_TextParagraph_method_get_line_size:
  315. - :ref:`Vector2<class_Vector2>` **get_line_size** **(** :ref:`int<class_int>` line **)** |const|
  316. Returns size of the bounding box of the line of text.
  317. ----
  318. .. _class_TextParagraph_method_get_line_underline_position:
  319. - :ref:`float<class_float>` **get_line_underline_position** **(** :ref:`int<class_int>` line **)** |const|
  320. Returns pixel offset of the underline below the baseline.
  321. ----
  322. .. _class_TextParagraph_method_get_line_underline_thickness:
  323. - :ref:`float<class_float>` **get_line_underline_thickness** **(** :ref:`int<class_int>` line **)** |const|
  324. Returns thickness of the underline.
  325. ----
  326. .. _class_TextParagraph_method_get_line_width:
  327. - :ref:`float<class_float>` **get_line_width** **(** :ref:`int<class_int>` line **)** |const|
  328. Returns width (for horizontal layout) or height (for vertical) of the line of text.
  329. ----
  330. .. _class_TextParagraph_method_get_non_wrapped_size:
  331. - :ref:`Vector2<class_Vector2>` **get_non_wrapped_size** **(** **)** |const|
  332. Returns the size of the bounding box of the paragraph, without line breaks.
  333. ----
  334. .. _class_TextParagraph_method_get_rid:
  335. - :ref:`RID<class_RID>` **get_rid** **(** **)** |const|
  336. Returns TextServer full string buffer RID.
  337. ----
  338. .. _class_TextParagraph_method_get_size:
  339. - :ref:`Vector2<class_Vector2>` **get_size** **(** **)** |const|
  340. Returns the size of the bounding box of the paragraph.
  341. ----
  342. .. _class_TextParagraph_method_get_spacing_bottom:
  343. - :ref:`int<class_int>` **get_spacing_bottom** **(** **)** |const|
  344. Returns extra spacing at the bottom of the line. See :ref:`Font.spacing_bottom<class_Font_property_spacing_bottom>`.
  345. ----
  346. .. _class_TextParagraph_method_get_spacing_top:
  347. - :ref:`int<class_int>` **get_spacing_top** **(** **)** |const|
  348. Returns extra spacing at the top of the line. See :ref:`Font.spacing_top<class_Font_property_spacing_top>`.
  349. ----
  350. .. _class_TextParagraph_method_hit_test:
  351. - :ref:`int<class_int>` **hit_test** **(** :ref:`Vector2<class_Vector2>` coords **)** |const|
  352. Returns caret character offset at the specified coordinates. This function always returns a valid position.
  353. ----
  354. .. _class_TextParagraph_method_resize_object:
  355. - :ref:`bool<class_bool>` **resize_object** **(** :ref:`Variant<class_Variant>` key, :ref:`Vector2<class_Vector2>` size, :ref:`InlineAlignment<enum_@GlobalScope_InlineAlignment>` inline_align=5 **)**
  356. Sets new size and alignment of embedded object.
  357. ----
  358. .. _class_TextParagraph_method_set_bidi_override:
  359. - void **set_bidi_override** **(** :ref:`Array<class_Array>` override **)**
  360. Overrides BiDi for the structured text.
  361. Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately.
  362. ----
  363. .. _class_TextParagraph_method_set_dropcap:
  364. - :ref:`bool<class_bool>` **set_dropcap** **(** :ref:`String<class_String>` text, :ref:`Font<class_Font>` fonts, :ref:`int<class_int>` size, :ref:`Rect2<class_Rect2>` dropcap_margins=Rect2(0, 0, 0, 0), :ref:`Dictionary<class_Dictionary>` opentype_features={}, :ref:`String<class_String>` language="" **)**
  365. 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.
  366. ----
  367. .. _class_TextParagraph_method_tab_align:
  368. - void **tab_align** **(** :ref:`PackedFloat32Array<class_PackedFloat32Array>` tab_stops **)**
  369. Aligns paragraph to the given tab-stops.
  370. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  371. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  372. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  373. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  374. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  375. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`