summaryrefslogtreecommitdiff
path: root/atari
diff options
context:
space:
mode:
Diffstat (limited to 'atari')
-rwxr-xr-xatari/plot/font_freetype.c5
-rw-r--r--atari/plot/font_internal.c9
-rwxr-xr-xatari/plot/font_vdi.c2
3 files changed, 12 insertions, 4 deletions
diff --git a/atari/plot/font_freetype.c b/atari/plot/font_freetype.c
index 8db7cc2c0..ed850bce2 100755
--- a/atari/plot/font_freetype.c
+++ b/atari/plot/font_freetype.c
@@ -443,8 +443,9 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t *fstyle,
last_space_idx = nxtchr;
}
*actual_x += glyph->advance.x >> 16;
- if (*actual_x > x) {
- /* string has exceeded available width return previous space*/
+ if (*actual_x > x && last_space_idx != 0) {
+ /* string has exceeded available width and we've
+ * found a space; return previous space */
*actual_x = last_space_x;
*char_offset = last_space_idx;
return true;
diff --git a/atari/plot/font_internal.c b/atari/plot/font_internal.c
index 3db29eba5..2b0025a71 100644
--- a/atari/plot/font_internal.c
+++ b/atari/plot/font_internal.c
@@ -118,7 +118,7 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
size_t length,int x, size_t *char_offset, int *actual_x )
{
const struct fb_font_desc* fb_font = fb_get_font(fstyle);
- *char_offset = x / fb_font->width;
+ int c_off = *char_offset = x / fb_font->width;
if (*char_offset > length) {
*char_offset = length;
} else {
@@ -127,6 +127,13 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
break;
(*char_offset)--;
}
+ if (*char_offset == 0) {
+ *char_offset = c_off;
+ while (*char_offset < length &&
+ string[*char_offset] != ' ') {
+ (*char_offset)++;
+ }
+ }
}
*actual_x = *char_offset * fb_font->width;
return( 1 );
diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c
index 4ebab24fb..340759f02 100755
--- a/atari/plot/font_vdi.c
+++ b/atari/plot/font_vdi.c
@@ -164,7 +164,7 @@ static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const
last_space_idx = nxtchr;
}
*actual_x += cellw;
- if (*actual_x > x) {
+ if (*actual_x > x && last_space_idx != 0) {
*actual_x = last_space_x;
*char_offset = last_space_idx;
//printf("at: %s\n", lstr);