From c5dc6e1c6d4dbc388c5d13262ca071bdeb7ab2b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Mon, 13 Jan 2025 08:11:59 +0200 Subject: [PATCH] [RTL] Fix "fade" effect char index calculations. --- scene/gui/rich_text_label.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index ba59821e4e5..46982981850 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1184,8 +1184,8 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o //Apply fx. if (fade) { float faded_visibility = 1.0f; - if (glyphs[i].start >= fade->starting_index) { - faded_visibility -= (float)(glyphs[i].start - fade->starting_index) / (float)fade->length; + if (l.char_offset + glyphs[i].start >= fade->char_ofs + fade->starting_index) { + faded_visibility -= (float)((l.char_offset + glyphs[i].start) - (fade->char_ofs + fade->starting_index)) / (float)fade->length; faded_visibility = faded_visibility < 0.0f ? 0.0f : faded_visibility; } font_color.a = faded_visibility; @@ -5300,10 +5300,10 @@ void RichTextLabel::append_text(const String &p_bbcode) { tag_stack.push_front("outline_size"); } else if (bbcode_name == "fade") { - int start_index = brk_pos; + int start_index = 0; OptionMap::Iterator start_option = bbcode_options.find("start"); if (start_option) { - start_index += start_option->value.to_int(); + start_index = start_option->value.to_int(); } int length = 10;