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

Hérite de : PrimitiveMesh < Mesh < Resource < RefCounted < Object

Génère un PrimitiveMesh à partir du texte.

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.

Tutoriels

Propriétés

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


Descriptions des propriétés

AutowrapMode autowrap_mode = 0 🔗

Si défini à quelque chose d'autre que TextServer.AUTOWRAP_OFF, le texte retourne automatiquement à la ligne dans le rectangle délimitant du nœud. Si vous redimensionnez le nœud, il va changer sa hauteur automatiquement pour afficher tout le texte.


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 🔗

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()

Configuration de la police utilisée pour afficher le texte.


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 🔗

Contrôle l'alignement horizontal du texte. Supporte à gauche, au centre, à droite, ou remplir (aussi connu comme justifié).


BitField[JustificationFlag] justification_flags = 163 🔗

Règles d'alignement du remplissage des lignes.


String language = "" 🔗

Code de langue utilisé pour les algorithmes de retour à la ligne et de "text shaping". Si laissé vide, la langue actuelle est utilisée à la place.


float line_spacing = 0.0 🔗

  • void set_line_spacing(value: float)

  • float get_line_spacing()

Espacement vertical supplémentaire entre les lignes (en pixels), l'espacement est ajouté à la descente de la ligne. Cette valeur peut être négative.


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 🔗

Définit la redéfinition de l'algorithme BiDi pour le texte structuré.


Array structured_text_bidi_override_options = [] 🔗

  • void set_structured_text_bidi_override_options(value: Array)

  • Array get_structured_text_bidi_override_options()

Définit des options supplémentaires pour la redéfinition BiDi.


String text = "" 🔗

Le texte duquel générer du maillage.

Note : En raison d'être une Resource, il ne suit pas les règles de Node.auto_translate_mode. Si désactiver la traduction est souhaité, cela doit être fait manuellement avec Object.set_message_translation().


Direction text_direction = 0 🔗

Direction d'écriture du texte de base.


bool uppercase = false 🔗

  • void set_uppercase(value: bool)

  • bool is_uppercase()

Si true, tous les textes seront en MAJUSCULE.


VerticalAlignment vertical_alignment = 1 🔗

Contrôle l'alignement vertical du texte. Supporte en haut, au centre, et en bas.


float width = 500.0 🔗

Largeur du texte (en pixels), utilisée pour l'alignement du remplissage.