Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Font] Do not use trim with ellipsis in the basic Font string drawing functions. #88185

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading