diff options
-rw-r--r-- | docs/pango-sections.txt | 1 | ||||
-rw-r--r-- | docs/tmpl/opentype.sgml | 11 | ||||
-rw-r--r-- | pango/pango-ot-private.h | 2 | ||||
-rw-r--r-- | pango/pango-ot-ruleset.c | 30 | ||||
-rw-r--r-- | pango/pango-ot.h | 3 | ||||
-rw-r--r-- | pango/pangoft2.def | 1 |
6 files changed, 48 insertions, 0 deletions
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt index 75906ed3..fa57140a 100644 --- a/docs/pango-sections.txt +++ b/docs/pango-sections.txt @@ -970,6 +970,7 @@ pango_ot_ruleset_new_for pango_ot_ruleset_add_feature pango_ot_ruleset_maybe_add_feature pango_ot_ruleset_maybe_add_features +pango_ot_ruleset_get_feature_count pango_ot_ruleset_substitute pango_ot_ruleset_position pango_ot_ruleset_description_copy diff --git a/docs/tmpl/opentype.sgml b/docs/tmpl/opentype.sgml index f5a61930..3b6aa4df 100644 --- a/docs/tmpl/opentype.sgml +++ b/docs/tmpl/opentype.sgml @@ -413,6 +413,17 @@ is not found. @Returns: +<!-- ##### FUNCTION pango_ot_ruleset_get_feature_count ##### --> +<para> + +</para> + +@ruleset: +@n_gsub_features: +@n_gpos_features: +@Returns: + + <!-- ##### FUNCTION pango_ot_ruleset_substitute ##### --> <para> diff --git a/pango/pango-ot-private.h b/pango/pango-ot-private.h index 089c57c9..3705ae8e 100644 --- a/pango/pango-ot-private.h +++ b/pango/pango-ot-private.h @@ -72,6 +72,8 @@ struct _PangoOTRuleset GArray *rules; PangoOTInfo *info; + /* the index into these arrays is a PangoOTTableType */ + guint n_features[2]; guint script_index[2]; guint language_index[2]; }; diff --git a/pango/pango-ot-ruleset.c b/pango/pango-ot-ruleset.c index 7296fa90..6dd60377 100644 --- a/pango/pango-ot-ruleset.c +++ b/pango/pango-ot-ruleset.c @@ -317,6 +317,8 @@ pango_ot_ruleset_add_feature (PangoOTRuleset *ruleset, tmp_rule.property_bit = property_bit; g_array_append_val (ruleset->rules, tmp_rule); + + ruleset->n_features[table_type]++; } /** @@ -413,6 +415,34 @@ pango_ot_ruleset_maybe_add_features (PangoOTRuleset *ruleset, } /** + * pango_ot_ruleset_get_feature_count: + * @ruleset: a #PangoOTRuleset. + * @n_gsub_features: location to store number of GSUB features, or %NULL. + * @n_gpos_features: location to store number of GPOS features, or %NULL. + * + * Gets the number of GSUB and GPOS features in the ruleset. + * + * Return value: Total number of features in the @ruleset. + * + * Since: 1.18 + **/ +guint +pango_ot_ruleset_get_feature_count (const PangoOTRuleset *ruleset, + guint *n_gsub_features, + guint *n_gpos_features) +{ + g_return_val_if_fail (PANGO_IS_OT_RULESET (ruleset), 0); + + if (n_gsub_features) + *n_gsub_features = ruleset->n_features[PANGO_OT_TABLE_GSUB]; + + if (n_gpos_features) + *n_gpos_features = ruleset->n_features[PANGO_OT_TABLE_GPOS]; + + return ruleset->n_features[PANGO_OT_TABLE_GSUB] + ruleset->n_features[PANGO_OT_TABLE_GPOS]; +} + +/** * pango_ot_ruleset_substitute: * @ruleset: a #PangoOTRuleset. * @buffer: a #PangoOTBuffer. diff --git a/pango/pango-ot.h b/pango/pango-ot.h index 1be9d2c3..e1ea45e1 100644 --- a/pango/pango-ot.h +++ b/pango/pango-ot.h @@ -152,6 +152,9 @@ guint pango_ot_ruleset_maybe_add_features (PangoOTRuleset *ru PangoOTTableType table_type, const PangoOTFeatureMap *features, guint n_features); +guint pango_ot_ruleset_get_feature_count (const PangoOTRuleset *ruleset, + guint *n_gsub_features, + guint *n_gpos_features); void pango_ot_ruleset_substitute (const PangoOTRuleset *ruleset, PangoOTBuffer *buffer); void pango_ot_ruleset_position (const PangoOTRuleset *ruleset, diff --git a/pango/pangoft2.def b/pango/pangoft2.def index 23aeb1ed..50e625d8 100644 --- a/pango/pangoft2.def +++ b/pango/pangoft2.def @@ -62,6 +62,7 @@ EXPORTS pango_ot_ruleset_description_equal pango_ot_ruleset_description_free pango_ot_ruleset_description_hash + pango_ot_ruleset_get_feature_count pango_ot_ruleset_get_for pango_ot_ruleset_get_type pango_ot_ruleset_maybe_add_feature |