Skip to content

Commit c5dc6e1

Browse files
committed
[RTL] Fix "fade" effect char index calculations.
1 parent d79ff84 commit c5dc6e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scene/gui/rich_text_label.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,8 +1184,8 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
11841184
//Apply fx.
11851185
if (fade) {
11861186
float faded_visibility = 1.0f;
1187-
if (glyphs[i].start >= fade->starting_index) {
1188-
faded_visibility -= (float)(glyphs[i].start - fade->starting_index) / (float)fade->length;
1187+
if (l.char_offset + glyphs[i].start >= fade->char_ofs + fade->starting_index) {
1188+
faded_visibility -= (float)((l.char_offset + glyphs[i].start) - (fade->char_ofs + fade->starting_index)) / (float)fade->length;
11891189
faded_visibility = faded_visibility < 0.0f ? 0.0f : faded_visibility;
11901190
}
11911191
font_color.a = faded_visibility;
@@ -5300,10 +5300,10 @@ void RichTextLabel::append_text(const String &p_bbcode) {
53005300
tag_stack.push_front("outline_size");
53015301

53025302
} else if (bbcode_name == "fade") {
5303-
int start_index = brk_pos;
5303+
int start_index = 0;
53045304
OptionMap::Iterator start_option = bbcode_options.find("start");
53055305
if (start_option) {
5306-
start_index += start_option->value.to_int();
5306+
start_index = start_option->value.to_int();
53075307
}
53085308

53095309
int length = 10;

0 commit comments

Comments
 (0)