class_textmesh.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/TextMesh.xml.
  6. .. _class_TextMesh:
  7. TextMesh
  8. ========
  9. **Inherits:** :ref:`PrimitiveMesh<class_PrimitiveMesh>` **<** :ref:`Mesh<class_Mesh>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Generate an :ref:`PrimitiveMesh<class_PrimitiveMesh>` from the text.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Generate an :ref:`PrimitiveMesh<class_PrimitiveMesh>` from the text.
  15. TextMesh can be generated only when using dynamic fonts with vector glyph contours. Bitmap fonts (including bitmap data in the TrueType/OpenType containers, like color emoji fonts) are not supported.
  16. The UV layout is arranged in 4 horizontal strips, top to bottom: 40% of the height for the front face, 40% for the back face, 10% for the outer edges and 10% for the inner edges.
  17. .. rst-class:: classref-reftable-group
  18. Properties
  19. ----------
  20. .. table::
  21. :widths: auto
  22. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  23. | :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` | :ref:`autowrap_mode<class_TextMesh_property_autowrap_mode>` | ``0`` |
  24. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  25. | :ref:`float<class_float>` | :ref:`curve_step<class_TextMesh_property_curve_step>` | ``0.5`` |
  26. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  27. | :ref:`float<class_float>` | :ref:`depth<class_TextMesh_property_depth>` | ``0.05`` |
  28. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  29. | :ref:`Font<class_Font>` | :ref:`font<class_TextMesh_property_font>` | |
  30. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  31. | :ref:`int<class_int>` | :ref:`font_size<class_TextMesh_property_font_size>` | ``16`` |
  32. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  33. | :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`horizontal_alignment<class_TextMesh_property_horizontal_alignment>` | ``1`` |
  34. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  35. | :ref:`String<class_String>` | :ref:`language<class_TextMesh_property_language>` | ``""`` |
  36. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  37. | :ref:`float<class_float>` | :ref:`line_spacing<class_TextMesh_property_line_spacing>` | ``0.0`` |
  38. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  39. | :ref:`Vector2<class_Vector2>` | :ref:`offset<class_TextMesh_property_offset>` | ``Vector2(0, 0)`` |
  40. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  41. | :ref:`float<class_float>` | :ref:`pixel_size<class_TextMesh_property_pixel_size>` | ``0.01`` |
  42. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  43. | :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` | :ref:`structured_text_bidi_override<class_TextMesh_property_structured_text_bidi_override>` | ``0`` |
  44. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  45. | :ref:`Array<class_Array>` | :ref:`structured_text_bidi_override_options<class_TextMesh_property_structured_text_bidi_override_options>` | ``[]`` |
  46. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  47. | :ref:`String<class_String>` | :ref:`text<class_TextMesh_property_text>` | ``""`` |
  48. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  49. | :ref:`Direction<enum_TextServer_Direction>` | :ref:`text_direction<class_TextMesh_property_text_direction>` | ``0`` |
  50. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  51. | :ref:`bool<class_bool>` | :ref:`uppercase<class_TextMesh_property_uppercase>` | ``false`` |
  52. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  53. | :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` | :ref:`vertical_alignment<class_TextMesh_property_vertical_alignment>` | ``1`` |
  54. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  55. | :ref:`float<class_float>` | :ref:`width<class_TextMesh_property_width>` | ``500.0`` |
  56. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  57. .. rst-class:: classref-section-separator
  58. ----
  59. .. rst-class:: classref-descriptions-group
  60. Property Descriptions
  61. ---------------------
  62. .. _class_TextMesh_property_autowrap_mode:
  63. .. rst-class:: classref-property
  64. :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **autowrap_mode** = ``0``
  65. .. rst-class:: classref-property-setget
  66. - void **set_autowrap_mode** **(** :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` value **)**
  67. - :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **get_autowrap_mode** **(** **)**
  68. 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>`.
  69. .. rst-class:: classref-item-separator
  70. ----
  71. .. _class_TextMesh_property_curve_step:
  72. .. rst-class:: classref-property
  73. :ref:`float<class_float>` **curve_step** = ``0.5``
  74. .. rst-class:: classref-property-setget
  75. - void **set_curve_step** **(** :ref:`float<class_float>` value **)**
  76. - :ref:`float<class_float>` **get_curve_step** **(** **)**
  77. Step (in pixels) used to approximate Bézier curves.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_TextMesh_property_depth:
  81. .. rst-class:: classref-property
  82. :ref:`float<class_float>` **depth** = ``0.05``
  83. .. rst-class:: classref-property-setget
  84. - void **set_depth** **(** :ref:`float<class_float>` value **)**
  85. - :ref:`float<class_float>` **get_depth** **(** **)**
  86. Depths of the mesh, if set to ``0.0`` only front surface, is generated, and UV layout is changed to use full texture for the front face only.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_TextMesh_property_font:
  90. .. rst-class:: classref-property
  91. :ref:`Font<class_Font>` **font**
  92. .. rst-class:: classref-property-setget
  93. - void **set_font** **(** :ref:`Font<class_Font>` value **)**
  94. - :ref:`Font<class_Font>` **get_font** **(** **)**
  95. Font configuration used to display text.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_TextMesh_property_font_size:
  99. .. rst-class:: classref-property
  100. :ref:`int<class_int>` **font_size** = ``16``
  101. .. rst-class:: classref-property-setget
  102. - void **set_font_size** **(** :ref:`int<class_int>` value **)**
  103. - :ref:`int<class_int>` **get_font_size** **(** **)**
  104. Font size of the **TextMesh**'s text.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_TextMesh_property_horizontal_alignment:
  108. .. rst-class:: classref-property
  109. :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **horizontal_alignment** = ``1``
  110. .. rst-class:: classref-property-setget
  111. - void **set_horizontal_alignment** **(** :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` value **)**
  112. - :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_horizontal_alignment** **(** **)**
  113. 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.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_TextMesh_property_language:
  117. .. rst-class:: classref-property
  118. :ref:`String<class_String>` **language** = ``""``
  119. .. rst-class:: classref-property-setget
  120. - void **set_language** **(** :ref:`String<class_String>` value **)**
  121. - :ref:`String<class_String>` **get_language** **(** **)**
  122. Language code used for text shaping algorithms, if left empty current locale is used instead.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_TextMesh_property_line_spacing:
  126. .. rst-class:: classref-property
  127. :ref:`float<class_float>` **line_spacing** = ``0.0``
  128. .. rst-class:: classref-property-setget
  129. - void **set_line_spacing** **(** :ref:`float<class_float>` value **)**
  130. - :ref:`float<class_float>` **get_line_spacing** **(** **)**
  131. Vertical space between lines in multiline **TextMesh**.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_TextMesh_property_offset:
  135. .. rst-class:: classref-property
  136. :ref:`Vector2<class_Vector2>` **offset** = ``Vector2(0, 0)``
  137. .. rst-class:: classref-property-setget
  138. - void **set_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
  139. - :ref:`Vector2<class_Vector2>` **get_offset** **(** **)**
  140. The text drawing offset (in pixels).
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_TextMesh_property_pixel_size:
  144. .. rst-class:: classref-property
  145. :ref:`float<class_float>` **pixel_size** = ``0.01``
  146. .. rst-class:: classref-property-setget
  147. - void **set_pixel_size** **(** :ref:`float<class_float>` value **)**
  148. - :ref:`float<class_float>` **get_pixel_size** **(** **)**
  149. The size of one pixel's width on the text to scale it in 3D.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_TextMesh_property_structured_text_bidi_override:
  153. .. rst-class:: classref-property
  154. :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **structured_text_bidi_override** = ``0``
  155. .. rst-class:: classref-property-setget
  156. - void **set_structured_text_bidi_override** **(** :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` value **)**
  157. - :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **get_structured_text_bidi_override** **(** **)**
  158. Set BiDi algorithm override for the structured text.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_TextMesh_property_structured_text_bidi_override_options:
  162. .. rst-class:: classref-property
  163. :ref:`Array<class_Array>` **structured_text_bidi_override_options** = ``[]``
  164. .. rst-class:: classref-property-setget
  165. - void **set_structured_text_bidi_override_options** **(** :ref:`Array<class_Array>` value **)**
  166. - :ref:`Array<class_Array>` **get_structured_text_bidi_override_options** **(** **)**
  167. Set additional options for BiDi override.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_TextMesh_property_text:
  171. .. rst-class:: classref-property
  172. :ref:`String<class_String>` **text** = ``""``
  173. .. rst-class:: classref-property-setget
  174. - void **set_text** **(** :ref:`String<class_String>` value **)**
  175. - :ref:`String<class_String>` **get_text** **(** **)**
  176. The text to generate mesh from.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_TextMesh_property_text_direction:
  180. .. rst-class:: classref-property
  181. :ref:`Direction<enum_TextServer_Direction>` **text_direction** = ``0``
  182. .. rst-class:: classref-property-setget
  183. - void **set_text_direction** **(** :ref:`Direction<enum_TextServer_Direction>` value **)**
  184. - :ref:`Direction<enum_TextServer_Direction>` **get_text_direction** **(** **)**
  185. Base text writing direction.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_TextMesh_property_uppercase:
  189. .. rst-class:: classref-property
  190. :ref:`bool<class_bool>` **uppercase** = ``false``
  191. .. rst-class:: classref-property-setget
  192. - void **set_uppercase** **(** :ref:`bool<class_bool>` value **)**
  193. - :ref:`bool<class_bool>` **is_uppercase** **(** **)**
  194. If ``true``, all the text displays as UPPERCASE.
  195. .. rst-class:: classref-item-separator
  196. ----
  197. .. _class_TextMesh_property_vertical_alignment:
  198. .. rst-class:: classref-property
  199. :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **vertical_alignment** = ``1``
  200. .. rst-class:: classref-property-setget
  201. - void **set_vertical_alignment** **(** :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` value **)**
  202. - :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **get_vertical_alignment** **(** **)**
  203. Controls the text's vertical alignment. Supports top, center, bottom. Set it to one of the :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` constants.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_TextMesh_property_width:
  207. .. rst-class:: classref-property
  208. :ref:`float<class_float>` **width** = ``500.0``
  209. .. rst-class:: classref-property-setget
  210. - void **set_width** **(** :ref:`float<class_float>` value **)**
  211. - :ref:`float<class_float>` **get_width** **(** **)**
  212. Text width (in pixels), used for fill alignment.
  213. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  214. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  215. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  216. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  217. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  218. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`