[pango/non-breaking-attrs] Set ranges on features



commit eb1021f1c4b1fd67522092395732d4b3329ce5a2
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jul 11 15:06:51 2019 -0400

    Set ranges on features
    
    Before passing the features to hb_shape(), set their ranges,
    since they are no longer always for the full length of the
    item.

 pango/pangofc-shape.c | 46 +++++++++++++++++++++++++---------------------
 1 file changed, 25 insertions(+), 21 deletions(-)
---
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index b062bd26..2846449e 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -440,10 +440,11 @@ _pango_fc_shape (PangoFont           *font,
       GSList *tmp_attrs;
 
       for (tmp_attrs = analysis->extra_attrs; tmp_attrs && num_features < G_N_ELEMENTS (features); tmp_attrs 
= tmp_attrs->next)
-       {
-        if (((PangoAttribute *) tmp_attrs->data)->klass->type == PANGO_ATTR_FONT_FEATURES)
-          {
-            const PangoAttrFontFeatures *fattr = (const PangoAttrFontFeatures *) tmp_attrs->data;
+        {
+         PangoAttribute *attr = tmp_attrs->data;
+         if (attr->klass->type == PANGO_ATTR_FONT_FEATURES)
+           {
+             PangoAttrFontFeatures *fattr = (PangoAttrFontFeatures *) attr;
              const gchar *feat;
              const gchar *end;
              int len;
@@ -451,23 +452,26 @@ _pango_fc_shape (PangoFont           *font,
              feat = fattr->features;
 
              while (feat != NULL && num_features < G_N_ELEMENTS (features))
-               {
-                 end = strchr (feat, ',');
-                 if (end)
-                   len = end - feat;
-                 else
-                   len = -1;
-
-                 if (hb_feature_from_string (feat, len, &features[num_features]))
-                   num_features++;
-
-                 if (end == NULL)
-                   break;
-
-                 feat = end + 1;
-               }
-          }
-       }
+                {
+                  end = strchr (feat, ',');
+                  if (end)
+                    len = end - feat;
+                  else
+                    len = -1;
+                  if (hb_feature_from_string (feat, len, &features[num_features]))
+                    {
+                      features[num_features].start = attr->start_index;
+                      features[num_features].end = attr->end_index;
+                      num_features++;
+                    }
+                    
+                  if (end == NULL)
+                    break;
+
+                  feat = end + 1;
+                }
+            }
+        }
     }
 
   hb_shape (hb_font, hb_buffer, features, num_features);


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