Skip to content

Commit

Permalink
Merge pull request #88185 from bruvzg/font_draw_no_ellipsis
Browse files Browse the repository at this point in the history
[Font] Do not use trim with ellipsis in the basic Font string drawing functions.
  • Loading branch information
akien-mga committed Feb 15, 2024
2 parents 4bb3af6 + 1a5bae9 commit 7e14974
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scene/resources/font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Font>(this), p_font_size);
cache.insert(key, buffer);
}
Expand Down Expand Up @@ -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);
}

Expand All @@ -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<Font>(this), p_font_size);
cache.insert(key, buffer);
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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<Font>(this), p_font_size);
cache.insert(key, buffer);
}
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 7e14974

Please sign in to comment.