summaryrefslogtreecommitdiff
path: root/riscos/font.c
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2013-01-31 19:28:26 +0100
committerOle Loots <ole@monochrom.net>2013-01-31 19:28:26 +0100
commit0703404654d2a40cacae2d94c6e0e22ca28b4acf (patch)
treebfdbe1e8952814f73a6b0e190ae0a77fd0cfc7bd /riscos/font.c
parent54f719aa960159c5b1978846223732c9669ca7fa (diff)
parent89856f55929907642013e45435b9d18cd1fafe36 (diff)
downloadnetsurf-0703404654d2a40cacae2d94c6e0e22ca28b4acf.tar.gz
netsurf-0703404654d2a40cacae2d94c6e0e22ca28b4acf.tar.bz2
Merge branch 'master' into mono/removing-windom-dependencymono/removing-windom-dependency
Conflicts: atari/toolbar.c
Diffstat (limited to 'riscos/font.c')
-rw-r--r--riscos/font.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/riscos/font.c b/riscos/font.c
index 717b9606c..8d4c6d337 100644
--- a/riscos/font.c
+++ b/riscos/font.c
@@ -255,6 +255,7 @@ bool nsfont_width(const plot_font_style_t *fstyle,
else
LOG(("rufl_width: 0x%x", code));
/* warn_user("MiscError", "font error"); */
+ *width = 0;
return false;
}
@@ -303,6 +304,8 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle,
else
LOG(("rufl_x_to_offset: 0x%x", code));
/* warn_user("MiscError", "font error"); */
+ *char_offset = 0;
+ *actual_x = 0;
return false;
}
@@ -355,11 +358,27 @@ bool nsfont_split(const plot_font_style_t *fstyle,
else
LOG(("rufl_split: 0x%x", code));
/* warn_user("MiscError", "font error"); */
+ *char_offset = 0;
+ *actual_x = 0;
return false;
}
- while (*char_offset && string[*char_offset] != ' ')
- (*char_offset)--;
+ if (*char_offset != length) {
+ /* we found something to split at */
+ size_t orig = *char_offset;
+
+ /* ensure a space at <= the split point we found */
+ while (*char_offset && string[*char_offset] != ' ')
+ (*char_offset)--;
+
+ /* nothing valid found <= split point, advance to next space */
+ if (*char_offset == 0) {
+ *char_offset = orig;
+ while (*char_offset != length &&
+ string[*char_offset] != ' ')
+ (*char_offset)++;
+ }
+ }
code = rufl_width(font_family, font_style, font_size,
string, *char_offset,
@@ -372,6 +391,8 @@ bool nsfont_split(const plot_font_style_t *fstyle,
else
LOG(("rufl_width: 0x%x", code));
/* warn_user("MiscError", "font error"); */
+ *char_offset = 0;
+ *actual_x = 0;
return false;
}