summaryrefslogtreecommitdiff
path: root/pango/shape.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/shape.c')
-rw-r--r--pango/shape.c75
1 files changed, 5 insertions, 70 deletions
diff --git a/pango/shape.c b/pango/shape.c
index 52a7aabb..02f0f059 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 <hb-ot.h>
@@ -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)
{
@@ -309,16 +244,17 @@ static PangoTextTransform
find_text_transform (const PangoAnalysis *analysis)
{
GSList *l;
+ PangoTextTransform transform = PANGO_TEXT_TRANSFORM_NONE;
for (l = analysis->extra_attrs; l; l = l->next)
{
PangoAttribute *attr = l->data;
if (attr->klass->type == PANGO_ATTR_TEXT_TRANSFORM)
- return (PangoTextTransform) ((PangoAttrInt*)attr)->value;
+ transform = (PangoTextTransform) ((PangoAttrInt*)attr)->value;
}
- return PANGO_TEXT_TRANSFORM_NONE;
+ return transform;
}
static gboolean
@@ -506,8 +442,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);