1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Move line width addition in next_wrap to be after switch block

There is no overlap in side effects between this line and the switch
statement after it, but it did result in adding the width of a final
null terminator or newline to the width of the current line, which is
a waste because those widths both 1) require trying to find
non-existent characters in the font and 2) will not be used.

I found this out because I added a debug print in find_glyphinfo(), and
something was requesting lots of codepoint 0 from the font.
This commit is contained in:
Dav999-v 2023-02-20 04:58:16 +01:00 committed by Misa Elizabeth Kai
parent 2934462410
commit 28e9df7f47

View file

@ -798,8 +798,6 @@ static bool next_wrap(
goto next; goto next;
} }
linewidth += get_advance(f, str[idx]);
switch (str[idx]) switch (str[idx])
{ {
case ' ': case ' ':
@ -817,6 +815,8 @@ static bool next_wrap(
return true; return true;
} }
linewidth += get_advance(f, str[idx]);
if (linewidth > maxwidth) if (linewidth > maxwidth)
{ {
if (lenfromlastspace != 0) if (lenfromlastspace != 0)