Up to date

This page is up to date for Godot 4.0. If you still find outdated information, please open an issue.

TextMesh

Inherits: PrimitiveMesh < Mesh < Resource < RefCounted < Object

Generate an PrimitiveMesh from the text.

Description

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

Properties

AutowrapMode

autowrap_mode

0

float

curve_step

0.5

float

depth

0.05

Font

font

int

font_size

16

HorizontalAlignment

horizontal_alignment

1

String

language

“”

float

line_spacing

0.0

Vector2

offset

Vector2(0, 0)

float

pixel_size

0.01

StructuredTextParser

structured_text_bidi_override

0

Array

structured_text_bidi_override_options

[]

String

text

“”

Direction

text_direction

0

bool

uppercase

false

VerticalAlignment

vertical_alignment

1

float

width

500.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. To see how each mode behaves, see AutowrapMode.


float curve_step = 0.5

  • void set_curve_step ( float value )

  • float get_curve_step ( )

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


float depth = 0.05

  • void set_depth ( float value )

  • 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 ( Font value )

  • Font get_font ( )

Font configuration used to display text.


int font_size = 16

  • void set_font_size ( int value )

  • 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. Set it to one of the HorizontalAlignment constants.


String language = ""

  • void set_language ( String value )

  • 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 ( float value )

  • float get_line_spacing ( )

Vertical space between lines in multiline TextMesh.


Vector2 offset = Vector2(0, 0)

The text drawing offset (in pixels).


float pixel_size = 0.01

  • void set_pixel_size ( float value )

  • 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 ( Array value )

  • Array get_structured_text_bidi_override_options ( )

Set additional options for BiDi override.


String text = ""

The text to generate mesh from.


Direction text_direction = 0

Base text writing direction.


bool uppercase = false

  • void set_uppercase ( bool value )

  • bool is_uppercase ( )

If true, all the text displays as UPPERCASE.


VerticalAlignment vertical_alignment = 1

Controls the text’s vertical alignment. Supports top, center, bottom. Set it to one of the VerticalAlignment constants.


float width = 500.0

  • void set_width ( float value )

  • float get_width ( )

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