class_label.rst 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. :github_url: hide
  2. .. meta::
  3. :keywords: text
  4. .. DO NOT EDIT THIS FILE!!!
  5. .. Generated automatically from Godot engine sources.
  6. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  7. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Label.xml.
  8. .. _class_Label:
  9. Label
  10. =====
  11. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  12. A control for displaying plain text.
  13. .. rst-class:: classref-introduction-group
  14. Description
  15. -----------
  16. A control for displaying plain text. It gives you control over the horizontal and vertical alignment and can wrap the text inside the node's bounding rectangle. It doesn't support bold, italics, or other rich text formatting. For that, use :ref:`RichTextLabel<class_RichTextLabel>` instead.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/2712>`__
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  27. | :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` | :ref:`autowrap_mode<class_Label_property_autowrap_mode>` | ``0`` |
  28. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  29. | |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] | :ref:`autowrap_trim_flags<class_Label_property_autowrap_trim_flags>` | ``192`` |
  30. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`clip_text<class_Label_property_clip_text>` | ``false`` |
  32. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  33. | :ref:`String<class_String>` | :ref:`ellipsis_char<class_Label_property_ellipsis_char>` | ``"โ€ฆ"`` |
  34. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  35. | :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`horizontal_alignment<class_Label_property_horizontal_alignment>` | ``0`` |
  36. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  37. | |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] | :ref:`justification_flags<class_Label_property_justification_flags>` | ``163`` |
  38. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  39. | :ref:`LabelSettings<class_LabelSettings>` | :ref:`label_settings<class_Label_property_label_settings>` | |
  40. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  41. | :ref:`String<class_String>` | :ref:`language<class_Label_property_language>` | ``""`` |
  42. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`lines_skipped<class_Label_property_lines_skipped>` | ``0`` |
  44. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  45. | :ref:`int<class_int>` | :ref:`max_lines_visible<class_Label_property_max_lines_visible>` | ``-1`` |
  46. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  47. | :ref:`MouseFilter<enum_Control_MouseFilter>` | mouse_filter | ``2`` (overrides :ref:`Control<class_Control_property_mouse_filter>`) |
  48. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  49. | :ref:`String<class_String>` | :ref:`paragraph_separator<class_Label_property_paragraph_separator>` | ``"\\n"`` |
  50. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  51. | |bitfield|\[:ref:`SizeFlags<enum_Control_SizeFlags>`\] | size_flags_vertical | ``4`` (overrides :ref:`Control<class_Control_property_size_flags_vertical>`) |
  52. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  53. | :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` | :ref:`structured_text_bidi_override<class_Label_property_structured_text_bidi_override>` | ``0`` |
  54. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  55. | :ref:`Array<class_Array>` | :ref:`structured_text_bidi_override_options<class_Label_property_structured_text_bidi_override_options>` | ``[]`` |
  56. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  57. | :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`tab_stops<class_Label_property_tab_stops>` | ``PackedFloat32Array()`` |
  58. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  59. | :ref:`String<class_String>` | :ref:`text<class_Label_property_text>` | ``""`` |
  60. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  61. | :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`text_direction<class_Label_property_text_direction>` | ``0`` |
  62. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  63. | :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` | :ref:`text_overrun_behavior<class_Label_property_text_overrun_behavior>` | ``0`` |
  64. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`uppercase<class_Label_property_uppercase>` | ``false`` |
  66. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  67. | :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` | :ref:`vertical_alignment<class_Label_property_vertical_alignment>` | ``0`` |
  68. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  69. | :ref:`int<class_int>` | :ref:`visible_characters<class_Label_property_visible_characters>` | ``-1`` |
  70. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  71. | :ref:`VisibleCharactersBehavior<enum_TextServer_VisibleCharactersBehavior>` | :ref:`visible_characters_behavior<class_Label_property_visible_characters_behavior>` | ``0`` |
  72. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  73. | :ref:`float<class_float>` | :ref:`visible_ratio<class_Label_property_visible_ratio>` | ``1.0`` |
  74. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  75. .. rst-class:: classref-reftable-group
  76. Methods
  77. -------
  78. .. table::
  79. :widths: auto
  80. +---------------------------+-----------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Rect2<class_Rect2>` | :ref:`get_character_bounds<class_Label_method_get_character_bounds>`\ (\ pos\: :ref:`int<class_int>`\ ) |const| |
  82. +---------------------------+-----------------------------------------------------------------------------------------------------------------+
  83. | :ref:`int<class_int>` | :ref:`get_line_count<class_Label_method_get_line_count>`\ (\ ) |const| |
  84. +---------------------------+-----------------------------------------------------------------------------------------------------------------+
  85. | :ref:`int<class_int>` | :ref:`get_line_height<class_Label_method_get_line_height>`\ (\ line\: :ref:`int<class_int>` = -1\ ) |const| |
  86. +---------------------------+-----------------------------------------------------------------------------------------------------------------+
  87. | :ref:`int<class_int>` | :ref:`get_total_character_count<class_Label_method_get_total_character_count>`\ (\ ) |const| |
  88. +---------------------------+-----------------------------------------------------------------------------------------------------------------+
  89. | :ref:`int<class_int>` | :ref:`get_visible_line_count<class_Label_method_get_visible_line_count>`\ (\ ) |const| |
  90. +---------------------------+-----------------------------------------------------------------------------------------------------------------+
  91. .. rst-class:: classref-reftable-group
  92. Theme Properties
  93. ----------------
  94. .. table::
  95. :widths: auto
  96. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  97. | :ref:`Color<class_Color>` | :ref:`font_color<class_Label_theme_color_font_color>` | ``Color(1, 1, 1, 1)`` |
  98. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  99. | :ref:`Color<class_Color>` | :ref:`font_outline_color<class_Label_theme_color_font_outline_color>` | ``Color(0, 0, 0, 1)`` |
  100. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  101. | :ref:`Color<class_Color>` | :ref:`font_shadow_color<class_Label_theme_color_font_shadow_color>` | ``Color(0, 0, 0, 0)`` |
  102. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  103. | :ref:`int<class_int>` | :ref:`line_spacing<class_Label_theme_constant_line_spacing>` | ``3`` |
  104. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  105. | :ref:`int<class_int>` | :ref:`outline_size<class_Label_theme_constant_outline_size>` | ``0`` |
  106. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  107. | :ref:`int<class_int>` | :ref:`paragraph_spacing<class_Label_theme_constant_paragraph_spacing>` | ``0`` |
  108. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  109. | :ref:`int<class_int>` | :ref:`shadow_offset_x<class_Label_theme_constant_shadow_offset_x>` | ``1`` |
  110. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  111. | :ref:`int<class_int>` | :ref:`shadow_offset_y<class_Label_theme_constant_shadow_offset_y>` | ``1`` |
  112. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  113. | :ref:`int<class_int>` | :ref:`shadow_outline_size<class_Label_theme_constant_shadow_outline_size>` | ``1`` |
  114. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  115. | :ref:`Font<class_Font>` | :ref:`font<class_Label_theme_font_font>` | |
  116. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  117. | :ref:`int<class_int>` | :ref:`font_size<class_Label_theme_font_size_font_size>` | |
  118. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  119. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_Label_theme_style_focus>` | |
  120. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  121. | :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_Label_theme_style_normal>` | |
  122. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  123. .. rst-class:: classref-section-separator
  124. ----
  125. .. rst-class:: classref-descriptions-group
  126. Property Descriptions
  127. ---------------------
  128. .. _class_Label_property_autowrap_mode:
  129. .. rst-class:: classref-property
  130. :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **autowrap_mode** = ``0`` :ref:`๐Ÿ”—<class_Label_property_autowrap_mode>`
  131. .. rst-class:: classref-property-setget
  132. - |void| **set_autowrap_mode**\ (\ value\: :ref:`AutowrapMode<enum_TextServer_AutowrapMode>`\ )
  133. - :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **get_autowrap_mode**\ (\ )
  134. If set to something other than :ref:`TextServer.AUTOWRAP_OFF<class_TextServer_constant_AUTOWRAP_OFF>`, the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_Label_property_autowrap_trim_flags:
  138. .. rst-class:: classref-property
  139. |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] **autowrap_trim_flags** = ``192`` :ref:`๐Ÿ”—<class_Label_property_autowrap_trim_flags>`
  140. .. rst-class:: classref-property-setget
  141. - |void| **set_autowrap_trim_flags**\ (\ value\: |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\]\ )
  142. - |bitfield|\[:ref:`LineBreakFlag<enum_TextServer_LineBreakFlag>`\] **get_autowrap_trim_flags**\ (\ )
  143. Autowrap space trimming flags. See :ref:`TextServer.BREAK_TRIM_START_EDGE_SPACES<class_TextServer_constant_BREAK_TRIM_START_EDGE_SPACES>` and :ref:`TextServer.BREAK_TRIM_END_EDGE_SPACES<class_TextServer_constant_BREAK_TRIM_END_EDGE_SPACES>` for more info.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_Label_property_clip_text:
  147. .. rst-class:: classref-property
  148. :ref:`bool<class_bool>` **clip_text** = ``false`` :ref:`๐Ÿ”—<class_Label_property_clip_text>`
  149. .. rst-class:: classref-property-setget
  150. - |void| **set_clip_text**\ (\ value\: :ref:`bool<class_bool>`\ )
  151. - :ref:`bool<class_bool>` **is_clipping_text**\ (\ )
  152. If ``true``, the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_Label_property_ellipsis_char:
  156. .. rst-class:: classref-property
  157. :ref:`String<class_String>` **ellipsis_char** = ``"โ€ฆ"`` :ref:`๐Ÿ”—<class_Label_property_ellipsis_char>`
  158. .. rst-class:: classref-property-setget
  159. - |void| **set_ellipsis_char**\ (\ value\: :ref:`String<class_String>`\ )
  160. - :ref:`String<class_String>` **get_ellipsis_char**\ (\ )
  161. Ellipsis character used for text clipping.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_Label_property_horizontal_alignment:
  165. .. rst-class:: classref-property
  166. :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **horizontal_alignment** = ``0`` :ref:`๐Ÿ”—<class_Label_property_horizontal_alignment>`
  167. .. rst-class:: classref-property-setget
  168. - |void| **set_horizontal_alignment**\ (\ value\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>`\ )
  169. - :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_horizontal_alignment**\ (\ )
  170. Controls the text's horizontal alignment. Supports left, center, right, and fill (also known as justify).
  171. .. rst-class:: classref-item-separator
  172. ----
  173. .. _class_Label_property_justification_flags:
  174. .. rst-class:: classref-property
  175. |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] **justification_flags** = ``163`` :ref:`๐Ÿ”—<class_Label_property_justification_flags>`
  176. .. rst-class:: classref-property-setget
  177. - |void| **set_justification_flags**\ (\ value\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\]\ )
  178. - |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] **get_justification_flags**\ (\ )
  179. Line fill alignment rules.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_Label_property_label_settings:
  183. .. rst-class:: classref-property
  184. :ref:`LabelSettings<class_LabelSettings>` **label_settings** :ref:`๐Ÿ”—<class_Label_property_label_settings>`
  185. .. rst-class:: classref-property-setget
  186. - |void| **set_label_settings**\ (\ value\: :ref:`LabelSettings<class_LabelSettings>`\ )
  187. - :ref:`LabelSettings<class_LabelSettings>` **get_label_settings**\ (\ )
  188. A :ref:`LabelSettings<class_LabelSettings>` resource that can be shared between multiple **Label** nodes. Takes priority over theme properties.
  189. .. rst-class:: classref-item-separator
  190. ----
  191. .. _class_Label_property_language:
  192. .. rst-class:: classref-property
  193. :ref:`String<class_String>` **language** = ``""`` :ref:`๐Ÿ”—<class_Label_property_language>`
  194. .. rst-class:: classref-property-setget
  195. - |void| **set_language**\ (\ value\: :ref:`String<class_String>`\ )
  196. - :ref:`String<class_String>` **get_language**\ (\ )
  197. Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_Label_property_lines_skipped:
  201. .. rst-class:: classref-property
  202. :ref:`int<class_int>` **lines_skipped** = ``0`` :ref:`๐Ÿ”—<class_Label_property_lines_skipped>`
  203. .. rst-class:: classref-property-setget
  204. - |void| **set_lines_skipped**\ (\ value\: :ref:`int<class_int>`\ )
  205. - :ref:`int<class_int>` **get_lines_skipped**\ (\ )
  206. The number of the lines ignored and not displayed from the start of the :ref:`text<class_Label_property_text>` value.
  207. .. rst-class:: classref-item-separator
  208. ----
  209. .. _class_Label_property_max_lines_visible:
  210. .. rst-class:: classref-property
  211. :ref:`int<class_int>` **max_lines_visible** = ``-1`` :ref:`๐Ÿ”—<class_Label_property_max_lines_visible>`
  212. .. rst-class:: classref-property-setget
  213. - |void| **set_max_lines_visible**\ (\ value\: :ref:`int<class_int>`\ )
  214. - :ref:`int<class_int>` **get_max_lines_visible**\ (\ )
  215. Limits the lines of text the node shows on screen.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_Label_property_paragraph_separator:
  219. .. rst-class:: classref-property
  220. :ref:`String<class_String>` **paragraph_separator** = ``"\\n"`` :ref:`๐Ÿ”—<class_Label_property_paragraph_separator>`
  221. .. rst-class:: classref-property-setget
  222. - |void| **set_paragraph_separator**\ (\ value\: :ref:`String<class_String>`\ )
  223. - :ref:`String<class_String>` **get_paragraph_separator**\ (\ )
  224. String used as a paragraph separator. Each paragraph is processed independently, in its own BiDi context.
  225. .. rst-class:: classref-item-separator
  226. ----
  227. .. _class_Label_property_structured_text_bidi_override:
  228. .. rst-class:: classref-property
  229. :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **structured_text_bidi_override** = ``0`` :ref:`๐Ÿ”—<class_Label_property_structured_text_bidi_override>`
  230. .. rst-class:: classref-property-setget
  231. - |void| **set_structured_text_bidi_override**\ (\ value\: :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>`\ )
  232. - :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **get_structured_text_bidi_override**\ (\ )
  233. Set BiDi algorithm override for the structured text.
  234. .. rst-class:: classref-item-separator
  235. ----
  236. .. _class_Label_property_structured_text_bidi_override_options:
  237. .. rst-class:: classref-property
  238. :ref:`Array<class_Array>` **structured_text_bidi_override_options** = ``[]`` :ref:`๐Ÿ”—<class_Label_property_structured_text_bidi_override_options>`
  239. .. rst-class:: classref-property-setget
  240. - |void| **set_structured_text_bidi_override_options**\ (\ value\: :ref:`Array<class_Array>`\ )
  241. - :ref:`Array<class_Array>` **get_structured_text_bidi_override_options**\ (\ )
  242. Set additional options for BiDi override.
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_Label_property_tab_stops:
  246. .. rst-class:: classref-property
  247. :ref:`PackedFloat32Array<class_PackedFloat32Array>` **tab_stops** = ``PackedFloat32Array()`` :ref:`๐Ÿ”—<class_Label_property_tab_stops>`
  248. .. rst-class:: classref-property-setget
  249. - |void| **set_tab_stops**\ (\ value\: :ref:`PackedFloat32Array<class_PackedFloat32Array>`\ )
  250. - :ref:`PackedFloat32Array<class_PackedFloat32Array>` **get_tab_stops**\ (\ )
  251. Aligns text to the given tab-stops.
  252. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedFloat32Array<class_PackedFloat32Array>` for more details.
  253. .. rst-class:: classref-item-separator
  254. ----
  255. .. _class_Label_property_text:
  256. .. rst-class:: classref-property
  257. :ref:`String<class_String>` **text** = ``""`` :ref:`๐Ÿ”—<class_Label_property_text>`
  258. .. rst-class:: classref-property-setget
  259. - |void| **set_text**\ (\ value\: :ref:`String<class_String>`\ )
  260. - :ref:`String<class_String>` **get_text**\ (\ )
  261. The text to display on screen.
  262. .. rst-class:: classref-item-separator
  263. ----
  264. .. _class_Label_property_text_direction:
  265. .. rst-class:: classref-property
  266. :ref:`TextDirection<enum_Control_TextDirection>` **text_direction** = ``0`` :ref:`๐Ÿ”—<class_Label_property_text_direction>`
  267. .. rst-class:: classref-property-setget
  268. - |void| **set_text_direction**\ (\ value\: :ref:`TextDirection<enum_Control_TextDirection>`\ )
  269. - :ref:`TextDirection<enum_Control_TextDirection>` **get_text_direction**\ (\ )
  270. Base text writing direction.
  271. .. rst-class:: classref-item-separator
  272. ----
  273. .. _class_Label_property_text_overrun_behavior:
  274. .. rst-class:: classref-property
  275. :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **text_overrun_behavior** = ``0`` :ref:`๐Ÿ”—<class_Label_property_text_overrun_behavior>`
  276. .. rst-class:: classref-property-setget
  277. - |void| **set_text_overrun_behavior**\ (\ value\: :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>`\ )
  278. - :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **get_text_overrun_behavior**\ (\ )
  279. The clipping behavior when the text exceeds the node's bounding rectangle.
  280. .. rst-class:: classref-item-separator
  281. ----
  282. .. _class_Label_property_uppercase:
  283. .. rst-class:: classref-property
  284. :ref:`bool<class_bool>` **uppercase** = ``false`` :ref:`๐Ÿ”—<class_Label_property_uppercase>`
  285. .. rst-class:: classref-property-setget
  286. - |void| **set_uppercase**\ (\ value\: :ref:`bool<class_bool>`\ )
  287. - :ref:`bool<class_bool>` **is_uppercase**\ (\ )
  288. If ``true``, all the text displays as UPPERCASE.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_Label_property_vertical_alignment:
  292. .. rst-class:: classref-property
  293. :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **vertical_alignment** = ``0`` :ref:`๐Ÿ”—<class_Label_property_vertical_alignment>`
  294. .. rst-class:: classref-property-setget
  295. - |void| **set_vertical_alignment**\ (\ value\: :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>`\ )
  296. - :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **get_vertical_alignment**\ (\ )
  297. Controls the text's vertical alignment. Supports top, center, bottom, and fill.
  298. .. rst-class:: classref-item-separator
  299. ----
  300. .. _class_Label_property_visible_characters:
  301. .. rst-class:: classref-property
  302. :ref:`int<class_int>` **visible_characters** = ``-1`` :ref:`๐Ÿ”—<class_Label_property_visible_characters>`
  303. .. rst-class:: classref-property-setget
  304. - |void| **set_visible_characters**\ (\ value\: :ref:`int<class_int>`\ )
  305. - :ref:`int<class_int>` **get_visible_characters**\ (\ )
  306. The number of characters to display. If set to ``-1``, all characters are displayed. This can be useful when animating the text appearing in a dialog box.
  307. \ **Note:** Setting this property updates :ref:`visible_ratio<class_Label_property_visible_ratio>` accordingly.
  308. .. rst-class:: classref-item-separator
  309. ----
  310. .. _class_Label_property_visible_characters_behavior:
  311. .. rst-class:: classref-property
  312. :ref:`VisibleCharactersBehavior<enum_TextServer_VisibleCharactersBehavior>` **visible_characters_behavior** = ``0`` :ref:`๐Ÿ”—<class_Label_property_visible_characters_behavior>`
  313. .. rst-class:: classref-property-setget
  314. - |void| **set_visible_characters_behavior**\ (\ value\: :ref:`VisibleCharactersBehavior<enum_TextServer_VisibleCharactersBehavior>`\ )
  315. - :ref:`VisibleCharactersBehavior<enum_TextServer_VisibleCharactersBehavior>` **get_visible_characters_behavior**\ (\ )
  316. The clipping behavior when :ref:`visible_characters<class_Label_property_visible_characters>` or :ref:`visible_ratio<class_Label_property_visible_ratio>` is set.
  317. .. rst-class:: classref-item-separator
  318. ----
  319. .. _class_Label_property_visible_ratio:
  320. .. rst-class:: classref-property
  321. :ref:`float<class_float>` **visible_ratio** = ``1.0`` :ref:`๐Ÿ”—<class_Label_property_visible_ratio>`
  322. .. rst-class:: classref-property-setget
  323. - |void| **set_visible_ratio**\ (\ value\: :ref:`float<class_float>`\ )
  324. - :ref:`float<class_float>` **get_visible_ratio**\ (\ )
  325. The fraction of characters to display, relative to the total number of characters (see :ref:`get_total_character_count()<class_Label_method_get_total_character_count>`). If set to ``1.0``, all characters are displayed. If set to ``0.5``, only half of the characters will be displayed. This can be useful when animating the text appearing in a dialog box.
  326. \ **Note:** Setting this property updates :ref:`visible_characters<class_Label_property_visible_characters>` accordingly.
  327. .. rst-class:: classref-section-separator
  328. ----
  329. .. rst-class:: classref-descriptions-group
  330. Method Descriptions
  331. -------------------
  332. .. _class_Label_method_get_character_bounds:
  333. .. rst-class:: classref-method
  334. :ref:`Rect2<class_Rect2>` **get_character_bounds**\ (\ pos\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_Label_method_get_character_bounds>`
  335. Returns the bounding rectangle of the character at position ``pos`` in the label's local coordinate system. If the character is a non-visual character or ``pos`` is outside the valid range, an empty :ref:`Rect2<class_Rect2>` is returned. If the character is a part of a composite grapheme, the bounding rectangle of the whole grapheme is returned.
  336. .. rst-class:: classref-item-separator
  337. ----
  338. .. _class_Label_method_get_line_count:
  339. .. rst-class:: classref-method
  340. :ref:`int<class_int>` **get_line_count**\ (\ ) |const| :ref:`๐Ÿ”—<class_Label_method_get_line_count>`
  341. Returns the number of lines of text the Label has.
  342. .. rst-class:: classref-item-separator
  343. ----
  344. .. _class_Label_method_get_line_height:
  345. .. rst-class:: classref-method
  346. :ref:`int<class_int>` **get_line_height**\ (\ line\: :ref:`int<class_int>` = -1\ ) |const| :ref:`๐Ÿ”—<class_Label_method_get_line_height>`
  347. Returns the height of the line ``line``.
  348. If ``line`` is set to ``-1``, returns the biggest line height.
  349. If there are no lines, returns font size in pixels.
  350. .. rst-class:: classref-item-separator
  351. ----
  352. .. _class_Label_method_get_total_character_count:
  353. .. rst-class:: classref-method
  354. :ref:`int<class_int>` **get_total_character_count**\ (\ ) |const| :ref:`๐Ÿ”—<class_Label_method_get_total_character_count>`
  355. Returns the total number of printable characters in the text (excluding spaces and newlines).
  356. .. rst-class:: classref-item-separator
  357. ----
  358. .. _class_Label_method_get_visible_line_count:
  359. .. rst-class:: classref-method
  360. :ref:`int<class_int>` **get_visible_line_count**\ (\ ) |const| :ref:`๐Ÿ”—<class_Label_method_get_visible_line_count>`
  361. Returns the number of lines shown. Useful if the **Label**'s height cannot currently display all lines.
  362. .. rst-class:: classref-section-separator
  363. ----
  364. .. rst-class:: classref-descriptions-group
  365. Theme Property Descriptions
  366. ---------------------------
  367. .. _class_Label_theme_color_font_color:
  368. .. rst-class:: classref-themeproperty
  369. :ref:`Color<class_Color>` **font_color** = ``Color(1, 1, 1, 1)`` :ref:`๐Ÿ”—<class_Label_theme_color_font_color>`
  370. Default text :ref:`Color<class_Color>` of the **Label**.
  371. .. rst-class:: classref-item-separator
  372. ----
  373. .. _class_Label_theme_color_font_outline_color:
  374. .. rst-class:: classref-themeproperty
  375. :ref:`Color<class_Color>` **font_outline_color** = ``Color(0, 0, 0, 1)`` :ref:`๐Ÿ”—<class_Label_theme_color_font_outline_color>`
  376. The color of text outline.
  377. .. rst-class:: classref-item-separator
  378. ----
  379. .. _class_Label_theme_color_font_shadow_color:
  380. .. rst-class:: classref-themeproperty
  381. :ref:`Color<class_Color>` **font_shadow_color** = ``Color(0, 0, 0, 0)`` :ref:`๐Ÿ”—<class_Label_theme_color_font_shadow_color>`
  382. :ref:`Color<class_Color>` of the text's shadow effect.
  383. .. rst-class:: classref-item-separator
  384. ----
  385. .. _class_Label_theme_constant_line_spacing:
  386. .. rst-class:: classref-themeproperty
  387. :ref:`int<class_int>` **line_spacing** = ``3`` :ref:`๐Ÿ”—<class_Label_theme_constant_line_spacing>`
  388. Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.
  389. .. rst-class:: classref-item-separator
  390. ----
  391. .. _class_Label_theme_constant_outline_size:
  392. .. rst-class:: classref-themeproperty
  393. :ref:`int<class_int>` **outline_size** = ``0`` :ref:`๐Ÿ”—<class_Label_theme_constant_outline_size>`
  394. Text outline size.
  395. \ **Note:** If using a font with :ref:`FontFile.multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` enabled, its :ref:`FontFile.msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` must be set to at least *twice* the value of :ref:`outline_size<class_Label_theme_constant_outline_size>` for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
  396. \ **Note:** Using a value that is larger than half the font size is not recommended, as the font outline may fail to be fully closed in this case.
  397. .. rst-class:: classref-item-separator
  398. ----
  399. .. _class_Label_theme_constant_paragraph_spacing:
  400. .. rst-class:: classref-themeproperty
  401. :ref:`int<class_int>` **paragraph_spacing** = ``0`` :ref:`๐Ÿ”—<class_Label_theme_constant_paragraph_spacing>`
  402. Vertical space between paragraphs. Added on top of :ref:`line_spacing<class_Label_theme_constant_line_spacing>`.
  403. .. rst-class:: classref-item-separator
  404. ----
  405. .. _class_Label_theme_constant_shadow_offset_x:
  406. .. rst-class:: classref-themeproperty
  407. :ref:`int<class_int>` **shadow_offset_x** = ``1`` :ref:`๐Ÿ”—<class_Label_theme_constant_shadow_offset_x>`
  408. The horizontal offset of the text's shadow.
  409. .. rst-class:: classref-item-separator
  410. ----
  411. .. _class_Label_theme_constant_shadow_offset_y:
  412. .. rst-class:: classref-themeproperty
  413. :ref:`int<class_int>` **shadow_offset_y** = ``1`` :ref:`๐Ÿ”—<class_Label_theme_constant_shadow_offset_y>`
  414. The vertical offset of the text's shadow.
  415. .. rst-class:: classref-item-separator
  416. ----
  417. .. _class_Label_theme_constant_shadow_outline_size:
  418. .. rst-class:: classref-themeproperty
  419. :ref:`int<class_int>` **shadow_outline_size** = ``1`` :ref:`๐Ÿ”—<class_Label_theme_constant_shadow_outline_size>`
  420. The size of the shadow outline.
  421. .. rst-class:: classref-item-separator
  422. ----
  423. .. _class_Label_theme_font_font:
  424. .. rst-class:: classref-themeproperty
  425. :ref:`Font<class_Font>` **font** :ref:`๐Ÿ”—<class_Label_theme_font_font>`
  426. :ref:`Font<class_Font>` used for the **Label**'s text.
  427. .. rst-class:: classref-item-separator
  428. ----
  429. .. _class_Label_theme_font_size_font_size:
  430. .. rst-class:: classref-themeproperty
  431. :ref:`int<class_int>` **font_size** :ref:`๐Ÿ”—<class_Label_theme_font_size_font_size>`
  432. Font size of the **Label**'s text.
  433. .. rst-class:: classref-item-separator
  434. ----
  435. .. _class_Label_theme_style_focus:
  436. .. rst-class:: classref-themeproperty
  437. :ref:`StyleBox<class_StyleBox>` **focus** :ref:`๐Ÿ”—<class_Label_theme_style_focus>`
  438. :ref:`StyleBox<class_StyleBox>` used when the **Label** is focused (when used with assistive apps).
  439. .. rst-class:: classref-item-separator
  440. ----
  441. .. _class_Label_theme_style_normal:
  442. .. rst-class:: classref-themeproperty
  443. :ref:`StyleBox<class_StyleBox>` **normal** :ref:`๐Ÿ”—<class_Label_theme_style_normal>`
  444. Background :ref:`StyleBox<class_StyleBox>` for the **Label**.
  445. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  446. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  447. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  448. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  449. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  450. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  451. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  452. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  453. .. |void| replace:: :abbr:`void (No return value.)`