class_label.rst 32 KB

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