[pango/line-breaker] ellipsize: Filter attributes



commit 32ee6dacf464ad1f21422124edef4711263cc344
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 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]