Improve justified text alignment

This commit is contained in:
Ron Tseytlin
2024-12-16 21:42:42 +02:00
parent 486cc22dbd
commit 7e34e0ad21
3 changed files with 13 additions and 3 deletions
+1 -1
View File
@@ -508,7 +508,7 @@ std::vector<Font::DrawCommand> Font::generateVerticesFormatted(const love::font:
auto end = start + range.getSize();
float numspaces = std::count(start, end, ' ');
if (width < wrap && numspaces >= 1)
extraspacing = floorf((wrap - width) / numspaces);
extraspacing = (wrap - width) / (numspaces - 1);
else
extraspacing = 0.0f;
break;