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:
parent
73f40d8a23
commit
70c5d6239e
1 changed files with 12 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue