text2d
A block of text drawn in the 2D pass, pixels_per_unit font pixels per world unit.
本頁內容
2d · render · 50 properties · 2D
A block of text drawn in the 2D pass, pixels_per_unit font pixels per world unit.
In a scene, text2d is the node key that applies it. A script reaches each property below as a field on node.text2d: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.text2d.get() and node.text2d.set(table).
Properties
| property | type | default | description |
|---|---|---|---|
alpha_cutoff |
float | 0 |
Drop a pixel fainter than this and draw the rest opaque, as a material's [surface] alpha_cutoff does; zero blends every pixel Range 0–1. |
bitmap_font |
string | — | A project-relative AngelCode .fnt naming a bitmap face; empty shapes with the project's vector fonts |
blend_mode |
enum | auto |
How the surface lands on what is under it: straight alpha, a colour that already carries its alpha, added light, multiplied shade, screen, or opaque. auto is premultiplied for a texture uploaded with premultiply, else alpha One of auto, alpha, premultiplied, add, multiply, screen, opaque. |
color |
color | [1,1,1,1] |
Tint, as channel floats or #rrggbb / #rrggbbaa |
cull_back_faces |
bool | false |
Skip a triangle whose back faces the viewer, as a negative scale turns one |
dot_color |
color | [1,1,1,1] |
The dots' colour. Not drawn with alpha_cutoff above zero or a material, whose layers draw through Balaur's own pipeline |
dot_size |
float | 0 |
Size of a dot drawn on every vertex; zero draws none. Not drawn with alpha_cutoff above zero or a material, whose layers draw through Balaur's own pipeline At least 0. |
dot_sizing |
enum | world |
What dot_size counts: world is world units, which the camera's zoom scales, screen is pixels One of world, screen. |
draw_surface |
bool | true |
Whether the surface draws; off leaves the wireframe and the dots alone |
font_family |
enum | ui |
Which of the project's font chains to shape with One of ui, heading, mono, icon. |
font_features |
list | [] |
OpenType features: a tag turns one on (smcp), tag=0 turns one off (liga=0), tag=n picks an alternate |
font_name |
string | — | A face by family name, tried before the chain. A project face measures; a face only the system has draws but is measured as the chain |
font_size |
float | 32 |
Height in font pixels, before pixels_per_unit sizes it in the world At least 1. |
font_stretch |
enum | normal |
How wide a face is picked among the faces its family ships; nothing is stretched that no face draws One of ultra_condensed, extra_condensed, condensed, semi_condensed, normal, semi_expanded, expanded, extra_expanded, ultra_expanded. |
font_style |
enum | normal |
Upright, the family's italic face, or the upright face slanted; a family with no italic is slanted either way One of normal, italic, oblique. |
font_weight |
int | 400 |
Stroke weight, 400 regular and 700 bold Range 100–900. |
hinting |
enum | auto |
Snap outlines to the pixel grid; auto takes the face's import setting One of auto, on, off. |
letter_spacing |
float | 0 |
Extra space between glyphs, in font pixels |
line_break |
enum | word_or_glyph |
Where a wrapped line may break: between words with a too-long word cut anywhere, between words only, or anywhere One of word_or_glyph, word, glyph. |
line_height |
float | 0 |
Baseline to baseline as a multiple of the size; zero takes the default At least 0. |
markup |
bool | false |
Read the text as markup: bold, italic, colour, alignment, wave and inline images |
material |
asset · material |
— | The material every layer draws with, reading the glyph atlas as its texture; empty takes an inherited material component, else the built-in one. On text2d a material replaces alpha_cutoff |
max_height |
float | 0 |
Font pixels the lines stop at; zero has no limit At least 0. |
max_lines |
int | 0 |
The most lines a block keeps; zero keeps every line At least 0. |
max_width |
float | 0 |
Font pixels the lines wrap at; zero runs the text on one line At least 0. |
monospace_width |
float | 0 |
Font pixels a monospace face's advance is set to; zero keeps its own At least 0. |
outline_color |
color | [0,0,0,1] |
The outline's colour |
outline_size |
float | 0 |
Font pixels the outline reaches around the glyphs; zero draws none At least 0. |
overline |
bool | false |
A line over the glyphs |
overline_color |
color | [0,0,0,0] |
The overline's colour; alpha 0 takes the glyphs' own |
pixel_snap |
bool | false |
Rasterise on whole pixels with no subpixel offset, for a pixel face |
pixels_per_unit |
float | 100 |
Font pixels to one world unit, sizing the block the way a sprite is sized At least 0.01. |
shadow_color |
color | [0,0,0,0.5] |
The shadow's colour |
shadow_offset_x |
float | 0 |
Font pixels the shadow is moved along x; zero with y draws none |
shadow_offset_y |
float | 0 |
Font pixels the shadow is moved along y |
shaping |
enum | complex |
Complex shaping joins scripts that need it and falls back to another face; simple does neither and is faster One of complex, simple. |
snap_advances |
bool | false |
Round each glyph's advance to a whole pixel; the layout then depends on the size it is drawn at |
strikethrough |
bool | false |
A line through the glyphs |
strikethrough_color |
color | [0,0,0,0] |
The strikethrough's colour; alpha 0 takes the glyphs' own |
tab_width |
int | 8 |
Spaces between tab stops Range 1–64. |
text |
string | — | The text drawn; text_key wins over it |
text_align |
enum | center |
Where the block sits across the node's origin, and its lines within it: start and end follow the text's direction, left and right do not, justify stretches every full line One of start, center, end, left, right, justify. |
text_key |
string | — | A key in the project's strings, re-read every frame so a language change shows at once |
truncate |
bool | false |
End a block cut short with an ellipsis; needs max_width, and cuts at max_lines or max_height when either is set, else at one line |
truncate_at |
enum | end |
Which part of a cut line the ellipsis stands in for One of end, start, middle. |
underline |
enum | none |
A line under the glyphs, once or twice One of none, single, double. |
underline_color |
color | [0,0,0,0] |
The underline's colour; alpha 0 takes the glyphs' own |
wireframe_color |
color | [1,1,1,1] |
The wireframe's colour. Not drawn with alpha_cutoff above zero or a material, whose layers draw through Balaur's own pipeline |
wireframe_sizing |
enum | world |
What wireframe_width counts: world is world units, which the camera's zoom scales, screen is pixels One of world, screen. |
wireframe_width |
float | 0 |
Width of a line drawn along every triangle edge, not the outline; zero draws none. Not drawn with alpha_cutoff above zero or a material, whose layers draw through Balaur's own pipeline At least 0. |
Asset types this component references: material.