[pango/hyphen-log-attr: 3/6] shape: Rearrange hb buffer setup




commit dec273128a15821949011c66836db4f87c04a442
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 24 19:25:31 2021 -0400

    shape: Rearrange hb buffer setup
    
    Rearrange the buffer setup code slightly,
    so that we can change it easier, later.

 pango/shape.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/pango/shape.c b/pango/shape.c
index aeb9aa47..707534ed 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -392,18 +392,18 @@ pango_hb_shape (const char          *item_text,
   hb_buffer_set_flags (hb_buffer, hb_buffer_flags);
   hb_buffer_set_invisible_glyph (hb_buffer, PANGO_GLYPH_EMPTY);
 
+  /* Add pre-context */
+  hb_buffer_add_utf8 (hb_buffer, paragraph_text, item_offset, item_offset, 0);
+
   if (transform == PANGO_TEXT_TRANSFORM_NONE)
     {
-      hb_buffer_add_utf8 (hb_buffer, paragraph_text, paragraph_length, item_offset, item_length);
+      hb_buffer_add_utf8 (hb_buffer, paragraph_text, item_offset + item_length, item_offset, item_length);
     }
   else
     {
       const char *p;
       int i;
 
-      /* Add pre-context */
-      hb_buffer_add_utf8 (hb_buffer, paragraph_text, item_offset, item_offset, 0);
-
       /* Transform the item text according to text transform.
        * Note: we assume text transforms won't cross font boundaries
        */
@@ -447,12 +447,11 @@ pango_hb_shape (const char          *item_text,
           else
             hb_buffer_add (hb_buffer, ch, index);
         }
-
-      /* Add post-context */
-      hb_buffer_add_utf8 (hb_buffer, paragraph_text + item_offset + item_length, paragraph_length - 
(item_offset + item_length),
-                          item_offset + item_length, 0);
     }
 
+  /* Add post-context */
+  hb_buffer_add_utf8 (hb_buffer, paragraph_text, paragraph_length, item_offset + item_length, 0);
+
   if (analysis->flags & PANGO_ANALYSIS_FLAG_NEED_HYPHEN)
     {
       /* Insert either a Unicode or ASCII hyphen. We may


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