mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Ignore last space in justified text
This commit is contained in:
@@ -507,8 +507,12 @@ std::vector<Font::DrawCommand> Font::generateVerticesFormatted(const love::font:
|
||||
auto start = text.cps.begin() + range.getOffset();
|
||||
auto end = start + range.getSize();
|
||||
float numspaces = std::count(start, end, ' ');
|
||||
|
||||
if (text.cps[range.last] == ' ')
|
||||
--numspaces;
|
||||
|
||||
if (width < wrap && numspaces >= 1)
|
||||
extraspacing = (wrap - width) / (numspaces - 1);
|
||||
extraspacing = (wrap - width) / numspaces;
|
||||
else
|
||||
extraspacing = 0.0f;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user