This commit is contained in:
2024-11-09 19:04:22 -06:00
committed by Celtic Minstrel
parent 77297c2a88
commit e2142158af

View File

@@ -160,6 +160,10 @@ static void win_draw_string(sf::RenderTarget& dest_window,rectangle dest_rect,st
location moveTo; location moveTo;
line_height -= 2; // TODO: ...why are we arbitrarily reducing the line height from the requested value? 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){ if(!options.showBreaks){
for(int i=0; i < str.length(); ++i){ for(int i=0; i < str.length(); ++i){
if(str[i] == '|') str[i] = ' '; if(str[i] == '|') str[i] = ' ';
@@ -172,7 +176,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, // 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: // but if you don't, this will handle line-wrapping every frame:
if(break_info.empty()){ 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); moveTo = location(dest_rect.left + adjust_x, dest_rect.top + adjust_y);