From fcb44cf2fb2ef013d03e968011ceb9b2f4eaf687 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 6 Nov 2021 20:51:45 -0400 Subject: shape: Use the new helper --- pango/shape.c | 70 ++--------------------------------------------------------- 1 file changed, 2 insertions(+), 68 deletions(-) diff --git a/pango/shape.c b/pango/shape.c index 52a7aabb..ef8fe874 100644 --- a/pango/shape.c +++ b/pango/shape.c @@ -28,6 +28,7 @@ #include "pango-impl-utils.h" #include "pango-glyph.h" +#include "pango-item-private.h" #include "pango-font-private.h" #include @@ -222,72 +223,6 @@ pango_font_get_hb_font_for_context (PangoFont *font, /* }}} */ /* {{{ Utilities */ -static void -apply_extra_attributes (GSList *attrs, - hb_feature_t *features, - guint length, - guint *num_features) -{ - GSList *l; - - for (l = attrs; l && *num_features < length; l = l->next) - { - PangoAttribute *attr = l->data; - if (attr->klass->type == PANGO_ATTR_FONT_FEATURES) - { - PangoAttrFontFeatures *fattr = (PangoAttrFontFeatures *) attr; - const gchar *feat; - const gchar *end; - int len; - - feat = fattr->features; - - while (feat != NULL && *num_features < length) - { - 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; - } - } - } - - /* 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)++; - } - } - } -} - static PangoShowFlags find_show_flags (const PangoAnalysis *analysis) { @@ -506,8 +441,7 @@ pango_hb_shape (const char *item_text, hb_buffer_add (hb_buffer, '-', hyphen_index); } - pango_font_get_features (analysis->font, features, G_N_ELEMENTS (features), &num_features); - apply_extra_attributes (analysis->extra_attrs, features, G_N_ELEMENTS (features), &num_features); + pango_analysis_collect_features (analysis, features, G_N_ELEMENTS (features), &num_features); hb_shape (hb_font, hb_buffer, features, num_features); -- cgit v1.2.1