summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-02-06 22:27:51 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-02-06 22:27:51 +0000
commit2260152ebfeed8c303343a12e11ea51713487ed7 (patch)
tree3134e4346fc76f8746e009cefbf51f790ac54e87
parent79301e423ce1f8b43983c4262c6cee5e5c4c04f6 (diff)
downloadnetsurf-2260152ebfeed8c303343a12e11ea51713487ed7.tar.gz
netsurf-2260152ebfeed8c303343a12e11ea51713487ed7.tar.bz2
Fix split implementation.
-rw-r--r--gtk/font_pango.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gtk/font_pango.c b/gtk/font_pango.c
index 00131b416..2c77f3015 100644
--- a/gtk/font_pango.c
+++ b/gtk/font_pango.c
@@ -196,7 +196,7 @@ bool nsfont_split(const plot_font_style_t *fstyle,
if (line != NULL) {
/* Pango split the text. The line's start_index indicates the
* start of the character after the line break. */
- index = line->start_index;
+ int orig = index = line->start_index;
/* We must ensure that the split character is a space so that
* we meet the API postcondition. Therefore, scan backwards
@@ -206,6 +206,12 @@ bool nsfont_split(const plot_font_style_t *fstyle,
if (string[--index] == ' ')
break;
}
+
+ if (index == 0) {
+ index = orig;
+ while (index != (int)length && string[index] != ' ')
+ index++;
+ }
}
g_object_unref(layout);