summaryrefslogtreecommitdiff
path: root/pango/pango-ot-info.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-05-04 20:21:57 -0400
committerBehdad Esfahbod <behdad@behdad.org>2009-05-05 00:47:44 -0400
commit0bb5d464baab47bb7b6e9852a5c7932bdb2df018 (patch)
tree76769d89f21d5140d88416db064c6c2e2700f556 /pango/pango-ot-info.c
parent644d9208ce6f916d702d41f35c3bd3f87552fa7b (diff)
downloadpango-0bb5d464baab47bb7b6e9852a5c7932bdb2df018.tar.gz
[GSUB] Hook new GSUB up in Pango
Diffstat (limited to 'pango/pango-ot-info.c')
-rw-r--r--pango/pango-ot-info.c65
1 files changed, 37 insertions, 28 deletions
diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c
index b1a5dfdb..fbd03772 100644
--- a/pango/pango-ot-info.c
+++ b/pango/pango-ot-info.c
@@ -83,11 +83,6 @@ pango_ot_info_finalize (GObject *object)
if (info->layout)
hb_ot_layout_destroy (info->layout);
- if (info->gsub)
- {
- HB_Done_GSUB_Table (info->gsub);
- info->gsub = NULL;
- }
if (info->gpos)
{
HB_Done_GPOS_Table (info->gpos);
@@ -290,29 +285,6 @@ synthesize_class_def (PangoOTInfo *info)
FT_Set_Charmap (info->face, old_charmap);
}
-HB_GSUB
-pango_ot_info_get_gsub (PangoOTInfo *info)
-{
- g_return_val_if_fail (PANGO_IS_OT_INFO (info), NULL);
-
- if (!(info->loaded & INFO_LOADED_GSUB))
- {
- HB_Error error;
-
- info->loaded |= INFO_LOADED_GSUB;
-
- if (FT_IS_SFNT (info->face))
- {
- error = HB_Load_GSUB_Table (info->face, &info->gsub, _pango_ot_info_get_layout (info));
-
- if (error && error != HB_Err_Not_Covered)
- g_warning ("Error loading GSUB table 0x%04X", error);
- }
- }
-
- return info->gsub;
-}
-
HB_GPOS
pango_ot_info_get_gpos (PangoOTInfo *info)
{
@@ -573,3 +545,40 @@ pango_ot_info_list_features (PangoOTInfo *info,
return result;
}
+
+void
+_pango_ot_info_substitute (const PangoOTInfo *info,
+ const PangoOTRuleset *ruleset,
+ PangoOTBuffer *buffer)
+{
+ unsigned int i;
+
+ for (i = 0; i < ruleset->rules->len; i++)
+ {
+ PangoOTRule *rule = &g_array_index (ruleset->rules, PangoOTRule, i);
+ hb_ot_layout_feature_mask_t mask;
+ unsigned int lookup_count, j;
+
+ if (rule->table_type != PANGO_OT_TABLE_GSUB)
+ continue;
+
+ mask = rule->property_bit;
+ lookup_count = hb_ot_layout_feature_get_lookup_count (info->layout,
+ HB_OT_LAYOUT_TABLE_TYPE_GSUB,
+ rule->feature_index);
+
+ for (j = 0; j < lookup_count; j++)
+ {
+ unsigned int lookup_index;
+
+ lookup_index = hb_ot_layout_feature_get_lookup_index (info->layout,
+ HB_OT_LAYOUT_TABLE_TYPE_GSUB,
+ rule->feature_index,
+ j);
+ hb_ot_layout_substitute_lookup (info->layout,
+ buffer->buffer,
+ lookup_index,
+ rule->property_bit);
+ }
+ }
+}