class_textmesh.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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/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:`JustificationFlag<enum_TextServer_JustificationFlag>` | :ref:`justification_flags<class_TextMesh_property_justification_flags>` | ``163`` |
  36. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  37. | :ref:`String<class_String>` | :ref:`language<class_TextMesh_property_language>` | ``""`` |
  38. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  39. | :ref:`float<class_float>` | :ref:`line_spacing<class_TextMesh_property_line_spacing>` | ``0.0`` |
  40. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  41. | :ref:`Vector2<class_Vector2>` | :ref:`offset<class_TextMesh_property_offset>` | ``Vector2(0, 0)`` |
  42. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  43. | :ref:`float<class_float>` | :ref:`pixel_size<class_TextMesh_property_pixel_size>` | ``0.01`` |
  44. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  45. | :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` | :ref:`structured_text_bidi_override<class_TextMesh_property_structured_text_bidi_override>` | ``0`` |
  46. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  47. | :ref:`Array<class_Array>` | :ref:`structured_text_bidi_override_options<class_TextMesh_property_structured_text_bidi_override_options>` | ``[]`` |
  48. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  49. | :ref:`String<class_String>` | :ref:`text<class_TextMesh_property_text>` | ``""`` |
  50. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  51. | :ref:`Direction<enum_TextServer_Direction>` | :ref:`text_direction<class_TextMesh_property_text_direction>` | ``0`` |
  52. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  53. | :ref:`bool<class_bool>` | :ref:`uppercase<class_TextMesh_property_uppercase>` | ``false`` |
  54. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  55. | :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` | :ref:`vertical_alignment<class_TextMesh_property_vertical_alignment>` | ``1`` |
  56. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  57. | :ref:`float<class_float>` | :ref:`width<class_TextMesh_property_width>` | ``500.0`` |
  58. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  59. .. rst-class:: classref-section-separator
  60. ----
  61. .. rst-class:: classref-descriptions-group
  62. Property Descriptions
  63. ---------------------
  64. .. _class_TextMesh_property_autowrap_mode:
  65. .. rst-class:: classref-property
  66. :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **autowrap_mode** = ``0``
  67. .. rst-class:: classref-property-setget
  68. - void **set_autowrap_mode** **(** :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` value **)**
  69. - :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **get_autowrap_mode** **(** **)**
  70. 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>`.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _class_TextMesh_property_curve_step:
  74. .. rst-class:: classref-property
  75. :ref:`float<class_float>` **curve_step** = ``0.5``
  76. .. rst-class:: classref-property-setget
  77. - void **set_curve_step** **(** :ref:`float<class_float>` value **)**
  78. - :ref:`float<class_float>` **get_curve_step** **(** **)**
  79. Step (in pixels) used to approximate Bézier curves.
  80. .. rst-class:: classref-item-separator
  81. ----
  82. .. _class_TextMesh_property_depth:
  83. .. rst-class:: classref-property
  84. :ref:`float<class_float>` **depth** = ``0.05``
  85. .. rst-class:: classref-property-setget
  86. - void **set_depth** **(** :ref:`float<class_float>` value **)**
  87. - :ref:`float<class_float>` **get_depth** **(** **)**
  88. 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.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_TextMesh_property_font:
  92. .. rst-class:: classref-property
  93. :ref:`Font<class_Font>` **font**
  94. .. rst-class:: classref-property-setget
  95. - void **set_font** **(** :ref:`Font<class_Font>` value **)**
  96. - :ref:`Font<class_Font>` **get_font** **(** **)**
  97. Font configuration used to display text.
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_TextMesh_property_font_size:
  101. .. rst-class:: classref-property
  102. :ref:`int<class_int>` **font_size** = ``16``
  103. .. rst-class:: classref-property-setget
  104. - void **set_font_size** **(** :ref:`int<class_int>` value **)**
  105. - :ref:`int<class_int>` **get_font_size** **(** **)**
  106. Font size of the **TextMesh**'s text.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_TextMesh_property_horizontal_alignment:
  110. .. rst-class:: classref-property
  111. :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **horizontal_alignment** = ``1``
  112. .. rst-class:: classref-property-setget
  113. - void **set_horizontal_alignment** **(** :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` value **)**
  114. - :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_horizontal_alignment** **(** **)**
  115. 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.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_TextMesh_property_justification_flags:
  119. .. rst-class:: classref-property
  120. :ref:`JustificationFlag<enum_TextServer_JustificationFlag>` **justification_flags** = ``163``
  121. .. rst-class:: classref-property-setget
  122. - void **set_justification_flags** **(** :ref:`JustificationFlag<enum_TextServer_JustificationFlag>` value **)**
  123. - :ref:`JustificationFlag<enum_TextServer_JustificationFlag>` **get_justification_flags** **(** **)**
  124. Line fill alignment rules. For more info see :ref:`JustificationFlag<enum_TextServer_JustificationFlag>`.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_TextMesh_property_language:
  128. .. rst-class:: classref-property
  129. :ref:`String<class_String>` **language** = ``""``
  130. .. rst-class:: classref-property-setget
  131. - void **set_language** **(** :ref:`String<class_String>` value **)**
  132. - :ref:`String<class_String>` **get_language** **(** **)**
  133. Language code used for text shaping algorithms, if left empty current locale is used instead.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_TextMesh_property_line_spacing:
  137. .. rst-class:: classref-property
  138. :ref:`float<class_float>` **line_spacing** = ``0.0``
  139. .. rst-class:: classref-property-setget
  140. - void **set_line_spacing** **(** :ref:`float<class_float>` value **)**
  141. - :ref:`float<class_float>` **get_line_spacing** **(** **)**
  142. Vertical space between lines in multiline **TextMesh**.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_TextMesh_property_offset:
  146. .. rst-class:: classref-property
  147. :ref:`Vector2<class_Vector2>` **offset** = ``Vector2(0, 0)``
  148. .. rst-class:: classref-property-setget
  149. - void **set_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
  150. - :ref:`Vector2<class_Vector2>` **get_offset** **(** **)**
  151. The text drawing offset (in pixels).
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_TextMesh_property_pixel_size:
  155. .. rst-class:: classref-property
  156. :ref:`float<class_float>` **pixel_size** = ``0.01``
  157. .. rst-class:: classref-property-setget
  158. - void **set_pixel_size** **(** :ref:`float<class_float>` value **)**
  159. - :ref:`float<class_float>` **get_pixel_size** **(** **)**
  160. The size of one pixel's width on the text to scale it in 3D.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_TextMesh_property_structured_text_bidi_override:
  164. .. rst-class:: classref-property
  165. :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **structured_text_bidi_override** = ``0``
  166. .. rst-class:: classref-property-setget
  167. - void **set_structured_text_bidi_override** **(** :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` value **)**
  168. - :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **get_structured_text_bidi_override** **(** **)**
  169. Set BiDi algorithm override for the structured text.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_TextMesh_property_structured_text_bidi_override_options:
  173. .. rst-class:: classref-property
  174. :ref:`Array<class_Array>` **structured_text_bidi_override_options** = ``[]``
  175. .. rst-class:: classref-property-setget
  176. - void **set_structured_text_bidi_override_options** **(** :ref:`Array<class_Array>` value **)**
  177. - :ref:`Array<class_Array>` **get_structured_text_bidi_override_options** **(** **)**
  178. Set additional options for BiDi override.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _class_TextMesh_property_text:
  182. .. rst-class:: classref-property
  183. :ref:`String<class_String>` **text** = ``""``
  184. .. rst-class:: classref-property-setget
  185. - void **set_text** **(** :ref:`String<class_String>` value **)**
  186. - :ref:`String<class_String>` **get_text** **(** **)**
  187. The text to generate mesh from.
  188. .. rst-class:: classref-item-separator
  189. ----
  190. .. _class_TextMesh_property_text_direction:
  191. .. rst-class:: classref-property
  192. :ref:`Direction<enum_TextServer_Direction>` **text_direction** = ``0``
  193. .. rst-class:: classref-property-setget
  194. - void **set_text_direction** **(** :ref:`Direction<enum_TextServer_Direction>` value **)**
  195. - :ref:`Direction<enum_TextServer_Direction>` **get_text_direction** **(** **)**
  196. Base text writing direction.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_TextMesh_property_uppercase:
  200. .. rst-class:: classref-property
  201. :ref:`bool<class_bool>` **uppercase** = ``false``
  202. .. rst-class:: classref-property-setget
  203. - void **set_uppercase** **(** :ref:`bool<class_bool>` value **)**
  204. - :ref:`bool<class_bool>` **is_uppercase** **(** **)**
  205. If ``true``, all the text displays as UPPERCASE.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_TextMesh_property_vertical_alignment:
  209. .. rst-class:: classref-property
  210. :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **vertical_alignment** = ``1``
  211. .. rst-class:: classref-property-setget
  212. - void **set_vertical_alignment** **(** :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` value **)**
  213. - :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **get_vertical_alignment** **(** **)**
  214. Controls the text's vertical alignment. Supports top, center, bottom. Set it to one of the :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` constants.
  215. .. rst-class:: classref-item-separator
  216. ----
  217. .. _class_TextMesh_property_width:
  218. .. rst-class:: classref-property
  219. :ref:`float<class_float>` **width** = ``500.0``
  220. .. rst-class:: classref-property-setget
  221. - void **set_width** **(** :ref:`float<class_float>` value **)**
  222. - :ref:`float<class_float>` **get_width** **(** **)**
  223. Text width (in pixels), used for fill alignment.
  224. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  225. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  226. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  227. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  228. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  229. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`