- fixed line breaking on non-spaces for multi-byte UTF-8 characters.

This needs to backtrack the entire code point, not just one byte.
This commit is contained in:
Christoph Oelckers 2019-07-24 21:40:17 +02:00
parent 15eabfd055
commit 4cfc650f5b

View file

@ -125,7 +125,9 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
if ((w > 0 && w + nw > maxwidth) || c == '\n')
{ // Time to break the line
if (!space)
space = string - 1;
{
for (space = string - 1; (*space & 0xc0) == 0x80 && space > start; space--);
}
auto index = Lines.Reserve(1);
breakit (&Lines[index], font, start, space, linecolor);