summaryrefslogtreecommitdiff
path: root/debug/fontd.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug/fontd.c')
-rw-r--r--debug/fontd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/debug/fontd.c b/debug/fontd.c
index f4537c238..2d6e3a51f 100644
--- a/debug/fontd.c
+++ b/debug/fontd.c
@@ -152,8 +152,16 @@ void font_close(struct font_data *data)
char * font_split(struct font_data *data, const char * text, unsigned int length,
unsigned int width, unsigned int *used_width)
{
- *used_width = width;
+ int i = width / 10;
- return text + (width / 10);
+ if (length < i) {
+ *used_width = length * 10;
+ return text + length;
+ }
+
+ for (; i != 0 && text[i] != ' '; i--)
+ ;
+ *used_width = i * 10;
+ return text + i;
}