TextMesh

Наследует: PrimitiveMesh < Mesh < Resource < RefCounted < Object

Создает PrimitiveMesh из текста.

Описание

Сгенерируйте PrimitiveMesh из текста.

TextMesh можно сгенерировать только при использовании динамических шрифтов с векторными контурами глифов. Растровые шрифты (включая растровые данные в контейнерах TrueType/OpenType, например, цветные шрифты эмодзи) не поддерживаются.

UV-развёртка состоит из четырёх горизонтальных полос, расположенных сверху вниз: 40% высоты для лицевой стороны, 40% для обратной стороны, 10% для внешних и 10% для внутренних сторон.

Обучающие материалы

Свойства

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


Описания свойств

AutowrapMode autowrap_mode = 0 🔗

Если установлено значение, отличное от TextServer.AUTOWRAP_OFF, текст будет заключен в ограничивающий прямоугольник узла. Если изменить размер узла, он автоматически изменит свою высоту, чтобы показать весь текст.


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 🔗

Если задано значение 0.0 для сетки только для передней поверхности, генерируется глубина, а UV-разметка изменяется для использования полной текстуры только для передней поверхности.


Font font 🔗

  • void set_font(value: Font)

  • Font get_font()

Конфигурация шрифта, используемая для отображения текста.


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 🔗

Управляет горизонтальным выравниванием текста. Поддерживает выравнивание по левому краю, по центру, по правому краю и заполнение (также известное как выравнивание по ширине).


BitField[JustificationFlag] justification_flags = 163 🔗

Правила выравнивания заливки линий.


String language = "" 🔗

Код языка, используемый алгоритмами переноса строк и форматирования текста. Если оставить поле пустым, будет использоваться текущая локаль.


float line_spacing = 0.0 🔗

  • void set_line_spacing(value: float)

  • float get_line_spacing()

Дополнительный вертикальный интервал между строками (в пикселях), интервал добавляется к спуску строки. Это значение может быть отрицательным.


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 🔗

Установите переопределение алгоритма BiDi для структурированного текста.


Array structured_text_bidi_override_options = [] 🔗

  • void set_structured_text_bidi_override_options(value: Array)

  • Array get_structured_text_bidi_override_options()

Установите дополнительные параметры для переопределения BiDi.


String text = "" 🔗

Текст для генерации сетки.

Примечание: Поскольку он является Resource, он не следует правилам Node.auto_translate_mode. Если требуется отключить перевод, это следует сделать вручную с помощью Object.set_message_translation().


Direction text_direction = 0 🔗

Направление написания базового текста.


bool uppercase = false 🔗

  • void set_uppercase(value: bool)

  • bool is_uppercase()

Если true, весь текст отображается в ЗАГЛАВНОМ регистре.


VerticalAlignment vertical_alignment = 1 🔗

Управляет вертикальным выравниванием текста. Поддерживает верх, центр и низ.


float width = 500.0 🔗

Ширина текста (в пикселях), используемая для выравнивания заливки.