[pango/pango2: 26/115] ellipsize: Filter attributes




commit 1d84f4946bd202d2ec1eed146345018af0b19fad
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]