summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Kendrick <rjek@netsurf-browser.org>2006-11-11 12:05:45 +0000
committerRob Kendrick <rjek@netsurf-browser.org>2006-11-11 12:05:45 +0000
commitd83dbbdebb961c7e31087a67aa5cefe4d20a9240 (patch)
tree7c3eb06ade18912fd3bad2be3d32a178cc523c1b
parent690e7f76783da4a3651fd9de38b634f4a957e7ba (diff)
downloadnetsurf-d83dbbdebb961c7e31087a67aa5cefe4d20a9240.tar.gz
netsurf-d83dbbdebb961c7e31087a67aa5cefe4d20a9240.tar.bz2
Fix pango font splitting's discovery of the width of the first line of a wrap.
svn path=/trunk/netsurf/; revision=3046
-rw-r--r--gtk/font_pango.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gtk/font_pango.c b/gtk/font_pango.c
index 132c4ffae..90d1a150c 100644
--- a/gtk/font_pango.c
+++ b/gtk/font_pango.c
@@ -135,11 +135,12 @@ bool nsfont_split(const struct css_style *style,
int x, size_t *char_offset, int *actual_x)
{
int index = length;
- int x_pos;
PangoFontDescription *desc;
PangoContext *context;
PangoLayout *layout;
PangoLayoutLine *line;
+ PangoLayoutIter *iter;
+ PangoRectangle rect;
desc = nsfont_style_to_description(style);
context = gdk_pango_context_get();
@@ -152,15 +153,17 @@ bool nsfont_split(const struct css_style *style,
line = pango_layout_get_line(layout, 1);
if (line)
index = line->start_index - 1;
- pango_layout_line_index_to_x(pango_layout_get_line(layout, 0),
- index, 0, &x_pos);
+
+ iter = pango_layout_get_iter(layout);
+ pango_layout_iter_get_line_extents(iter, NULL, &rect);
+ pango_layout_iter_free(iter);
g_object_unref(layout);
g_object_unref(context);
pango_font_description_free(desc);
*char_offset = index;
- *actual_x = PANGO_PIXELS(x_pos);
+ *actual_x = PANGO_PIXELS(rect.width);
return true;
}