LabelSettings
Inherits: Resource < RefCounted < Object
Description
Section titled “Description”Provides common settings to customize the text in a Label.
LabelSettings is a resource that provides common settings to customize the text in a Label. It will take priority over the properties defined in Control.theme. The resource can be shared between multiple labels and changed on the fly, making it a convenient and flexible way to set up text style.
Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| Font | font |
|
| Color | font_color |
Color(1, 1, 1, 1) |
| int | font_size |
16 |
| float | line_spacing |
3.0 |
| Color | outline_color |
Color(1, 1, 1, 1) |
| int | outline_size |
0 |
| float | paragraph_spacing |
0.0 |
| Color | shadow_color |
Color(0, 0, 0, 0) |
| Vector2 | shadow_offset |
Vector2(1, 1) |
| int | shadow_size |
1 |
| int | stacked_outline_count |
0 |
| Color | stacked_outline_{index}/color |
Color(0, 0, 0, 1) |
| int | stacked_outline_{index}/size |
0 |
| int | stacked_shadow_count |
0 |
| Color | stacked_shadow_{index}/color |
Color(0, 0, 0, 1) |
| Vector2 | stacked_shadow_{index}/offset |
Vector2(1, 1) |
| int | stacked_shadow_{index}/outline_size |
0 |
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| void | add_stacked_outline(index: int = -1) |
| void | add_stacked_shadow(index: int = -1) |
| Color | get_stacked_outline_color(index: int) const |
| int | get_stacked_outline_size(index: int) const |
| Color | get_stacked_shadow_color(index: int) const |
| Vector2 | get_stacked_shadow_offset(index: int) const |
| int | get_stacked_shadow_outline_size(index: int) const |
| void | move_stacked_outline(from_index: int, to_position: int) |
| void | move_stacked_shadow(from_index: int, to_position: int) |
| void | remove_stacked_outline(index: int) |
| void | remove_stacked_shadow(index: int) |
| void | set_stacked_outline_color(index: int, color: Color) |
| void | set_stacked_outline_size(index: int, size: int) |
| void | set_stacked_shadow_color(index: int, color: Color) |
| void | set_stacked_shadow_offset(index: int, offset: Vector2) |
| void | set_stacked_shadow_outline_size(index: int, size: int) |
Property descriptions
Section titled “Property descriptions”font
Font font
Font used for the text.
font_color
Color font_color = Color(1, 1, 1, 1)
Color of the text.
font_size
int font_size = 16
Size of the text.
line_spacing
float line_spacing = 3.0
Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.
outline_color
Color outline_color = Color(1, 1, 1, 1)
The color of the outline.
outline_size
int outline_size = 0
Text outline size.
paragraph_spacing
float paragraph_spacing = 0.0
Vertical space between paragraphs. Added on top of line_spacing.
shadow_color
Color shadow_color = Color(0, 0, 0, 0)
Color of the shadow effect. If alpha is 0, no shadow will be drawn.
shadow_offset
Vector2 shadow_offset = Vector2(1, 1)
Offset of the shadow effect, in pixels.
shadow_size
int shadow_size = 1
Size of the shadow effect.
stacked_outline_count
int stacked_outline_count = 0
The number of stacked outlines.
stacked_outline_{index}/color
Color stacked_outline_{index}/color = Color(0, 0, 0, 1)
The color of the outline at index.
Note: index is a value in the 0 .. stacked_outline_count - 1 range.
stacked_outline_{index}/size
int stacked_outline_{index}/size = 0
The size of the outline at index.
Note: index is a value in the 0 .. stacked_outline_count - 1 range.
stacked_shadow_count
int stacked_shadow_count = 0
The number of stacked shadows.
stacked_shadow_{index}/color
Color stacked_shadow_{index}/color = Color(0, 0, 0, 1)
The color of the shadow at index.
Note: index is a value in the 0 .. stacked_shadow_count - 1 range.
stacked_shadow_{index}/offset
Vector2 stacked_shadow_{index}/offset = Vector2(1, 1)
The offset of the shadow at index.
Note: index is a value in the 0 .. stacked_shadow_count - 1 range.
stacked_shadow_{index}/outline_size
int stacked_shadow_{index}/outline_size = 0
The size of the shadow outline at index.
Note: index is a value in the 0 .. stacked_shadow_count - 1 range.
Method descriptions
Section titled “Method descriptions”add_stacked_outline
void add_stacked_outline(index: int = -1)
Adds a new stacked outline to the label at the given index. If index is -1, the new stacked outline will be added at the end of the list.
add_stacked_shadow
void add_stacked_shadow(index: int = -1)
Adds a new stacked shadow to the label at the given index. If index is -1, the new stacked shadow will be added at the end of the list.
get_stacked_outline_color
Color get_stacked_outline_color(index: int) const
Returns the color of the stacked outline at index.
get_stacked_outline_size
int get_stacked_outline_size(index: int) const
Returns the size of the stacked outline at index.
get_stacked_shadow_color
Color get_stacked_shadow_color(index: int) const
Returns the color of the stacked shadow at index.
get_stacked_shadow_offset
Vector2 get_stacked_shadow_offset(index: int) const
Returns the offset of the stacked shadow at index.
get_stacked_shadow_outline_size
int get_stacked_shadow_outline_size(index: int) const
Returns the outline size of the stacked shadow at index.
move_stacked_outline
void move_stacked_outline(from_index: int, to_position: int)
Moves the stacked outline at index from_index to the given position to_position in the array.
move_stacked_shadow
void move_stacked_shadow(from_index: int, to_position: int)
Moves the stacked shadow at index from_index to the given position to_position in the array.
remove_stacked_outline
void remove_stacked_outline(index: int)
Removes the stacked outline at index index.
remove_stacked_shadow
void remove_stacked_shadow(index: int)
Removes the stacked shadow at index index.
set_stacked_outline_color
void set_stacked_outline_color(index: int, color: Color)
Sets the color of the stacked outline identified by the given index to color.
set_stacked_outline_size
void set_stacked_outline_size(index: int, size: int)
Sets the size of the stacked outline identified by the given index to size.
set_stacked_shadow_color
void set_stacked_shadow_color(index: int, color: Color)
Sets the color of the stacked shadow identified by the given index to color.
set_stacked_shadow_offset
void set_stacked_shadow_offset(index: int, offset: Vector2)
Sets the offset of the stacked shadow identified by the given index to offset.
set_stacked_shadow_outline_size
void set_stacked_shadow_outline_size(index: int, size: int)
Sets the outline size of the stacked shadow identified by the given index to size.
