class_textmesh.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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 a :ref:`PrimitiveMesh<class_PrimitiveMesh>` from the text.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Generate a :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-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`3D text <../tutorials/3d/3d_text>`
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  27. | :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` | :ref:`autowrap_mode<class_TextMesh_property_autowrap_mode>` | ``0`` |
  28. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  29. | :ref:`float<class_float>` | :ref:`curve_step<class_TextMesh_property_curve_step>` | ``0.5`` |
  30. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  31. | :ref:`float<class_float>` | :ref:`depth<class_TextMesh_property_depth>` | ``0.05`` |
  32. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  33. | :ref:`Font<class_Font>` | :ref:`font<class_TextMesh_property_font>` | |
  34. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  35. | :ref:`int<class_int>` | :ref:`font_size<class_TextMesh_property_font_size>` | ``16`` |
  36. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  37. | :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`horizontal_alignment<class_TextMesh_property_horizontal_alignment>` | ``1`` |
  38. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  39. | |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] | :ref:`justification_flags<class_TextMesh_property_justification_flags>` | ``163`` |
  40. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  41. | :ref:`String<class_String>` | :ref:`language<class_TextMesh_property_language>` | ``""`` |
  42. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  43. | :ref:`float<class_float>` | :ref:`line_spacing<class_TextMesh_property_line_spacing>` | ``0.0`` |
  44. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  45. | :ref:`Vector2<class_Vector2>` | :ref:`offset<class_TextMesh_property_offset>` | ``Vector2(0, 0)`` |
  46. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  47. | :ref:`float<class_float>` | :ref:`pixel_size<class_TextMesh_property_pixel_size>` | ``0.01`` |
  48. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  49. | :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` | :ref:`structured_text_bidi_override<class_TextMesh_property_structured_text_bidi_override>` | ``0`` |
  50. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  51. | :ref:`Array<class_Array>` | :ref:`structured_text_bidi_override_options<class_TextMesh_property_structured_text_bidi_override_options>` | ``[]`` |
  52. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  53. | :ref:`String<class_String>` | :ref:`text<class_TextMesh_property_text>` | ``""`` |
  54. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  55. | :ref:`Direction<enum_TextServer_Direction>` | :ref:`text_direction<class_TextMesh_property_text_direction>` | ``0`` |
  56. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  57. | :ref:`bool<class_bool>` | :ref:`uppercase<class_TextMesh_property_uppercase>` | ``false`` |
  58. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  59. | :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` | :ref:`vertical_alignment<class_TextMesh_property_vertical_alignment>` | ``1`` |
  60. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  61. | :ref:`float<class_float>` | :ref:`width<class_TextMesh_property_width>` | ``500.0`` |
  62. +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+
  63. .. rst-class:: classref-section-separator
  64. ----
  65. .. rst-class:: classref-descriptions-group
  66. Property Descriptions
  67. ---------------------
  68. .. _class_TextMesh_property_autowrap_mode:
  69. .. rst-class:: classref-property
  70. :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **autowrap_mode** = ``0`` :ref:`🔗<class_TextMesh_property_autowrap_mode>`
  71. .. rst-class:: classref-property-setget
  72. - |void| **set_autowrap_mode**\ (\ value\: :ref:`AutowrapMode<enum_TextServer_AutowrapMode>`\ )
  73. - :ref:`AutowrapMode<enum_TextServer_AutowrapMode>` **get_autowrap_mode**\ (\ )
  74. 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.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_TextMesh_property_curve_step:
  78. .. rst-class:: classref-property
  79. :ref:`float<class_float>` **curve_step** = ``0.5`` :ref:`🔗<class_TextMesh_property_curve_step>`
  80. .. rst-class:: classref-property-setget
  81. - |void| **set_curve_step**\ (\ value\: :ref:`float<class_float>`\ )
  82. - :ref:`float<class_float>` **get_curve_step**\ (\ )
  83. Step (in pixels) used to approximate Bézier curves. Lower values result in smoother curves, but is slower to generate and render. Consider adjusting this according to the font size and the typical viewing distance.
  84. \ **Note:** Changing this property will regenerate the mesh, which is a slow operation, especially with large font sizes and long texts.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_TextMesh_property_depth:
  88. .. rst-class:: classref-property
  89. :ref:`float<class_float>` **depth** = ``0.05`` :ref:`🔗<class_TextMesh_property_depth>`
  90. .. rst-class:: classref-property-setget
  91. - |void| **set_depth**\ (\ value\: :ref:`float<class_float>`\ )
  92. - :ref:`float<class_float>` **get_depth**\ (\ )
  93. 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.
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_TextMesh_property_font:
  97. .. rst-class:: classref-property
  98. :ref:`Font<class_Font>` **font** :ref:`🔗<class_TextMesh_property_font>`
  99. .. rst-class:: classref-property-setget
  100. - |void| **set_font**\ (\ value\: :ref:`Font<class_Font>`\ )
  101. - :ref:`Font<class_Font>` **get_font**\ (\ )
  102. Font configuration used to display text.
  103. .. rst-class:: classref-item-separator
  104. ----
  105. .. _class_TextMesh_property_font_size:
  106. .. rst-class:: classref-property
  107. :ref:`int<class_int>` **font_size** = ``16`` :ref:`🔗<class_TextMesh_property_font_size>`
  108. .. rst-class:: classref-property-setget
  109. - |void| **set_font_size**\ (\ value\: :ref:`int<class_int>`\ )
  110. - :ref:`int<class_int>` **get_font_size**\ (\ )
  111. Font size of the **TextMesh**'s text. This property works in tandem with :ref:`pixel_size<class_TextMesh_property_pixel_size>`. Higher values will result in a more detailed font, regardless of :ref:`curve_step<class_TextMesh_property_curve_step>` and :ref:`pixel_size<class_TextMesh_property_pixel_size>`. Consider keeping this value below 63 (inclusive) for good performance, and adjust :ref:`pixel_size<class_TextMesh_property_pixel_size>` as needed to enlarge text.
  112. \ **Note:** Changing this property will regenerate the mesh, which is a slow operation, especially with large font sizes and long texts. To change the text's size in real-time efficiently, change the node's :ref:`Node3D.scale<class_Node3D_property_scale>` instead.
  113. .. rst-class:: classref-item-separator
  114. ----
  115. .. _class_TextMesh_property_horizontal_alignment:
  116. .. rst-class:: classref-property
  117. :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **horizontal_alignment** = ``1`` :ref:`🔗<class_TextMesh_property_horizontal_alignment>`
  118. .. rst-class:: classref-property-setget
  119. - |void| **set_horizontal_alignment**\ (\ value\: :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>`\ )
  120. - :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_horizontal_alignment**\ (\ )
  121. Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify.
  122. .. rst-class:: classref-item-separator
  123. ----
  124. .. _class_TextMesh_property_justification_flags:
  125. .. rst-class:: classref-property
  126. |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] **justification_flags** = ``163`` :ref:`🔗<class_TextMesh_property_justification_flags>`
  127. .. rst-class:: classref-property-setget
  128. - |void| **set_justification_flags**\ (\ value\: |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\]\ )
  129. - |bitfield|\[:ref:`JustificationFlag<enum_TextServer_JustificationFlag>`\] **get_justification_flags**\ (\ )
  130. Line fill alignment rules.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_TextMesh_property_language:
  134. .. rst-class:: classref-property
  135. :ref:`String<class_String>` **language** = ``""`` :ref:`🔗<class_TextMesh_property_language>`
  136. .. rst-class:: classref-property-setget
  137. - |void| **set_language**\ (\ value\: :ref:`String<class_String>`\ )
  138. - :ref:`String<class_String>` **get_language**\ (\ )
  139. Language code used for text shaping algorithms, if left empty current locale is used instead.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_TextMesh_property_line_spacing:
  143. .. rst-class:: classref-property
  144. :ref:`float<class_float>` **line_spacing** = ``0.0`` :ref:`🔗<class_TextMesh_property_line_spacing>`
  145. .. rst-class:: classref-property-setget
  146. - |void| **set_line_spacing**\ (\ value\: :ref:`float<class_float>`\ )
  147. - :ref:`float<class_float>` **get_line_spacing**\ (\ )
  148. Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_TextMesh_property_offset:
  152. .. rst-class:: classref-property
  153. :ref:`Vector2<class_Vector2>` **offset** = ``Vector2(0, 0)`` :ref:`🔗<class_TextMesh_property_offset>`
  154. .. rst-class:: classref-property-setget
  155. - |void| **set_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  156. - :ref:`Vector2<class_Vector2>` **get_offset**\ (\ )
  157. The text drawing offset (in pixels).
  158. \ **Note:** Changing this property will regenerate the mesh, which is a slow operation. To change the text's position in real-time efficiently, change the node's :ref:`Node3D.position<class_Node3D_property_position>` instead.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_TextMesh_property_pixel_size:
  162. .. rst-class:: classref-property
  163. :ref:`float<class_float>` **pixel_size** = ``0.01`` :ref:`🔗<class_TextMesh_property_pixel_size>`
  164. .. rst-class:: classref-property-setget
  165. - |void| **set_pixel_size**\ (\ value\: :ref:`float<class_float>`\ )
  166. - :ref:`float<class_float>` **get_pixel_size**\ (\ )
  167. The size of one pixel's width on the text to scale it in 3D. This property works in tandem with :ref:`font_size<class_TextMesh_property_font_size>`.
  168. \ **Note:** Changing this property will regenerate the mesh, which is a slow operation, especially with large font sizes and long texts. To change the text's size in real-time efficiently, change the node's :ref:`Node3D.scale<class_Node3D_property_scale>` instead.
  169. .. rst-class:: classref-item-separator
  170. ----
  171. .. _class_TextMesh_property_structured_text_bidi_override:
  172. .. rst-class:: classref-property
  173. :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **structured_text_bidi_override** = ``0`` :ref:`🔗<class_TextMesh_property_structured_text_bidi_override>`
  174. .. rst-class:: classref-property-setget
  175. - |void| **set_structured_text_bidi_override**\ (\ value\: :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>`\ )
  176. - :ref:`StructuredTextParser<enum_TextServer_StructuredTextParser>` **get_structured_text_bidi_override**\ (\ )
  177. Set BiDi algorithm override for the structured text.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_TextMesh_property_structured_text_bidi_override_options:
  181. .. rst-class:: classref-property
  182. :ref:`Array<class_Array>` **structured_text_bidi_override_options** = ``[]`` :ref:`🔗<class_TextMesh_property_structured_text_bidi_override_options>`
  183. .. rst-class:: classref-property-setget
  184. - |void| **set_structured_text_bidi_override_options**\ (\ value\: :ref:`Array<class_Array>`\ )
  185. - :ref:`Array<class_Array>` **get_structured_text_bidi_override_options**\ (\ )
  186. Set additional options for BiDi override.
  187. .. rst-class:: classref-item-separator
  188. ----
  189. .. _class_TextMesh_property_text:
  190. .. rst-class:: classref-property
  191. :ref:`String<class_String>` **text** = ``""`` :ref:`🔗<class_TextMesh_property_text>`
  192. .. rst-class:: classref-property-setget
  193. - |void| **set_text**\ (\ value\: :ref:`String<class_String>`\ )
  194. - :ref:`String<class_String>` **get_text**\ (\ )
  195. The text to generate mesh from.
  196. \ **Note:** Due to being a :ref:`Resource<class_Resource>`, it doesn't follow the rules of :ref:`Node.auto_translate_mode<class_Node_property_auto_translate_mode>`. If disabling translation is desired, it should be done manually with :ref:`Object.set_message_translation()<class_Object_method_set_message_translation>`.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_TextMesh_property_text_direction:
  200. .. rst-class:: classref-property
  201. :ref:`Direction<enum_TextServer_Direction>` **text_direction** = ``0`` :ref:`🔗<class_TextMesh_property_text_direction>`
  202. .. rst-class:: classref-property-setget
  203. - |void| **set_text_direction**\ (\ value\: :ref:`Direction<enum_TextServer_Direction>`\ )
  204. - :ref:`Direction<enum_TextServer_Direction>` **get_text_direction**\ (\ )
  205. Base text writing direction.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_TextMesh_property_uppercase:
  209. .. rst-class:: classref-property
  210. :ref:`bool<class_bool>` **uppercase** = ``false`` :ref:`🔗<class_TextMesh_property_uppercase>`
  211. .. rst-class:: classref-property-setget
  212. - |void| **set_uppercase**\ (\ value\: :ref:`bool<class_bool>`\ )
  213. - :ref:`bool<class_bool>` **is_uppercase**\ (\ )
  214. If ``true``, all the text displays as UPPERCASE.
  215. .. rst-class:: classref-item-separator
  216. ----
  217. .. _class_TextMesh_property_vertical_alignment:
  218. .. rst-class:: classref-property
  219. :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **vertical_alignment** = ``1`` :ref:`🔗<class_TextMesh_property_vertical_alignment>`
  220. .. rst-class:: classref-property-setget
  221. - |void| **set_vertical_alignment**\ (\ value\: :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>`\ )
  222. - :ref:`VerticalAlignment<enum_@GlobalScope_VerticalAlignment>` **get_vertical_alignment**\ (\ )
  223. Controls the text's vertical alignment. Supports top, center, and bottom.
  224. .. rst-class:: classref-item-separator
  225. ----
  226. .. _class_TextMesh_property_width:
  227. .. rst-class:: classref-property
  228. :ref:`float<class_float>` **width** = ``500.0`` :ref:`🔗<class_TextMesh_property_width>`
  229. .. rst-class:: classref-property-setget
  230. - |void| **set_width**\ (\ value\: :ref:`float<class_float>`\ )
  231. - :ref:`float<class_float>` **get_width**\ (\ )
  232. Text width (in pixels), used for fill alignment.
  233. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  234. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  235. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  236. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  237. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  238. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  239. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  240. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  241. .. |void| replace:: :abbr:`void (No return value.)`