[pango/pango2: 75/135] ellipsize: Filter attributes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 75/135] ellipsize: Filter attributes
- Date: Fri, 18 Feb 2022 20:11:01 +0000 (UTC)
commit dc4999c07b1a9712d65206215a1125ab47266512
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jan 25 20:54:04 2022 -0500
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.
pango/ellipsize.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index ebe8a684..939c9cda 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -340,13 +340,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]