summaryrefslogtreecommitdiff
path: root/scene/gui/rich_text_label.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/rich_text_label.cpp')
-rw-r--r--scene/gui/rich_text_label.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 21a87d4e76..562bac60c2 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -366,7 +366,7 @@ void RichTextLabel::_resize_line(ItemFrame *p_frame, int p_line, const Ref<Font>
}
if (p_line > 0) {
- l.offset.y = p_frame->lines[p_line - 1].offset.y + p_frame->lines[p_line - 1].text_buf->get_size().y;
+ l.offset.y = p_frame->lines[p_line - 1].offset.y + p_frame->lines[p_line - 1].text_buf->get_size().y + get_theme_constant(SNAME("line_separation"));
} else {
l.offset.y = 0;
}
@@ -614,7 +614,7 @@ void RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font>
*r_char_offset = l.char_offset + l.char_count;
if (p_line > 0) {
- l.offset.y = p_frame->lines[p_line - 1].offset.y + p_frame->lines[p_line - 1].text_buf->get_size().y;
+ l.offset.y = p_frame->lines[p_line - 1].offset.y + p_frame->lines[p_line - 1].text_buf->get_size().y + get_theme_constant(SNAME("line_separation"));
} else {
l.offset.y = 0;
}
@@ -874,7 +874,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
charfx->visibility = visible;
charfx->outline = true;
charfx->font = frid;
- charfx->glpyh_index = gl;
+ charfx->glyph_index = gl;
charfx->offset = fx_offset;
charfx->color = font_color;
@@ -884,7 +884,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
fx_offset += charfx->offset;
font_color = charfx->color;
frid = charfx->font;
- gl = charfx->glpyh_index;
+ gl = charfx->glyph_index;
visible &= charfx->visibility;
}
} else if (item_fx->type == ITEM_SHAKE) {
@@ -1026,7 +1026,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
charfx->visibility = visible;
charfx->outline = false;
charfx->font = frid;
- charfx->glpyh_index = gl;
+ charfx->glyph_index = gl;
charfx->offset = fx_offset;
charfx->color = font_color;
@@ -1036,7 +1036,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
fx_offset += charfx->offset;
font_color = charfx->color;
frid = charfx->font;
- gl = charfx->glpyh_index;
+ gl = charfx->glyph_index;
visible &= charfx->visibility;
}
} else if (item_fx->type == ITEM_SHAKE) {
@@ -3946,24 +3946,15 @@ float RichTextLabel::get_percent_visible() const {
return percent_visible;
}
-void RichTextLabel::set_effects(const Vector<Variant> &effects) {
- custom_effects.clear();
- for (int i = 0; i < effects.size(); i++) {
- Ref<RichTextEffect> effect = Ref<RichTextEffect>(effects[i]);
- custom_effects.push_back(effect);
- }
-
+void RichTextLabel::set_effects(Array p_effects) {
+ custom_effects = p_effects;
if ((bbcode != "") && use_bbcode) {
parse_bbcode(bbcode);
}
}
-Vector<Variant> RichTextLabel::get_effects() {
- Vector<Variant> r;
- for (int i = 0; i < custom_effects.size(); i++) {
- r.push_back(custom_effects[i]);
- }
- return r;
+Array RichTextLabel::get_effects() {
+ return custom_effects;
}
void RichTextLabel::install_effect(const Variant effect) {
@@ -4279,12 +4270,13 @@ void RichTextLabel::_draw_fbg_boxes(RID p_ci, RID p_rid, Vector2 line_off, Item
Ref<RichTextEffect> RichTextLabel::_get_custom_effect_by_code(String p_bbcode_identifier) {
for (int i = 0; i < custom_effects.size(); i++) {
- if (!custom_effects[i].is_valid()) {
+ Ref<RichTextEffect> effect = custom_effects[i];
+ if (!effect.is_valid()) {
continue;
}
- if (custom_effects[i]->get_bbcode() == p_bbcode_identifier) {
- return custom_effects[i];
+ if (effect->get_bbcode() == p_bbcode_identifier) {
+ return effect;
}
}
@@ -4361,7 +4353,7 @@ RichTextLabel::RichTextLabel() {
current_frame = main;
vscroll = memnew(VScrollBar);
- add_child(vscroll);
+ add_child(vscroll, false, INTERNAL_MODE_FRONT);
vscroll->set_drag_node(String(".."));
vscroll->set_step(1);
vscroll->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, 0);