From 1a5bae9adc8842afe5c9458f3fbc317431e8768d Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Sun, 11 Feb 2024 00:23:35 +0200 Subject: [PATCH] [Font] Do not use trim with ellipsis in the basic Font string drawing functions. --- scene/resources/font.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index d0ad664c8891..790c9c100e59 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -288,6 +288,7 @@ Size2 Font::get_string_size(const String &p_text, HorizontalAlignment p_alignmen buffer.instantiate(); buffer->set_direction(p_direction); buffer->set_orientation(p_orientation); + buffer->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_CHAR); buffer->add_string(p_text, Ref(this), p_font_size); cache.insert(key, buffer); } @@ -315,6 +316,7 @@ Size2 Font::get_multiline_string_size(const String &p_text, HorizontalAlignment lines_buffer->set_width(p_width); lines_buffer->set_break_flags(p_brk_flags); lines_buffer->set_justification_flags(p_jst_flags); + lines_buffer->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_CHAR); cache_wrap.insert(key, lines_buffer); } @@ -335,6 +337,7 @@ void Font::draw_string(RID p_canvas_item, const Point2 &p_pos, const String &p_t buffer.instantiate(); buffer->set_direction(p_direction); buffer->set_orientation(p_orientation); + buffer->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_CHAR); buffer->add_string(p_text, Ref(this), p_font_size); cache.insert(key, buffer); } @@ -369,6 +372,7 @@ void Font::draw_multiline_string(RID p_canvas_item, const Point2 &p_pos, const S lines_buffer->set_width(p_width); lines_buffer->set_break_flags(p_brk_flags); lines_buffer->set_justification_flags(p_jst_flags); + lines_buffer->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_CHAR); cache_wrap.insert(key, lines_buffer); } @@ -396,6 +400,7 @@ void Font::draw_string_outline(RID p_canvas_item, const Point2 &p_pos, const Str buffer.instantiate(); buffer->set_direction(p_direction); buffer->set_orientation(p_orientation); + buffer->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_CHAR); buffer->add_string(p_text, Ref(this), p_font_size); cache.insert(key, buffer); } @@ -430,6 +435,7 @@ void Font::draw_multiline_string_outline(RID p_canvas_item, const Point2 &p_pos, lines_buffer->set_width(p_width); lines_buffer->set_break_flags(p_brk_flags); lines_buffer->set_justification_flags(p_jst_flags); + lines_buffer->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_CHAR); cache_wrap.insert(key, lines_buffer); }