Table of Contents

Class TextMesh

Generate an PrimitiveMesh from the text.

Inheritance
TextMesh

Remarks

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.

See Also

Properties

autowrap_mode

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.

var autowrap_mode : int = 0

Property Value

int

Remarks

  • void set_autowrap_mode(int value)
  • int get_autowrap_mode

curve_step

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

var curve_step : float = 0.5

Property Value

float

Remarks

  • void set_curve_step(float value)
  • float get_curve_step

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.

var depth : float = 0.05

Property Value

float

Remarks

font

Font configuration used to display text.

var font : Font

Property Value

Font

Remarks

  • void set_font(Font value)
  • Font get_font

font_size

Font size of the TextMesh's text.

var font_size : int = 16

Property Value

int

Remarks

  • void set_font_size(int value)
  • int get_font_size

horizontal_alignment

Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify. Set it to one of the HorizontalAlignment constants.

var horizontal_alignment : int = 1

Property Value

int

Remarks

  • void set_horizontal_alignment(int value)
  • int get_horizontal_alignment

justification_flags

Line fill alignment rules. See JustificationFlag for more information.

var justification_flags : int = 163

Property Value

int

Remarks

  • void set_justification_flags(int value)
  • int get_justification_flags

language

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

var language : String = ""

Property Value

String

Remarks

line_spacing

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

var line_spacing : float = 0.0

Property Value

float

Remarks

  • void set_line_spacing(float value)
  • float get_line_spacing

offset

The text drawing offset (in pixels).

var offset : Vector2 = Vector2(0, 0)

Property Value

Vector2

Remarks

pixel_size

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

var pixel_size : float = 0.01

Property Value

float

Remarks

  • void set_pixel_size(float value)
  • float get_pixel_size

structured_text_bidi_override

Set BiDi algorithm override for the structured text.

var structured_text_bidi_override : int = 0

Property Value

int

Remarks

  • void set_structured_text_bidi_override(int value)
  • int get_structured_text_bidi_override

structured_text_bidi_override_options

Set additional options for BiDi override.

var structured_text_bidi_override_options : Array = []

Property Value

Array

Remarks

  • void set_structured_text_bidi_override_options(Array value)
  • Array get_structured_text_bidi_override_options

text

The text to generate mesh from.

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

var text : String = ""

Property Value

String

Remarks

text_direction

Base text writing direction.

var text_direction : int = 0

Property Value

int

Remarks

  • void set_text_direction(int value)
  • int get_text_direction

uppercase

If true, all the text displays as UPPERCASE.

var uppercase : bool = false

Property Value

bool

Remarks

  • void set_uppercase(bool value)
  • bool is_uppercase

vertical_alignment

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

var vertical_alignment : int = 1

Property Value

int

Remarks

  • void set_vertical_alignment(int value)
  • int get_vertical_alignment

width

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

var width : float = 500.0

Property Value

float

Remarks