diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-01-25 20:54:04 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-01-25 20:54:04 -0500 |
commit | 32ee6dacf464ad1f21422124edef4711263cc344 (patch) | |
tree | f3c55a2057f80815d24f99f5ce533fa2cbfeb9c0 | |
parent | 40aa6e1f0dd197ec198d209d912df8ca8e693c0e (diff) | |
download | pango-32ee6dacf464ad1f21422124edef4711263cc344.tar.gz |
ellipsize: Filter attributes
When collecting attributes to itemize and
shape the ellipsize, don't pick up rendering
attributes. This fixes occasional miscolored
ellipses if the beginning of the line is colored.
-rw-r--r-- | pango/ellipsize.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pango/ellipsize.c b/pango/ellipsize.c index 1a7f8eb6..c58efc34 100644 --- a/pango/ellipsize.c +++ b/pango/ellipsize.c @@ -338,13 +338,19 @@ shape_ellipsis (EllipsizeState *state) /* Create an attribute list */ run_attrs = pango_attr_iterator_get_attrs (state->gap_start_attr); + int s, e; + pango_attr_iterator_range (state->gap_start_attr, &s, &e); for (l = run_attrs; l; l = l->next) { PangoAttribute *attr = l->data; attr->start_index = 0; attr->end_index = G_MAXINT; - pango_attr_list_insert (&attrs, attr); + if (pango_attribute_affects_itemization (attr, NULL) || + pango_attribute_affects_break_or_shape (attr, NULL)) + pango_attr_list_insert (&attrs, attr); + else + pango_attribute_destroy (attr); } g_slist_free (run_attrs); |