aboutsummaryrefslogtreecommitdiff
path: root/src/shape.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2015-10-11 22:27:02 +0200
committerThomas White <taw@bitwiz.org.uk>2015-10-11 22:27:02 +0200
commit702407e5f93ac71b686ec3ee9ff8cab022d4e446 (patch)
treef646df8a7f1906f872a60da18d912c893c57b03e /src/shape.c
parent6b803f302fbc5cd32f1e58979c010fe3e54b44ae (diff)
No need for separate len_bytes field in wrap_box
Diffstat (limited to 'src/shape.c')
-rw-r--r--src/shape.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shape.c b/src/shape.c
index ccfe9e1..f483510 100644
--- a/src/shape.c
+++ b/src/shape.c
@@ -50,11 +50,14 @@ void shape_box(struct wrap_box *box)
{
PangoRectangle rect;
const char *tp;
+ const char *ep;
tp = g_utf8_offset_to_pointer(sc_block_contents(box->scblock),
box->offs_char);
+ ep = g_utf8_offset_to_pointer(sc_block_contents(box->scblock),
+ box->offs_char+box->len_chars);
- pango_shape(tp, box->len_bytes, &box->analysis, box->glyphs);
+ pango_shape(tp, ep-tp, &box->analysis, box->glyphs);
pango_glyph_string_extents(box->glyphs, box->font, NULL, &rect);
@@ -98,7 +101,6 @@ static void add_wrap_box(gpointer vi, gpointer vb)
box->scblock = bas->bl;
box->offs_char = g_utf8_pointer_to_offset(tp, tp+offs_bytes);
box->len_chars = g_utf8_strlen(tp+offs_bytes, item->length);
- box->len_bytes = item->length;
col = sc_interp_get_fgcol(bas->scin);
box->col[0] = col[0]; /* Red */