Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

TextMesh

Eredita: PrimitiveMesh < Mesh < Resource < RefCounted < Object

Genera un PrimitiveMesh dal testo.

Descrizione

Genera un PrimitiveMesh dal testo.

È possibile generare un TextMesh solo quando si utilizzano font dinamici con contorni di glifi vettoriali. I caratteri bitmap (compresi i dati bitmap nei contenitori TrueType/OpenType, come i caratteri emoji a colori) non sono supportati.

Il layout UV è disposto in 4 fasce orizzontali, dall'alto verso il basso: 40% dell'altezza per la faccia anteriore, 40% per la faccia posteriore, 10% per i bordi esterni e 10% per i bordi interni.

Tutorial

Proprietà

AutowrapMode

autowrap_mode

0

float

curve_step

0.5

float

depth

0.05

Font

font

int

font_size

16

HorizontalAlignment

horizontal_alignment

1

BitField[JustificationFlag]

justification_flags

163

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


Descrizioni delle proprietà

AutowrapMode autowrap_mode = 0 🔗

Se impostato su un valore diverso da TextServer.AUTOWRAP_OFF, il testo è avvolto all'interno del rettangolo di delimitazione del nodo. Se ridimensioni il nodo, cambierà automaticamente la sua altezza per mostrare tutto il testo.


float curve_step = 0.5 🔗

  • void set_curve_step(value: float)

  • float get_curve_step()

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.

Note: Changing this property will regenerate the mesh, which is a slow operation, especially with large font sizes and long texts.


float depth = 0.05 🔗

La profondità della mesh, se impostata su 0.0, è generata solo sulla superficie anteriore e il layout UV è modificato per utilizzare la texture completa solo per la faccia anteriore.


Font font 🔗

  • void set_font(value: Font)

  • Font get_font()

Configurazione del font utilizzata per visualizzare il testo.


int font_size = 16 🔗

  • void set_font_size(value: int)

  • int get_font_size()

Font size of the TextMesh's text. This property works in tandem with pixel_size. Higher values will result in a more detailed font, regardless of curve_step and pixel_size. Consider keeping this value below 63 (inclusive) for good performance, and adjust pixel_size as needed to enlarge text.

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 Node3D.scale instead.


HorizontalAlignment horizontal_alignment = 1 🔗

Controlla l'allineamento orizzontale del testo. Supporta sinistra, centro, destra, e riempi (noto anche come giustifica).


BitField[JustificationFlag] justification_flags = 163 🔗

Regole di allineamento del riempimento per le righe.


String language = "" 🔗

Language code used for line-breaking and text shaping algorithms. If left empty, the current locale is used instead.


float line_spacing = 0.0 🔗

  • void set_line_spacing(value: float)

  • float get_line_spacing()

Spaziatura verticale aggiuntiva tra le righe (in pixel), la spaziatura è aggiunta alla discesa della riga. Questo valore può essere negativo.


Vector2 offset = Vector2(0, 0) 🔗

The text drawing offset (in pixels).

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 Node3D.position instead.


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. This property works in tandem with font_size.

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 Node3D.scale instead.


StructuredTextParser structured_text_bidi_override = 0 🔗

Imposta la sostituzione dell'algoritmo BiDi per il testo strutturato.


Array structured_text_bidi_override_options = [] 🔗

  • void set_structured_text_bidi_override_options(value: Array)

  • Array get_structured_text_bidi_override_options()

Imposta opzioni aggiuntive per la sostituzione BiDi.


String text = "" 🔗

Il testo da cui generare la mesh.

Nota: Essendo una Resource, non segue le regole di Node.auto_translate_mode. Se si desidera disabilitare la traduzione, è necessario farlo manualmente con Object.set_message_translation().


Direction text_direction = 0 🔗

Direzione di scrittura del testo di base.


bool uppercase = false 🔗

  • void set_uppercase(value: bool)

  • bool is_uppercase()

Se true, tutto il testo è visualizzato in MAIUSCOLO.


VerticalAlignment vertical_alignment = 1 🔗

Controlla l'allineamento verticale del testo. Supporta sopra, centro, sotto.


float width = 500.0 🔗

La larghezza del testo (in pixel), usata per l'allineamento di riempimento.