Skip to main content

TextMesh

Inherits: PrimitiveMesh < Mesh < Resource < RefCounted < Object

Generate a PrimitiveMesh from the text.

Description​

Generate a 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.

Tutorials​

Properties​

AutowrapModeautowrap_mode0
floatcurve_step0.5
floatdepth0.05
Fontfont
intfont_size16
HorizontalAlignmenthorizontal_alignment1
BitField[JustificationFlag]justification_flags163
Stringlanguage""
floatline_spacing0.0
Vector2offsetVector2(0, 0)
floatpixel_size0.01
StructuredTextParserstructured_text_bidi_override0
Arraystructured_text_bidi_override_options[]
Stringtext""
Directiontext_direction0
booluppercasefalse
VerticalAlignmentvertical_alignment1
floatwidth500.0

Property Descriptions​

AutowrapMode autowrap_mode = 0 πŸ”—

If set to something other than 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.


float curve_step = 0.5 πŸ”—

  • void set_curve_step\ (\ value: float\ )
  • float get_curve_step\ (\ )

Step (in pixels) used to approximate BΓ©zier curves.


float depth = 0.05 πŸ”—

  • void set_depth\ (\ value: float\ )
  • 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.


Font font πŸ”—

  • void set_font\ (\ value: Font\ )
  • Font get_font\ (\ )

Font configuration used to display text.


int font_size = 16 πŸ”—

  • void set_font_size\ (\ value: int\ )
  • int get_font_size\ (\ )

Font size of the TextMesh's text.


HorizontalAlignment horizontal_alignment = 1 πŸ”—

Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify.


BitField[JustificationFlag] justification_flags = 163 πŸ”—

Line fill alignment rules.


String language = "" πŸ”—

  • void set_language\ (\ value: String\ )
  • String get_language\ (\ )

Language code used for text shaping algorithms, if left empty current locale is used instead.


float line_spacing = 0.0 πŸ”—

  • void set_line_spacing\ (\ value: float\ )
  • float get_line_spacing\ (\ )

Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.


Vector2 offset = Vector2(0, 0) πŸ”—

The text drawing offset (in pixels).


float pixel_size = 0.01 πŸ”—

  • void set_pixel_size\ (\ value: float\ )
  • float get_pixel_size\ (\ )

The size of one pixel's width on the text to scale it in 3D.


StructuredTextParser structured_text_bidi_override = 0 πŸ”—

Set BiDi algorithm override for the structured text.


Array structured_text_bidi_override_options = [] πŸ”—

  • void set_structured_text_bidi_override_options\ (\ value: Array\ )
  • Array get_structured_text_bidi_override_options\ (\ )

Set additional options for BiDi override.


String text = "" πŸ”—

The text to generate mesh from.

\ Note: Due to being a Resource, it doesn't follow the rules of Node.auto_translate_mode. If disabling translation is desired, it should be done manually with Object.set_message_translation().


Direction text_direction = 0 πŸ”—

Base text writing direction.


bool uppercase = false πŸ”—

  • void set_uppercase\ (\ value: bool\ )
  • bool is_uppercase\ (\ )

If true, all the text displays as UPPERCASE.


VerticalAlignment vertical_alignment = 1 πŸ”—

Controls the text's vertical alignment. Supports top, center, and bottom.


float width = 500.0 πŸ”—

  • void set_width\ (\ value: float\ )
  • float get_width\ (\ )

Text width (in pixels), used for fill alignment.