[pango/matthiasc/for-main: 6/6] layout: Apply show flags to line separators




commit b054282fa39c6fc664796da72a612005332c9ce8
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jul 3 10:37:48 2022 -0400

    layout: Apply show flags to line separators
    
    We only want line separators at the line end
    to be visible when the show flags say so. This
    was not working before, because the shaping always
    marks LS as unknown glyph.

 pango/pango-layout.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 165c6a7f7..065f85a1b 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -6186,6 +6186,23 @@ add_missing_hyphen (PangoLayoutLine *line,
     }
 }
 
+static PangoShowFlags
+find_show_flags (const PangoAnalysis *analysis)
+{
+  GSList *l;
+  PangoShowFlags flags = 0;
+
+  for (l = analysis->extra_attrs; l; l = l->next)
+    {
+      PangoAttribute *attr = l->data;
+
+      if (attr->klass->type == PANGO_ATTR_SHOW)
+        flags |= ((PangoAttrInt*)attr)->value;
+    }
+
+  return flags;
+}
+
 static void
 zero_line_final_space (PangoLayoutLine *line,
                        ParaBreakState  *state,
@@ -6201,8 +6218,15 @@ zero_line_final_space (PangoLayoutLine *line,
 
   if (glyphs->glyphs[glyph].glyph == PANGO_GET_UNKNOWN_GLYPH (0x2028))
     {
-      DEBUG1 ("zero final space: visible space");
-      return; /* this LS is visible */
+      PangoShowFlags show_flags;
+
+      show_flags = find_show_flags (&item->analysis);
+
+      if ((show_flags & PANGO_SHOW_LINE_BREAKS) != 0)
+        {
+          DEBUG1 ("zero final space: visible space");
+          return; /* this LS is visible */
+        }
     }
 
   /* if the final char of line forms a cluster, and it's


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