:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/TextMesh.xml. .. _class_TextMesh: TextMesh ======== **Inherits:** :ref:`PrimitiveMesh` **<** :ref:`Mesh` **<** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` Generate a :ref:`PrimitiveMesh` from the text. .. rst-class:: classref-introduction-group Description ----------- Generate a :ref:`PrimitiveMesh` from the text. 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. 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. .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`3D text <../tutorials/3d/3d_text>` .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`AutowrapMode` | :ref:`autowrap_mode` | ``0`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`float` | :ref:`curve_step` | ``0.5`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`float` | :ref:`depth` | ``0.05`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`Font` | :ref:`font` | | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`int` | :ref:`font_size` | ``16`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`HorizontalAlignment` | :ref:`horizontal_alignment` | ``1`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | |bitfield|\[:ref:`JustificationFlag`\] | :ref:`justification_flags` | ``163`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`String` | :ref:`language` | ``""`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`float` | :ref:`line_spacing` | ``0.0`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`Vector2` | :ref:`offset` | ``Vector2(0, 0)`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`float` | :ref:`pixel_size` | ``0.01`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`StructuredTextParser` | :ref:`structured_text_bidi_override` | ``0`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`Array` | :ref:`structured_text_bidi_override_options` | ``[]`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`String` | :ref:`text` | ``""`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`Direction` | :ref:`text_direction` | ``0`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`bool` | :ref:`uppercase` | ``false`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`VerticalAlignment` | :ref:`vertical_alignment` | ``1`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ | :ref:`float` | :ref:`width` | ``500.0`` | +---------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------+-------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_TextMesh_property_autowrap_mode: .. rst-class:: classref-property :ref:`AutowrapMode` **autowrap_mode** = ``0`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_autowrap_mode**\ (\ value\: :ref:`AutowrapMode`\ ) - :ref:`AutowrapMode` **get_autowrap_mode**\ (\ ) If set to something other than :ref:`TextServer.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. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_curve_step: .. rst-class:: classref-property :ref:`float` **curve_step** = ``0.5`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_curve_step**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_curve_step**\ (\ ) Step (in pixels) used to approximate BΓ©zier curves. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_depth: .. rst-class:: classref-property :ref:`float` **depth** = ``0.05`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_depth**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_depth**\ (\ ) 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. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_font: .. rst-class:: classref-property :ref:`Font` **font** :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_font**\ (\ value\: :ref:`Font`\ ) - :ref:`Font` **get_font**\ (\ ) Font configuration used to display text. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_font_size: .. rst-class:: classref-property :ref:`int` **font_size** = ``16`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_font_size**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_font_size**\ (\ ) Font size of the **TextMesh**'s text. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_horizontal_alignment: .. rst-class:: classref-property :ref:`HorizontalAlignment` **horizontal_alignment** = ``1`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_horizontal_alignment**\ (\ value\: :ref:`HorizontalAlignment`\ ) - :ref:`HorizontalAlignment` **get_horizontal_alignment**\ (\ ) Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_justification_flags: .. rst-class:: classref-property |bitfield|\[:ref:`JustificationFlag`\] **justification_flags** = ``163`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_justification_flags**\ (\ value\: |bitfield|\[:ref:`JustificationFlag`\]\ ) - |bitfield|\[:ref:`JustificationFlag`\] **get_justification_flags**\ (\ ) Line fill alignment rules. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_language: .. rst-class:: classref-property :ref:`String` **language** = ``""`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_language**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_language**\ (\ ) Language code used for text shaping algorithms, if left empty current locale is used instead. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_line_spacing: .. rst-class:: classref-property :ref:`float` **line_spacing** = ``0.0`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_line_spacing**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_line_spacing**\ (\ ) Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_offset: .. rst-class:: classref-property :ref:`Vector2` **offset** = ``Vector2(0, 0)`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_offset**\ (\ value\: :ref:`Vector2`\ ) - :ref:`Vector2` **get_offset**\ (\ ) The text drawing offset (in pixels). .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_pixel_size: .. rst-class:: classref-property :ref:`float` **pixel_size** = ``0.01`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_pixel_size**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_pixel_size**\ (\ ) The size of one pixel's width on the text to scale it in 3D. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_structured_text_bidi_override: .. rst-class:: classref-property :ref:`StructuredTextParser` **structured_text_bidi_override** = ``0`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_structured_text_bidi_override**\ (\ value\: :ref:`StructuredTextParser`\ ) - :ref:`StructuredTextParser` **get_structured_text_bidi_override**\ (\ ) Set BiDi algorithm override for the structured text. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_structured_text_bidi_override_options: .. rst-class:: classref-property :ref:`Array` **structured_text_bidi_override_options** = ``[]`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_structured_text_bidi_override_options**\ (\ value\: :ref:`Array`\ ) - :ref:`Array` **get_structured_text_bidi_override_options**\ (\ ) Set additional options for BiDi override. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_text: .. rst-class:: classref-property :ref:`String` **text** = ``""`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_text**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_text**\ (\ ) The text to generate mesh from. \ **Note:** Due to being a :ref:`Resource`, it doesn't follow the rules of :ref:`Node.auto_translate_mode`. If disabling translation is desired, it should be done manually with :ref:`Object.set_message_translation()`. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_text_direction: .. rst-class:: classref-property :ref:`Direction` **text_direction** = ``0`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_text_direction**\ (\ value\: :ref:`Direction`\ ) - :ref:`Direction` **get_text_direction**\ (\ ) Base text writing direction. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_uppercase: .. rst-class:: classref-property :ref:`bool` **uppercase** = ``false`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_uppercase**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_uppercase**\ (\ ) If ``true``, all the text displays as UPPERCASE. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_vertical_alignment: .. rst-class:: classref-property :ref:`VerticalAlignment` **vertical_alignment** = ``1`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_vertical_alignment**\ (\ value\: :ref:`VerticalAlignment`\ ) - :ref:`VerticalAlignment` **get_vertical_alignment**\ (\ ) Controls the text's vertical alignment. Supports top, center, and bottom. .. rst-class:: classref-item-separator ---- .. _class_TextMesh_property_width: .. rst-class:: classref-property :ref:`float` **width** = ``500.0`` :ref:`πŸ”—` .. rst-class:: classref-property-setget - |void| **set_width**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_width**\ (\ ) Text width (in pixels), used for fill alignment. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`