Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Nov 16, 2024
1 parent 4cd2d0a commit 3375b41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gfx/render_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ static void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,st
location moveTo;
line_height -= 2; // TODO: ...why are we arbitrarily reducing the line height from the requested value?

// Pipes need to be left in the string that gets passed
// to calculate_line_wrapping() or frame calculation is
// broken.
std::string str_with_pipes = str;
if(!options.showBreaks){
for(int i=0; i < str.length(); ++i){
if(str[i] == '|') str[i] = ' ';
Expand All @@ -175,7 +179,7 @@ static void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,st
// It is better to pre-calculate line-wrapping and pass it in the options,
// but if you don't, this will handle line-wrapping every frame:
if(break_info.empty()){
break_info = calculate_line_wrapping(dest_rect, str, options.style);
break_info = calculate_line_wrapping(dest_rect, str_with_pipes, options.style);
}

moveTo = location(dest_rect.left + adjust_x, dest_rect.top + adjust_y);
Expand Down

0 comments on commit 3375b41

Please sign in to comment.