summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-06-03 20:23:49 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-06-03 20:23:49 +0000
commite79b37d413ae5bad8cbb813f4720fb0a38bb94d0 (patch)
tree914fab28430b2c0e3603c41f09eefe011389efa9 /pango
parent99d528b55a30bb0b260afd572b6db599ef85b1aa (diff)
downloadpango-e79b37d413ae5bad8cbb813f4720fb0a38bb94d0.tar.gz
Rename pango_ot_ruleset_get_for() to
2007-06-03 Behdad Esfahbod <behdad@gnome.org> * 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
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-ot-ruleset.c92
-rw-r--r--pango/pango-ot.h6
-rw-r--r--pango/pangoft2.def3
3 files changed, 70 insertions, 31 deletions
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),
@@ -288,6 +269,61 @@ pango_ot_ruleset_new_for (PangoOTInfo *info,
}
/**
+ * 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.
* @table_type: the table type to add a feature to.
@@ -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