1
0
Fork 0
forked from len0rd/rockbox

[Feature] splash.h split too long strings to multiple lines

If no split tokens are found the string just goes off into space

instead shoten the string till it fits and continue on with the
remaining string

Change-Id: I7fa3619fe8c75ec6c849996d4c3518409938152b
This commit is contained in:
William Wilgus 2024-06-18 09:36:48 -04:00 committed by William Wilgus
parent 73f40d8a23
commit 70c5d6239e

View file

@ -90,6 +90,18 @@ static bool splash_internal(struct screen * screen, const char *fmt, va_list ap,
break; /* screen full or out of lines */
x = 0;
y += chr_h;
/* split when it fits since we didn't find a valid token to break on */
size_t nl = next_len;
while (w > vp->width && --nl > 0)
w = font_getstringnsize(next, nl, NULL, NULL, fontnum);
if (nl > 1 && nl != next_len)
{
next_len = nl;
store = next + nl; /* move the start pos for the next token read */
}
lines[++line].len = next_len;
lines[line].str = next;
}