From e79b37d413ae5bad8cbb813f4720fb0a38bb94d0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 3 Jun 2007 20:23:49 +0000 Subject: Rename pango_ot_ruleset_get_for() to 2007-06-03 Behdad Esfahbod * docs/pango-sections.txt: * docs/tmpl/opentype.sgml: * modules/arabic/arabic-fc.c (arabic_engine_shape): * modules/basic/basic-fc.c (basic_engine_shape): * modules/hebrew/hebrew-fc.c (hebrew_engine_shape): * modules/indic/indic-fc.c (indic_engine_shape): * modules/khmer/khmer-fc.c (khmer_engine_shape): * modules/syriac/syriac-fc.c (syriac_engine_shape): * modules/thai/thai-fc.c (thai_engine_shape): * modules/tibetan/tibetan-fc.c (tibetan_engine_shape): * pango/pango-ot-ruleset.c (pango_ot_ruleset_get_for_description), (pango_ot_ruleset_new_from_description): * pango/pango-ot.h: * pango/pangoft2.def: Rename pango_ot_ruleset_get_for() to pango_ot_ruleset_get_for_description(). New engine API: pango_ot_ruleset_new_from_description(). svn path=/trunk/; revision=2328 --- pango/pango-ot-ruleset.c | 92 +++++++++++++++++++++++++++++++++--------------- pango/pango-ot.h | 6 ++-- pango/pangoft2.def | 3 +- 3 files changed, 70 insertions(+), 31 deletions(-) (limited to 'pango') diff --git a/pango/pango-ot-ruleset.c b/pango/pango-ot-ruleset.c index 6dd60377..f0949387 100644 --- a/pango/pango-ot-ruleset.c +++ b/pango/pango-ot-ruleset.c @@ -95,12 +95,14 @@ pango_ot_ruleset_finalize (GObject *object) } /** - * pango_ot_ruleset_get_for: + * pango_ot_ruleset_get_for_description: * @info: a #PangoOTInfo. * @desc: a #PangoOTRulesetDescription. * * Returns a ruleset for the given OpenType info and ruleset - * description. The returned ruleset should not be modified. + * description. Rulesets are created on demand using + * pango_ot_ruleset_new_from_description(). + * The returned ruleset should not be modified or destroyed. * * The static feature map members of @desc should be alive as * long as @info is. @@ -111,8 +113,8 @@ pango_ot_ruleset_finalize (GObject *object) * Since: 1.18 **/ const PangoOTRuleset * -pango_ot_ruleset_get_for (PangoOTInfo *info, - const PangoOTRulesetDescription *desc) +pango_ot_ruleset_get_for_description (PangoOTInfo *info, + const PangoOTRulesetDescription *desc) { PangoOTRuleset *ruleset; static GQuark rulesets_quark = 0; @@ -140,28 +142,7 @@ pango_ot_ruleset_get_for (PangoOTInfo *info, if (!ruleset) { - ruleset = pango_ot_ruleset_new_for (info, - desc->script, - desc->language); - - if (desc->n_static_gsub_features) - pango_ot_ruleset_maybe_add_features (ruleset, PANGO_OT_TABLE_GSUB, - desc->static_gsub_features, - desc->n_static_gsub_features); - if (desc->n_static_gpos_features) - pango_ot_ruleset_maybe_add_features (ruleset, PANGO_OT_TABLE_GPOS, - desc->static_gpos_features, - desc->n_static_gpos_features); - - if (desc->n_other_features) - { - pango_ot_ruleset_maybe_add_features (ruleset, PANGO_OT_TABLE_GSUB, - desc->other_features, - desc->n_other_features); - pango_ot_ruleset_maybe_add_features (ruleset, PANGO_OT_TABLE_GPOS, - desc->other_features, - desc->n_other_features); - } + ruleset = pango_ot_ruleset_new_from_description (info, desc); g_hash_table_insert (rulesets, pango_ot_ruleset_description_copy (desc), @@ -287,6 +268,61 @@ pango_ot_ruleset_new_for (PangoOTInfo *info, return ruleset; } +/** + * pango_ot_ruleset_new_from_description: + * @info: a #PangoOTInfo. + * @desc: a #PangoOTRulesetDescription. + * + * Creates a new #PangoOTRuleset for the given OpenType infor and + * matching the given ruleset description. + * + * This is a convenience function that calls pango_ot_ruleset_new_for() and + * adds the static GSUB/GPOS features to the resulting ruleset, followed by + * adding other features to both GSUB and GPOS. + * + * The static feature map members of @desc should be alive as + * long as @info is. + * + * Return value: the newly allocated #PangoOTRuleset, which + * should be freed with g_object_unref(). + * + * Since: 1.18 + **/ +PangoOTRuleset * +pango_ot_ruleset_new_from_description (PangoOTInfo *info, + const PangoOTRulesetDescription *desc) +{ + PangoOTRuleset *ruleset; + + g_return_val_if_fail (info != NULL, NULL); + g_return_val_if_fail (desc != NULL, NULL); + + ruleset = pango_ot_ruleset_new_for (info, + desc->script, + desc->language); + + if (desc->n_static_gsub_features) + pango_ot_ruleset_maybe_add_features (ruleset, PANGO_OT_TABLE_GSUB, + desc->static_gsub_features, + desc->n_static_gsub_features); + if (desc->n_static_gpos_features) + pango_ot_ruleset_maybe_add_features (ruleset, PANGO_OT_TABLE_GPOS, + desc->static_gpos_features, + desc->n_static_gpos_features); + + if (desc->n_other_features) + { + pango_ot_ruleset_maybe_add_features (ruleset, PANGO_OT_TABLE_GSUB, + desc->other_features, + desc->n_other_features); + pango_ot_ruleset_maybe_add_features (ruleset, PANGO_OT_TABLE_GPOS, + desc->other_features, + desc->n_other_features); + } + + return ruleset; +} + /** * pango_ot_ruleset_add_feature: * @ruleset: a #PangoOTRuleset. @@ -627,8 +663,8 @@ pango_ot_ruleset_description_equal (const PangoOTRulesetDescription *desc1, * * Creates a copy of @desc, which should be freed with * pango_ot_ruleset_description_free(). Primarily used internally - * by pango_ot_ruleset_get_for() to cache rulesets for ruleset - * descriptions. + * by pango_ot_ruleset_get_for_description() to cache rulesets for + * ruleset descriptions. * * Return value: the newly allocated #PangoOTRulesetDescription, which * should be freed with pango_ot_ruleset_description_free(). diff --git a/pango/pango-ot.h b/pango/pango-ot.h index e1ea45e1..60d2a55c 100644 --- a/pango/pango-ot.h +++ b/pango/pango-ot.h @@ -134,12 +134,14 @@ void pango_ot_buffer_output (const PangoOTBuffer *buffer, void pango_ot_buffer_set_zero_width_marks (PangoOTBuffer *buffer, gboolean zero_width_marks); -const PangoOTRuleset *pango_ot_ruleset_get_for (PangoOTInfo *info, - const PangoOTRulesetDescription *desc); +const PangoOTRuleset *pango_ot_ruleset_get_for_description (PangoOTInfo *info, + const PangoOTRulesetDescription *desc); PangoOTRuleset *pango_ot_ruleset_new (PangoOTInfo *info); PangoOTRuleset *pango_ot_ruleset_new_for (PangoOTInfo *info, PangoScript script, PangoLanguage *language); +PangoOTRuleset *pango_ot_ruleset_new_from_description (PangoOTInfo *info, + const PangoOTRulesetDescription *desc); void pango_ot_ruleset_add_feature (PangoOTRuleset *ruleset, PangoOTTableType table_type, guint feature_index, diff --git a/pango/pangoft2.def b/pango/pangoft2.def index 50e625d8..79165939 100644 --- a/pango/pangoft2.def +++ b/pango/pangoft2.def @@ -63,12 +63,13 @@ EXPORTS 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_for_description pango_ot_ruleset_get_type pango_ot_ruleset_maybe_add_feature pango_ot_ruleset_maybe_add_features pango_ot_ruleset_new pango_ot_ruleset_new_for + pango_ot_ruleset_new_from_description pango_ot_ruleset_position pango_ot_ruleset_substitute pango_ot_tag_from_language -- cgit v1.2.1