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.
Checking the stable version of the documentation...
LabelSettings
继承: Resource < RefCounted < Object
提供能够在 Label 中自定义文本的常见设置。
描述
LabelSettings 是一种提供在 Label 中自定义文本的常见设置的资源。优先于 Control.theme 中定义的属性。该资源可以在多个标签之间共享,可以随时替换,因此可以方便、灵活地设置文本样式。
属性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
void |
add_stacked_outline(index: int = -1) |
void |
add_stacked_shadow(index: int = -1) |
get_stacked_outline_color(index: int) const |
|
get_stacked_outline_size(index: int) const |
|
get_stacked_shadow_color(index: int) const |
|
get_stacked_shadow_offset(index: int) const |
|
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) |
属性说明
文本使用的 Font。
Color font_color = Color(1, 1, 1, 1) 🔗
文本的颜色。
文本的大小。
行与行之间的额外纵向留白(单位为像素),留白会被添加到行的降部。该值可以为负数。
Color outline_color = Color(1, 1, 1, 1) 🔗
轮廓的颜色。
文本轮廓大小。
float paragraph_spacing = 0.0 🔗
段落之间的垂直空间。在 line_spacing 上添加。
Color shadow_color = Color(0, 0, 0, 0) 🔗
阴影效果的颜色。如果 Alpha 为 0 ,则不会绘制阴影。
Vector2 shadow_offset = Vector2(1, 1) 🔗
阴影效果的偏移,单位为像素。
阴影效果的大小。
int stacked_outline_count = 0 🔗
堆叠轮廓的数量。
Color stacked_outline_{index}/color = Color(0, 0, 0, 1) 🔗
索引为 index 的轮廓的颜色。
注意: index 的取值范围为 0 .. stacked_outline_count - 1。
int stacked_outline_{index}/size = 0 🔗
索引为 index 的轮廓的大小。
注意: index 的取值范围为 0 .. stacked_outline_count - 1。
int stacked_shadow_count = 0 🔗
堆叠阴影的数量。
Color stacked_shadow_{index}/color = Color(0, 0, 0, 1) 🔗
索引为 index 的阴影的颜色。
注意: index 的取值范围为 0 .. stacked_shadow_count - 1。
Vector2 stacked_shadow_{index}/offset = Vector2(1, 1) 🔗
索引为 index 的阴影的偏移量。
注意: index 的取值范围为 0 .. stacked_shadow_count - 1。
int stacked_shadow_{index}/outline_size = 0 🔗
索引为 index 的阴影轮廓的大小。
注意: index 的取值范围为 0 .. stacked_shadow_count - 1。
方法说明
void add_stacked_outline(index: int = -1) 🔗
为标签在索引为 index 处添加新的堆叠轮廓。如果 index 为 -1,则新的堆叠轮廓会添加到列表的末尾。
void add_stacked_shadow(index: int = -1) 🔗
为标签在索引为 index 处添加新的堆叠阴影。如果 index 为 -1,则新的堆叠阴影会添加到列表的末尾。
Color get_stacked_outline_color(index: int) const 🔗
返回索引为 index 的堆叠轮廓的颜色。
int get_stacked_outline_size(index: int) const 🔗
返回索引为 index 的堆叠轮廓的大小。
Color get_stacked_shadow_color(index: int) const 🔗
返回索引为 index 的堆叠阴影的颜色。
Vector2 get_stacked_shadow_offset(index: int) const 🔗
返回索引为 index 的堆叠阴影的偏移量。
int get_stacked_shadow_outline_size(index: int) const 🔗
返回索引为 index 的堆叠阴影的轮廓大小。
void move_stacked_outline(from_index: int, to_position: int) 🔗
将索引为 from_index 的堆叠轮廓移动至数组中的 to_position 位置。
void move_stacked_shadow(from_index: int, to_position: int) 🔗
将索引为 from_index 的堆叠阴影移动至数组中的 to_position 位置。
void remove_stacked_outline(index: int) 🔗
移除索引为 index 的堆叠轮廓。
void remove_stacked_shadow(index: int) 🔗
移除索引为 index 的堆叠阴影。
void set_stacked_outline_color(index: int, color: Color) 🔗
将索引为 index 的堆叠轮廓的颜色设为 color。
void set_stacked_outline_size(index: int, size: int) 🔗
将索引为 index 的堆叠轮廓的大小设为 size。
void set_stacked_shadow_color(index: int, color: Color) 🔗
将索引为 index 的堆叠阴影的颜色设为 color。
void set_stacked_shadow_offset(index: int, offset: Vector2) 🔗
将索引为 index 的堆叠阴影的偏移量设为 offset。
void set_stacked_shadow_outline_size(index: int, size: int) 🔗
将索引为 index 的堆叠阴影的轮廓大小设为 size。