class_label.rst 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Label.xml.
  6. .. _class_Label:
  7. Label
  8. =====
  9. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A control for displaying plain text.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  25. | :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` | :ref:`autowrap_mode<class_Label_property_autowrap_mode>` | ``0`` |
  26. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`clip_text<class_Label_property_clip_text>` | ``false`` |
  28. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  29. | :ref:`String<class_String>` | :ref:`ellipsis_char<class_Label_property_ellipsis_char>` | ``"…"`` |
  30. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  31. | :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`horizontal_alignment<class_Label_property_horizontal_alignment>` | ``0`` |
  32. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  33. | |bitfield|\<:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\> | :ref:`justification_flags<class_Label_property_justification_flags>` | ``163`` |
  34. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  35. | :ref:`LabelSettings<class_LabelSettings>` | :ref:`label_settings<class_Label_property_label_settings>` | |
  36. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  37. | :ref:`String<class_String>` | :ref:`language<class_Label_property_language>` | ``""`` |
  38. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`lines_skipped<class_Label_property_lines_skipped>` | ``0`` |
  40. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`max_lines_visible<class_Label_property_max_lines_visible>` | ``-1`` |
  42. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  43. | :ref:`MouseFilter<enum_Control_MouseFilter>` | mouse_filter | ``2`` (overrides :ref:`Control<class_Control_property_mouse_filter>`) |
  44. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  45. | |bitfield|\<:ref:`SizeFlags<enum_Control_SizeFlags>`\> | size_flags_vertical | ``4`` (overrides :ref:`Control<class_Control_property_size_flags_vertical>`) |
  46. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  47. | :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` | :ref:`structured_text_bidi_override<class_Label_property_structured_text_bidi_override>` | ``0`` |
  48. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  49. | :ref:`Array<class_Array>` | :ref:`structured_text_bidi_override_options<class_Label_property_structured_text_bidi_override_options>` | ``[]`` |
  50. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  51. | :ref:`PackedFloat32Array<class_PackedFloat32Array>` | :ref:`tab_stops<class_Label_property_tab_stops>` | ``PackedFloat32Array()`` |
  52. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  53. | :ref:`String<class_String>` | :ref:`text<class_Label_property_text>` | ``""`` |
  54. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  55. | :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`text_direction<class_Label_property_text_direction>` | ``0`` |
  56. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  57. | :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` | :ref:`text_overrun_behavior<class_Label_property_text_overrun_behavior>` | ``0`` |
  58. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  59. | :ref:`bool<class_bool>` | :ref:`uppercase<class_Label_property_uppercase>` | ``false`` |
  60. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  61. | :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` | :ref:`vertical_alignment<class_Label_property_vertical_alignment>` | ``0`` |
  62. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  63. | :ref:`int<class_int>` | :ref:`visible_characters<class_Label_property_visible_characters>` | ``-1`` |
  64. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  65. | :ref:`VisibleCharactersBehavior<enum_TextServer_VisibleCharactersBehavior>` | :ref:`visible_characters_behavior<class_Label_property_visible_characters_behavior>` | ``0`` |
  66. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  67. | :ref:`float<class_float>` | :ref:`visible_ratio<class_Label_property_visible_ratio>` | ``1.0`` |
  68. +-----------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  69. .. rst-class:: classref-reftable-group
  70. Methods
  71. -------
  72. .. table::
  73. :widths: auto
  74. +-----------------------+--------------------------------------------------------------------------------------------------------------+
  75. | :ref:`int<class_int>` | :ref:`get_line_count<class_Label_method_get_line_count>` **(** **)** |const| |
  76. +-----------------------+--------------------------------------------------------------------------------------------------------------+
  77. | :ref:`int<class_int>` | :ref:`get_line_height<class_Label_method_get_line_height>` **(** :ref:`int<class_int>` line=-1 **)** |const| |
  78. +-----------------------+--------------------------------------------------------------------------------------------------------------+
  79. | :ref:`int<class_int>` | :ref:`get_total_character_count<class_Label_method_get_total_character_count>` **(** **)** |const| |
  80. +-----------------------+--------------------------------------------------------------------------------------------------------------+
  81. | :ref:`int<class_int>` | :ref:`get_visible_line_count<class_Label_method_get_visible_line_count>` **(** **)** |const| |
  82. +-----------------------+--------------------------------------------------------------------------------------------------------------+
  83. .. rst-class:: classref-reftable-group
  84. Theme Properties
  85. ----------------
  86. .. table::
  87. :widths: auto
  88. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  89. | :ref:`Color<class_Color>` | :ref:`font_color<class_Label_theme_color_font_color>` | ``Color(1, 1, 1, 1)`` |
  90. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  91. | :ref:`Color<class_Color>` | :ref:`font_outline_color<class_Label_theme_color_font_outline_color>` | ``Color(1, 1, 1, 1)`` |
  92. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  93. | :ref:`Color<class_Color>` | :ref:`font_shadow_color<class_Label_theme_color_font_shadow_color>` | ``Color(0, 0, 0, 0)`` |
  94. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  95. | :ref:`int<class_int>` | :ref:`line_spacing<class_Label_theme_constant_line_spacing>` | ``3`` |
  96. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  97. | :ref:`int<class_int>` | :ref:`outline_size<class_Label_theme_constant_outline_size>` | ``0`` |
  98. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  99. | :ref:`int<class_int>` | :ref:`shadow_offset_x<class_Label_theme_constant_shadow_offset_x>` | ``1`` |
  100. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  101. | :ref:`int<class_int>` | :ref:`shadow_offset_y<class_Label_theme_constant_shadow_offset_y>` | ``1`` |
  102. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  103. | :ref:`int<class_int>` | :ref:`shadow_outline_size<class_Label_theme_constant_shadow_outline_size>` | ``1`` |
  104. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  105. | :ref:`Font<class_Font>` | :ref:`font<class_Label_theme_font_font>` | |
  106. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  107. | :ref:`int<class_int>` | :ref:`font_size<class_Label_theme_font_size_font_size>` | |
  108. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  109. | :ref:`StyleBox<class_StyleBox>` | :ref:`normal<class_Label_theme_style_normal>` | |
  110. +---------------------------------+----------------------------------------------------------------------------+-----------------------+
  111. .. rst-class:: classref-section-separator
  112. ----
  113. .. rst-class:: classref-descriptions-group
  114. Property Descriptions
  115. ---------------------
  116. .. _class_Label_property_autowrap_mode:
  117. .. rst-class:: classref-property
  118. :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **autowrap_mode** = ``0``
  119. .. rst-class:: classref-property-setget
  120. - void **set_autowrap_mode** **(** :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` value **)**
  121. - :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **get_autowrap_mode** **(** **)**
  122. 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. To see how each mode behaves, see :ref:`AutowrapMode<enum_TextServer_AutowrapMode>`.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_Label_property_clip_text:
  126. .. rst-class:: classref-property
  127. :ref:`bool<class_bool>` **clip_text** = ``false``
  128. .. rst-class:: classref-property-setget
  129. - void **set_clip_text** **(** :ref:`bool<class_bool>` value **)**
  130. - :ref:`bool<class_bool>` **is_clipping_text** **(** **)**
  131. If ``true``, the Label only shows the text that fits inside its bounding rectangle and will clip text horizontally.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_Label_property_ellipsis_char:
  135. .. rst-class:: classref-property
  136. :ref:`String<class_String>` **ellipsis_char** = ``"…"``
  137. .. rst-class:: classref-property-setget
  138. - void **set_ellipsis_char** **(** :ref:`String<class_String>` value **)**
  139. - :ref:`String<class_String>` **get_ellipsis_char** **(** **)**
  140. Ellipsis character used for text clipping.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_Label_property_horizontal_alignment:
  144. .. rst-class:: classref-property
  145. :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **horizontal_alignment** = ``0``
  146. .. rst-class:: classref-property-setget
  147. - void **set_horizontal_alignment** **(** :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` value **)**
  148. - :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_horizontal_alignment** **(** **)**
  149. Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` constants.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_Label_property_justification_flags:
  153. .. rst-class:: classref-property
  154. |bitfield|\<:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\> **justification_flags** = ``163``
  155. .. rst-class:: classref-property-setget
  156. - void **set_justification_flags** **(** |bitfield|\<:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\> value **)**
  157. - |bitfield|\<:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\> **get_justification_flags** **(** **)**
  158. Line fill alignment rules. For more info see :ref:`JustificationFlag<enum_TextServer_JustificationFlag>`.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_Label_property_label_settings:
  162. .. rst-class:: classref-property
  163. :ref:`LabelSettings<class_LabelSettings>` **label_settings**
  164. .. rst-class:: classref-property-setget
  165. - void **set_label_settings** **(** :ref:`LabelSettings<class_LabelSettings>` value **)**
  166. - :ref:`LabelSettings<class_LabelSettings>` **get_label_settings** **(** **)**
  167. A :ref:`LabelSettings<class_LabelSettings>` resource that can be shared between multiple **Label** nodes. Takes priority over theme properties.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_Label_property_language:
  171. .. rst-class:: classref-property
  172. :ref:`String<class_String>` **language** = ``""``
  173. .. rst-class:: classref-property-setget
  174. - void **set_language** **(** :ref:`String<class_String>` value **)**
  175. - :ref:`String<class_String>` **get_language** **(** **)**
  176. Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_Label_property_lines_skipped:
  180. .. rst-class:: classref-property
  181. :ref:`int<class_int>` **lines_skipped** = ``0``
  182. .. rst-class:: classref-property-setget
  183. - void **set_lines_skipped** **(** :ref:`int<class_int>` value **)**
  184. - :ref:`int<class_int>` **get_lines_skipped** **(** **)**
  185. The number of the lines ignored and not displayed from the start of the :ref:`text<class_Label_property_text>` value.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_Label_property_max_lines_visible:
  189. .. rst-class:: classref-property
  190. :ref:`int<class_int>` **max_lines_visible** = ``-1``
  191. .. rst-class:: classref-property-setget
  192. - void **set_max_lines_visible** **(** :ref:`int<class_int>` value **)**
  193. - :ref:`int<class_int>` **get_max_lines_visible** **(** **)**
  194. Limits the lines of text the node shows on screen.
  195. .. rst-class:: classref-item-separator
  196. ----
  197. .. _class_Label_property_structured_text_bidi_override:
  198. .. rst-class:: classref-property
  199. :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **structured_text_bidi_override** = ``0``
  200. .. rst-class:: classref-property-setget
  201. - void **set_structured_text_bidi_override** **(** :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` value **)**
  202. - :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **get_structured_text_bidi_override** **(** **)**
  203. Set BiDi algorithm override for the structured text.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_Label_property_structured_text_bidi_override_options:
  207. .. rst-class:: classref-property
  208. :ref:`Array<class_Array>` **structured_text_bidi_override_options** = ``[]``
  209. .. rst-class:: classref-property-setget
  210. - void **set_structured_text_bidi_override_options** **(** :ref:`Array<class_Array>` value **)**
  211. - :ref:`Array<class_Array>` **get_structured_text_bidi_override_options** **(** **)**
  212. Set additional options for BiDi override.
  213. .. rst-class:: classref-item-separator
  214. ----
  215. .. _class_Label_property_tab_stops:
  216. .. rst-class:: classref-property
  217. :ref:`PackedFloat32Array<class_PackedFloat32Array>` **tab_stops** = ``PackedFloat32Array()``
  218. .. rst-class:: classref-property-setget
  219. - void **set_tab_stops** **(** :ref:`PackedFloat32Array<class_PackedFloat32Array>` value **)**
  220. - :ref:`PackedFloat32Array<class_PackedFloat32Array>` **get_tab_stops** **(** **)**
  221. Aligns text to the given tab-stops.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_Label_property_text:
  225. .. rst-class:: classref-property
  226. :ref:`String<class_String>` **text** = ``""``
  227. .. rst-class:: classref-property-setget
  228. - void **set_text** **(** :ref:`String<class_String>` value **)**
  229. - :ref:`String<class_String>` **get_text** **(** **)**
  230. The text to display on screen.
  231. .. rst-class:: classref-item-separator
  232. ----
  233. .. _class_Label_property_text_direction:
  234. .. rst-class:: classref-property
  235. :ref:`TextDirection<enum_Control_TextDirection>` **text_direction** = ``0``
  236. .. rst-class:: classref-property-setget
  237. - void **set_text_direction** **(** :ref:`TextDirection<enum_Control_TextDirection>` value **)**
  238. - :ref:`TextDirection<enum_Control_TextDirection>` **get_text_direction** **(** **)**
  239. Base text writing direction.
  240. .. rst-class:: classref-item-separator
  241. ----
  242. .. _class_Label_property_text_overrun_behavior:
  243. .. rst-class:: classref-property
  244. :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **text_overrun_behavior** = ``0``
  245. .. rst-class:: classref-property-setget
  246. - void **set_text_overrun_behavior** **(** :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` value **)**
  247. - :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **get_text_overrun_behavior** **(** **)**
  248. Sets the clipping behavior when the text exceeds the node's bounding rectangle. See :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` for a description of all modes.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_Label_property_uppercase:
  252. .. rst-class:: classref-property
  253. :ref:`bool<class_bool>` **uppercase** = ``false``
  254. .. rst-class:: classref-property-setget
  255. - void **set_uppercase** **(** :ref:`bool<class_bool>` value **)**
  256. - :ref:`bool<class_bool>` **is_uppercase** **(** **)**
  257. If ``true``, all the text displays as UPPERCASE.
  258. .. rst-class:: classref-item-separator
  259. ----
  260. .. _class_Label_property_vertical_alignment:
  261. .. rst-class:: classref-property
  262. :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **vertical_alignment** = ``0``
  263. .. rst-class:: classref-property-setget
  264. - void **set_vertical_alignment** **(** :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` value **)**
  265. - :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **get_vertical_alignment** **(** **)**
  266. Controls the text's vertical alignment. Supports top, center, bottom, and fill. Set it to one of the :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` constants.
  267. .. rst-class:: classref-item-separator
  268. ----
  269. .. _class_Label_property_visible_characters:
  270. .. rst-class:: classref-property
  271. :ref:`int<class_int>` **visible_characters** = ``-1``
  272. .. rst-class:: classref-property-setget
  273. - void **set_visible_characters** **(** :ref:`int<class_int>` value **)**
  274. - :ref:`int<class_int>` **get_visible_characters** **(** **)**
  275. 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.
  276. \ **Note:** Setting this property updates :ref:`visible_ratio<class_Label_property_visible_ratio>` accordingly.
  277. .. rst-class:: classref-item-separator
  278. ----
  279. .. _class_Label_property_visible_characters_behavior:
  280. .. rst-class:: classref-property
  281. :ref:`VisibleCharactersBehavior<enum_TextServer_VisibleCharactersBehavior>` **visible_characters_behavior** = ``0``
  282. .. rst-class:: classref-property-setget
  283. - void **set_visible_characters_behavior** **(** :ref:`VisibleCharactersBehavior<enum_TextServer_VisibleCharactersBehavior>` value **)**
  284. - :ref:`VisibleCharactersBehavior<enum_TextServer_VisibleCharactersBehavior>` **get_visible_characters_behavior** **(** **)**
  285. Sets the clipping behavior when :ref:`visible_characters<class_Label_property_visible_characters>` or :ref:`visible_ratio<class_Label_property_visible_ratio>` is set. See :ref:`VisibleCharactersBehavior<enum_TextServer_VisibleCharactersBehavior>` for more info.
  286. .. rst-class:: classref-item-separator
  287. ----
  288. .. _class_Label_property_visible_ratio:
  289. .. rst-class:: classref-property
  290. :ref:`float<class_float>` **visible_ratio** = ``1.0``
  291. .. rst-class:: classref-property-setget
  292. - void **set_visible_ratio** **(** :ref:`float<class_float>` value **)**
  293. - :ref:`float<class_float>` **get_visible_ratio** **(** **)**
  294. 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.
  295. \ **Note:** Setting this property updates :ref:`visible_characters<class_Label_property_visible_characters>` accordingly.
  296. .. rst-class:: classref-section-separator
  297. ----
  298. .. rst-class:: classref-descriptions-group
  299. Method Descriptions
  300. -------------------
  301. .. _class_Label_method_get_line_count:
  302. .. rst-class:: classref-method
  303. :ref:`int<class_int>` **get_line_count** **(** **)** |const|
  304. Returns the number of lines of text the Label has.
  305. .. rst-class:: classref-item-separator
  306. ----
  307. .. _class_Label_method_get_line_height:
  308. .. rst-class:: classref-method
  309. :ref:`int<class_int>` **get_line_height** **(** :ref:`int<class_int>` line=-1 **)** |const|
  310. Returns the height of the line ``line``.
  311. If ``line`` is set to ``-1``, returns the biggest line height.
  312. If there are no lines, returns font size in pixels.
  313. .. rst-class:: classref-item-separator
  314. ----
  315. .. _class_Label_method_get_total_character_count:
  316. .. rst-class:: classref-method
  317. :ref:`int<class_int>` **get_total_character_count** **(** **)** |const|
  318. Returns the total number of printable characters in the text (excluding spaces and newlines).
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_Label_method_get_visible_line_count:
  322. .. rst-class:: classref-method
  323. :ref:`int<class_int>` **get_visible_line_count** **(** **)** |const|
  324. Returns the number of lines shown. Useful if the **Label**'s height cannot currently display all lines.
  325. .. rst-class:: classref-section-separator
  326. ----
  327. .. rst-class:: classref-descriptions-group
  328. Theme Property Descriptions
  329. ---------------------------
  330. .. _class_Label_theme_color_font_color:
  331. .. rst-class:: classref-themeproperty
  332. :ref:`Color<class_Color>` **font_color** = ``Color(1, 1, 1, 1)``
  333. Default text :ref:`Color<class_Color>` of the **Label**.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_Label_theme_color_font_outline_color:
  337. .. rst-class:: classref-themeproperty
  338. :ref:`Color<class_Color>` **font_outline_color** = ``Color(1, 1, 1, 1)``
  339. The color of text outline.
  340. .. rst-class:: classref-item-separator
  341. ----
  342. .. _class_Label_theme_color_font_shadow_color:
  343. .. rst-class:: classref-themeproperty
  344. :ref:`Color<class_Color>` **font_shadow_color** = ``Color(0, 0, 0, 0)``
  345. :ref:`Color<class_Color>` of the text's shadow effect.
  346. .. rst-class:: classref-item-separator
  347. ----
  348. .. _class_Label_theme_constant_line_spacing:
  349. .. rst-class:: classref-themeproperty
  350. :ref:`int<class_int>` **line_spacing** = ``3``
  351. Vertical space between lines in multiline **Label**.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_Label_theme_constant_outline_size:
  355. .. rst-class:: classref-themeproperty
  356. :ref:`int<class_int>` **outline_size** = ``0``
  357. Text outline size.
  358. \ **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.
  359. .. rst-class:: classref-item-separator
  360. ----
  361. .. _class_Label_theme_constant_shadow_offset_x:
  362. .. rst-class:: classref-themeproperty
  363. :ref:`int<class_int>` **shadow_offset_x** = ``1``
  364. The horizontal offset of the text's shadow.
  365. .. rst-class:: classref-item-separator
  366. ----
  367. .. _class_Label_theme_constant_shadow_offset_y:
  368. .. rst-class:: classref-themeproperty
  369. :ref:`int<class_int>` **shadow_offset_y** = ``1``
  370. The vertical offset of the text's shadow.
  371. .. rst-class:: classref-item-separator
  372. ----
  373. .. _class_Label_theme_constant_shadow_outline_size:
  374. .. rst-class:: classref-themeproperty
  375. :ref:`int<class_int>` **shadow_outline_size** = ``1``
  376. The size of the shadow outline.
  377. .. rst-class:: classref-item-separator
  378. ----
  379. .. _class_Label_theme_font_font:
  380. .. rst-class:: classref-themeproperty
  381. :ref:`Font<class_Font>` **font**
  382. :ref:`Font<class_Font>` used for the **Label**'s text.
  383. .. rst-class:: classref-item-separator
  384. ----
  385. .. _class_Label_theme_font_size_font_size:
  386. .. rst-class:: classref-themeproperty
  387. :ref:`int<class_int>` **font_size**
  388. Font size of the **Label**'s text.
  389. .. rst-class:: classref-item-separator
  390. ----
  391. .. _class_Label_theme_style_normal:
  392. .. rst-class:: classref-themeproperty
  393. :ref:`StyleBox<class_StyleBox>` **normal**
  394. Background :ref:`StyleBox<class_StyleBox>` for the **Label**.
  395. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  396. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  397. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  398. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  399. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  400. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  401. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`