summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-07-11 15:06:51 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-07-11 15:25:39 -0400
commit9307a8c38a55056147b931c429d60409cb4bd779 (patch)
treec3107b142a421d660c0a83f47ef338a091b55652
parent3af161ea86f4f543ba7a6bb16f83595b980e5d04 (diff)
downloadpango-9307a8c38a55056147b931c429d60409cb4bd779.tar.gz
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.
-rw-r--r--pango/pangofc-shape.c46
1 files 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);