Fix a discrepancy between lovrRasterizerMeasure and lovrFontRender wrapping
@@ -197,14 +197,16 @@ void lovrRasterizerMeasure(Rasterizer* rasterizer, const char* str, size_t lengt
*glyphCount = 0;
while ((bytes = utf8_decode(str, end, &codepoint)) > 0) {
- if (codepoint == '\n' || (wrap && x > wrap && codepoint == ' ')) {
+ if (codepoint == '\n' || (wrap && x > wrap && (codepoint == ' ' || previous == ' '))) {
*width = MAX(*width, x);
(*lineCount)++;
x = 0.f;
previous = '\0';
+ if (codepoint == ' ' || codepoint == '\n') {
str += bytes;
continue;
}
+ }
// Tabs
if (codepoint == '\t') {
