[pango/log-attr-tweaks] layout: Don't overwrite eot attrs



commit 87c341ec9a84c39f58126ed6a1443c66f3a6ad56
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 24 00:43:53 2021 -0400

    layout: Don't overwrite eot attrs

 pango/pango-layout.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 07f70f28..b719c2d5 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -4270,9 +4270,17 @@ get_items_log_attrs (const char    *text,
 {
   int offset = 0;
   GList *l;
+  PangoLogAttr attr_before = log_attrs[0];
 
   pango_default_break (text + start, length, NULL, log_attrs, log_attrs_len);
 
+  if (start > 0)
+    {
+      log_attrs->is_line_break      |= attr_before.is_line_break;
+      log_attrs->is_mandatory_break |= attr_before.is_mandatory_break;
+      log_attrs->is_cursor_position |= attr_before.is_cursor_position;
+    }
+
   for (l = items; l; l = l->next)
     {
       PangoItem *item = l->data;
@@ -4294,6 +4302,9 @@ get_items_log_attrs (const char    *text,
       PangoItem *item = items->data;
       pango_attr_break (text + start, length, attrs, item->offset, log_attrs, log_attrs_len);
     }
+
+  log_attrs[log_attrs_len - 1].is_line_break = TRUE;
+  log_attrs[log_attrs_len - 1].is_mandatory_break = TRUE;
 }
 
 static PangoAttrList *


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