From c7bace19558e16998447acff5ef36174d056a07c Mon Sep 17 00:00:00 2001 From: Marius Hanl Date: Sun, 17 Aug 2025 16:27:14 +0200 Subject: [PATCH] Fix Line breaking may not work correctly when using color tags with specific font --- scene/gui/rich_text_label.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 1ea7c8846e7..fdd2e2f008d 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -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);