diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 4df7dc99128..7bf2d857def 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); }