summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-01-18 22:04:57 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-01-18 22:04:57 +0000
commitbf7b23506da89669fadfe6628a8aba5fcd36d55a (patch)
treebd4dbdb904ca222440e4f5eb270117134c22ed92 /riscos
parenta6e56546c957f213503333483b383307dda144b9 (diff)
downloadnetsurf-bf7b23506da89669fadfe6628a8aba5fcd36d55a.tar.gz
netsurf-bf7b23506da89669fadfe6628a8aba5fcd36d55a.tar.bz2
Make nsfont_split implementation better for core textarea.
Diffstat (limited to 'riscos')
-rw-r--r--riscos/font.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/riscos/font.c b/riscos/font.c
index d92d5b521..326cca973 100644
--- a/riscos/font.c
+++ b/riscos/font.c
@@ -358,10 +358,23 @@ bool nsfont_split(const plot_font_style_t *fstyle,
return false;
}
- if (*char_offset != length)
+ 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,
actual_x);