diff options
author | William Wilgus <wilgus.william@gmail.com> | 2024-06-18 09:36:48 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2024-06-18 09:52:41 -0400 |
commit | 70c5d6239e8a42fef1d06571044ee5df3e2dac59 (patch) | |
tree | 6fed68d185b958cad7a7d6450dc23ee4a7e6b0f9 | |
parent | 73f40d8a2385543464d79d4461ab68eb56783d26 (diff) | |
download | rockbox-70c5d6239e8a42fef1d06571044ee5df3e2dac59.tar.gz rockbox-70c5d6239e8a42fef1d06571044ee5df3e2dac59.zip |
[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
-rw-r--r-- | apps/gui/splash.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/gui/splash.c b/apps/gui/splash.c index d0f1fbb67c..e8ad591264 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c | |||
@@ -90,6 +90,18 @@ static bool splash_internal(struct screen * screen, const char *fmt, va_list ap, | |||
90 | break; /* screen full or out of lines */ | 90 | break; /* screen full or out of lines */ |
91 | x = 0; | 91 | x = 0; |
92 | y += chr_h; | 92 | y += chr_h; |
93 | |||
94 | /* split when it fits since we didn't find a valid token to break on */ | ||
95 | size_t nl = next_len; | ||
96 | while (w > vp->width && --nl > 0) | ||
97 | w = font_getstringnsize(next, nl, NULL, NULL, fontnum); | ||
98 | |||
99 | if (nl > 1 && nl != next_len) | ||
100 | { | ||
101 | next_len = nl; | ||
102 | store = next + nl; /* move the start pos for the next token read */ | ||
103 | } | ||
104 | |||
93 | lines[++line].len = next_len; | 105 | lines[++line].len = next_len; |
94 | lines[line].str = next; | 106 | lines[line].str = next; |
95 | } | 107 | } |