Fix Line breaking may not work correctly when using color tags with specific font

(cherry picked from commit c7bace1955)
This commit is contained in:
Marius Hanl 2025-08-17 16:27:14 +02:00 committed by lawnjelly
parent da3795b199
commit dbc2ce8eb0

View file

@ -361,12 +361,6 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
int ascent = font->get_ascent();
int descent = font->get_descent();
// Each BBCode tag is drawn individually, so we have to add the character spacing manually.
int spacing_char = 0;
if (visible_characters != 0) {
spacing_char = font->get_spacing_char();
}
Color color;
Color font_color_shadow;
bool underline = false;
@ -453,6 +447,12 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
end++;
}
// Each BBCode tag is drawn individually, so we have to add the character spacing manually.
int spacing_char = 0;
if (visible_characters != 0) {
spacing_char = font->get_spacing_char();
}
CHECK_HEIGHT(fh);
ENSURE_WIDTH(w + spacing_char);