From 9307a8c38a55056147b931c429d60409cb4bd779 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 11 Jul 2019 15:06:51 -0400 Subject: 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); -- cgit v1.2.1