[pango/letterspacing-liga] Turn off ligatures when letterspacing



commit 2c64379a6d663ff57a19b7852e401bfb9a551f48
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jul 29 00:26:02 2019 -0400

    Turn off ligatures when letterspacing
    
    When letterspacing, we don't want the letters making
    up ligatures to 'stick together', so turn off OpenType
    features that request optional ligatures (liga, clig,
    dlig).
    
    Closes: https://gitlab.gnome.org/GNOME/pango/issues/182

 pango/pangofc-shape.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index c2b8dc3e..a4fd9a32 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -110,6 +110,29 @@ apply_extra_attributes (GSList       *attrs,
             }
         }
     }
+
+  /* Turn off ligatures when letterspacing */
+  for (l = attrs; l && *num_features < length; l = l->next)
+    {
+      PangoAttribute *attr = l->data;
+      if (attr->klass->type == PANGO_ATTR_LETTER_SPACING)
+        {
+          hb_tag_t *tags[] = {
+            HB_TAG('l','i','g','a'),
+            HB_TAG('c','l','i','g'),
+            HB_TAG('d','l','i','g'),
+          };
+          int i;
+          for (i = 0; i < G_N_ELEMENTS (tags); i++)
+            {
+              features[*num_features].tag = tags[i];
+              features[*num_features].value = 0;
+              features[*num_features].start = attr->start_index;
+              features[*num_features].end = attr->end_index;
+              (*num_features)++;
+            }
+        }
+    }
 }
 
 typedef struct


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