From 145e118d8d071e5836334a3ffacf22cf789e4257 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sun, 21 Nov 2004 16:45:36 +0000 Subject: Return n+1 logical attributes not n logical attributes (#155912) Sun Nov 21 11:40:03 2004 Owen Taylor * pango/pango-layout.c (pango_layout_get_log_attrs): Return n+1 logical attributes not n logical attributes (#155912) --- ChangeLog | 5 +++++ ChangeLog.pre-1-10 | 5 +++++ ChangeLog.pre-1-8 | 5 +++++ pango/pango-layout.c | 12 +++++++----- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1863f680..cfe92476 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Nov 21 11:40:03 2004 Owen Taylor + + * pango/pango-layout.c (pango_layout_get_log_attrs): Return n+1 + logical attributes not n logical attributes (#155912) + Sun Nov 21 10:52:03 2004 Owen Taylor * pango/pango-context.c: Don't just call pango_fontset_get_metrics() diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 1863f680..cfe92476 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,8 @@ +Sun Nov 21 11:40:03 2004 Owen Taylor + + * pango/pango-layout.c (pango_layout_get_log_attrs): Return n+1 + logical attributes not n logical attributes (#155912) + Sun Nov 21 10:52:03 2004 Owen Taylor * pango/pango-context.c: Don't just call pango_fontset_get_metrics() diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 1863f680..cfe92476 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,8 @@ +Sun Nov 21 11:40:03 2004 Owen Taylor + + * pango/pango-layout.c (pango_layout_get_log_attrs): Return n+1 + logical attributes not n logical attributes (#155912) + Sun Nov 21 10:52:03 2004 Owen Taylor * pango/pango-context.c: Don't just call pango_fontset_get_metrics() diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 5f846a78..97649f40 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -917,8 +917,10 @@ pango_layout_context_changed (PangoLayout *layout) * @attrs: location to store a pointer to an array of logical attributes * This value must be freed with g_free(). * @n_attrs: location to store the number of the attributes in the - * array. (The stored value will be equal to the total number - * of characters in the layout.) + * array. (The stored value will be one more than the total number + * of characters in the layout, since there need to be attributes + * corresponding to both the position before the first character + * and the position after the last character.) * * Retrieves an array of logical attributes for each character in * the @layout. @@ -934,12 +936,12 @@ pango_layout_get_log_attrs (PangoLayout *layout, if (attrs) { - *attrs = g_new (PangoLogAttr, layout->n_chars); - memcpy (*attrs, layout->log_attrs, sizeof(PangoLogAttr) * layout->n_chars); + *attrs = g_new (PangoLogAttr, layout->n_chars + 1); + memcpy (*attrs, layout->log_attrs, sizeof(PangoLogAttr) * (layout->n_chars + 1)); } if (n_attrs) - *n_attrs = layout->n_chars; + *n_attrs = layout->n_chars + 1; } -- cgit v1.2.1