TextMesh

繼承: PrimitiveMesh < Mesh < Resource < RefCounted < Object

Generate a PrimitiveMesh from the text.

說明

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.

教學

屬性

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 🔗

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.


float curve_step = 0.5 🔗

  • void set_curve_step(value: float)

  • float get_curve_step()

用於近似貝茲曲線的步長(單位為圖元)。


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

TextMesh 文字的字形大小。


HorizontalAlignment horizontal_alignment = 1 🔗

Controls the text's horizontal alignment. Supports left, center, right, and fill, or justify.


BitField[JustificationFlag] justification_flags = 163 🔗

Line fill alignment rules.


String language = "" 🔗

語言程式碼,用於文字塑形演算法,如果留空則使用目前區域設定。


float line_spacing = 0.0 🔗

  • void set_line_spacing(value: float)

  • float get_line_spacing()

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


Vector2 offset = Vector2(0, 0) 🔗

文字繪製偏移(單位為圖元)。


float pixel_size = 0.01 🔗

  • void set_pixel_size(value: float)

  • float get_pixel_size()

文字上一個圖元寬度的大小,以 3D 縮放。


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 = "" 🔗

The text to generate mesh from.

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


Direction text_direction = 0 🔗

基礎文字書寫方向。


bool uppercase = false 🔗

  • void set_uppercase(value: bool)

  • bool is_uppercase()

如果為 true,所有文字都將顯示為大寫。


VerticalAlignment vertical_alignment = 1 🔗

Controls the text's vertical alignment. Supports top, center, and bottom.


float width = 500.0 🔗

文字寬度(單位為圖元),用於填充對齊。