Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Nov 10, 2024
1 parent e214215 commit e4402e1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/gfx/render_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ break_info_t calculate_line_wrapping(rectangle dest_rect, std::string str, TextS
str_to_draw.setString(str);
short total_width = str_to_draw.getLocalBounds().width;

if(total_width < dest_rect.width()){
// The text fits on one line, so break_info won't end up being used by win_draw_string anyway
return break_info;
}
// Even if the text is only one line, break_info is required for calculating word boundaries.
// So we can't skip the rest of this.

auto text_len = [&str_to_draw](size_t i) -> int {
return str_to_draw.findCharacterPos(i).x;
Expand Down

0 comments on commit e4402e1

Please sign in to comment.