summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pango/pango-ot-buffer.c84
-rw-r--r--pango/pango-ot-info.c22
-rw-r--r--pango/pango-ot-private.h33
-rw-r--r--pango/pango-ot-ruleset.c251
-rw-r--r--pango/pango-ot-tag.c521
-rw-r--r--pango/pango-ot.h45
-rw-r--r--pango/pangofc-font.c2
7 files changed, 70 insertions, 888 deletions
diff --git a/pango/pango-ot-buffer.c b/pango/pango-ot-buffer.c
index f306aa10..f527263d 100644
--- a/pango/pango-ot-buffer.c
+++ b/pango/pango-ot-buffer.c
@@ -22,57 +22,6 @@
#include "config.h"
#include "pango-ot-private.h"
-#include "pangofc-private.h"
-#include "pango-impl-utils.h"
-
-/* cache a single hb_buffer_t */
-static hb_buffer_t *cached_buffer = NULL;
-G_LOCK_DEFINE_STATIC (cached_buffer);
-
-static hb_buffer_t *
-create_buffer (void)
-{
- hb_buffer_t *buffer;
-
- buffer = hb_buffer_create ();
- hb_buffer_set_unicode_funcs (buffer, hb_glib_get_unicode_funcs ());
-
- return buffer;
-}
-
-static hb_buffer_t *
-acquire_buffer (gboolean *free_buffer)
-{
- hb_buffer_t *buffer;
-
- if (G_LIKELY (G_TRYLOCK (cached_buffer)))
- {
- if (G_UNLIKELY (!cached_buffer))
- cached_buffer = create_buffer ();
-
- buffer = cached_buffer;
- *free_buffer = FALSE;
- }
- else
- {
- buffer = create_buffer ();
- *free_buffer = TRUE;
- }
-
- return buffer;
-}
-
-static void
-release_buffer (hb_buffer_t *buffer, gboolean free_buffer)
-{
- if (G_LIKELY (!free_buffer))
- {
- hb_buffer_reset (buffer);
- G_UNLOCK (cached_buffer);
- }
- else
- hb_buffer_destroy (buffer);
-}
/**
* pango_ot_buffer_new
@@ -90,11 +39,8 @@ pango_ot_buffer_new (PangoFcFont *font)
{
PangoOTBuffer *buffer = g_slice_new (PangoOTBuffer);
- buffer->buffer = acquire_buffer (&buffer->should_free_hb_buffer);
- buffer->font = g_object_ref (font);
- buffer->applied_gpos = FALSE;
- buffer->rtl = FALSE;
- buffer->zero_width_marks = FALSE;
+ buffer->buffer = hb_buffer_create ();
+ hb_buffer_set_unicode_funcs (buffer->buffer, hb_glib_get_unicode_funcs ());
return buffer;
}
@@ -110,8 +56,7 @@ pango_ot_buffer_new (PangoFcFont *font)
void
pango_ot_buffer_destroy (PangoOTBuffer *buffer)
{
- release_buffer (buffer->buffer, buffer->should_free_hb_buffer);
- g_object_unref (buffer->font);
+ hb_buffer_destroy (buffer->buffer);
g_slice_free (PangoOTBuffer, buffer);
}
@@ -127,7 +72,6 @@ void
pango_ot_buffer_clear (PangoOTBuffer *buffer)
{
hb_buffer_reset (buffer->buffer);
- buffer->applied_gpos = FALSE;
}
/**
@@ -165,9 +109,7 @@ void
pango_ot_buffer_set_rtl (PangoOTBuffer *buffer,
gboolean rtl)
{
- buffer->rtl = rtl != FALSE;
- hb_buffer_set_direction (buffer->buffer,
- buffer->rtl ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
+ hb_buffer_set_direction (buffer->buffer, rtl ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
}
/**
@@ -187,7 +129,6 @@ void
pango_ot_buffer_set_zero_width_marks (PangoOTBuffer *buffer,
gboolean zero_width_marks)
{
- buffer->zero_width_marks = zero_width_marks != FALSE;
}
/**
@@ -234,10 +175,12 @@ pango_ot_buffer_output (const PangoOTBuffer *buffer,
unsigned int num_glyphs;
hb_buffer_t *hb_buffer = buffer->buffer;
- gboolean is_hinted = buffer->font->is_hinted;
hb_glyph_info_t *hb_glyph;
hb_glyph_position_t *hb_position;
+ if (HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer->buffer)))
+ hb_buffer_reverse (buffer->buffer);
+
/* Copy glyphs into output glyph string */
num_glyphs = hb_buffer_get_length (hb_buffer);
hb_glyph = hb_buffer_get_glyph_infos (hb_buffer, NULL);
@@ -246,17 +189,12 @@ pango_ot_buffer_output (const PangoOTBuffer *buffer,
last_cluster = -1;
for (i = 0; i < num_glyphs; i++)
{
- int advance;
-
glyphs->glyphs[i].glyph = hb_glyph->codepoint;
glyphs->log_clusters[i] = hb_glyph->cluster;
glyphs->glyphs[i].attr.is_cluster_start = glyphs->log_clusters[i] != last_cluster;
last_cluster = glyphs->log_clusters[i];
- advance = hb_position->x_advance;
- if (is_hinted)
- advance = PANGO_UNITS_ROUND (advance);
- glyphs->glyphs[i].geometry.width = advance;
+ glyphs->glyphs[i].geometry.width = hb_position->x_advance;
glyphs->glyphs[i].geometry.x_offset = hb_position->x_offset;
glyphs->glyphs[i].geometry.y_offset = hb_position->y_offset;
@@ -264,8 +202,6 @@ pango_ot_buffer_output (const PangoOTBuffer *buffer,
hb_position++;
}
- if (buffer->rtl)
- pango_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs);
- if (!buffer->applied_gpos)
- pango_fc_font_kern_glyphs (buffer->font, glyphs);
+ if (HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer->buffer)))
+ hb_buffer_reverse (buffer->buffer);
}
diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c
index 8e497b7d..cd1778df 100644
--- a/pango/pango-ot-info.c
+++ b/pango/pango-ot-info.c
@@ -95,12 +95,6 @@ pango_ot_info_get (FT_Face face)
return info;
}
-hb_face_t *
-_pango_ot_info_get_hb_face (PangoOTInfo *info)
-{
- return info->hb_face;
-}
-
static hb_tag_t
get_hb_table_type (PangoOTTableType table_type)
{
@@ -318,19 +312,3 @@ pango_ot_info_list_features (PangoOTInfo *info,
return result;
}
-
-void
-_pango_ot_info_substitute (const PangoOTInfo *info,
- const PangoOTRuleset *ruleset,
- PangoOTBuffer *buffer)
-{
- /* Deprecated. */
-}
-
-void
-_pango_ot_info_position (const PangoOTInfo *info,
- const PangoOTRuleset *ruleset,
- PangoOTBuffer *buffer)
-{
- /* Deprecated. */
-}
diff --git a/pango/pango-ot-private.h b/pango/pango-ot-private.h
index 1911512e..81ae7e84 100644
--- a/pango/pango-ot-private.h
+++ b/pango/pango-ot-private.h
@@ -39,10 +39,7 @@ struct _PangoOTInfo
{
GObject parent_instance;
- guint loaded;
-
FT_Face face;
-
hb_face_t *hb_face;
};
@@ -52,28 +49,11 @@ struct _PangoOTInfoClass
};
-typedef struct _PangoOTRule PangoOTRule;
-
-struct _PangoOTRule
-{
- gulong property_bit;
- guint feature_index;
- guint table_type : 1;
-};
-
typedef struct _PangoOTRulesetClass PangoOTRulesetClass;
struct _PangoOTRuleset
{
GObject parent_instance;
-
- GArray *rules;
- PangoOTInfo *info;
-
- /* the index into these arrays is a PangoOTTableType */
- guint n_features[2];
- guint script_index[2];
- guint language_index[2];
};
struct _PangoOTRulesetClass
@@ -84,21 +64,8 @@ struct _PangoOTRulesetClass
struct _PangoOTBuffer
{
hb_buffer_t *buffer;
- gboolean should_free_hb_buffer;
- PangoFcFont *font;
- guint rtl : 1;
- guint zero_width_marks : 1;
- guint applied_gpos : 1;
};
-hb_face_t *_pango_ot_info_get_hb_face (PangoOTInfo *info);
-void _pango_ot_info_substitute (const PangoOTInfo *info,
- const PangoOTRuleset *ruleset,
- PangoOTBuffer *buffer);
-void _pango_ot_info_position (const PangoOTInfo *info,
- const PangoOTRuleset *ruleset,
- PangoOTBuffer *buffer);
-
G_END_DECLS
#endif /* __PANGO_OT_PRIVATE_H__ */
diff --git a/pango/pango-ot-ruleset.c b/pango/pango-ot-ruleset.c
index 82f82108..473647bb 100644
--- a/pango/pango-ot-ruleset.c
+++ b/pango/pango-ot-ruleset.c
@@ -22,7 +22,6 @@
#include "config.h"
#include "pango-ot-private.h"
-#include "pango-impl-utils.h"
static void pango_ot_ruleset_finalize (GObject *object);
@@ -39,22 +38,11 @@ pango_ot_ruleset_class_init (PangoOTRulesetClass *klass)
static void
pango_ot_ruleset_init (PangoOTRuleset *ruleset)
{
- ruleset->rules = g_array_new (FALSE, FALSE, sizeof (PangoOTRule));
- ruleset->script_index[0] = PANGO_OT_NO_SCRIPT;
- ruleset->script_index[1] = PANGO_OT_NO_SCRIPT;
- ruleset->language_index[0] = PANGO_OT_DEFAULT_LANGUAGE;
- ruleset->language_index[1] = PANGO_OT_DEFAULT_LANGUAGE;
}
static void
pango_ot_ruleset_finalize (GObject *object)
{
- PangoOTRuleset *ruleset = PANGO_OT_RULESET (object);
-
- g_array_free (ruleset->rules, TRUE);
- if (ruleset->info)
- g_object_remove_weak_pointer (G_OBJECT (ruleset->info), (gpointer *)(void *)&ruleset->info);
-
G_OBJECT_CLASS (pango_ot_ruleset_parent_class)->finalize (object);
}
@@ -80,38 +68,10 @@ const PangoOTRuleset *
pango_ot_ruleset_get_for_description (PangoOTInfo *info,
const PangoOTRulesetDescription *desc)
{
- PangoOTRuleset *ruleset;
- static GQuark rulesets_quark = 0;
- GHashTable *rulesets;
-
- g_return_val_if_fail (info != NULL, NULL);
- g_return_val_if_fail (desc != NULL, NULL);
-
- if (!rulesets_quark)
- rulesets_quark = g_quark_from_string ("pango-info-rulesets");
-
- rulesets = g_object_get_qdata (G_OBJECT (info), rulesets_quark);
-
- if (!rulesets)
- {
- rulesets = g_hash_table_new_full ((GHashFunc) pango_ot_ruleset_description_hash,
- (GEqualFunc) pango_ot_ruleset_description_equal,
- (GDestroyNotify) pango_ot_ruleset_description_free,
- (GDestroyNotify) g_object_unref);
-
- g_object_set_qdata_full (G_OBJECT (info), rulesets_quark, rulesets, (GDestroyNotify) g_hash_table_destroy);
- }
-
- ruleset = g_hash_table_lookup (rulesets, desc);
+ static PangoOTRuleset *ruleset;
if (!ruleset)
- {
- ruleset = pango_ot_ruleset_new_from_description (info, desc);
-
- g_hash_table_insert (rulesets,
- pango_ot_ruleset_description_copy (desc),
- ruleset);
- }
+ ruleset = g_object_new (PANGO_TYPE_OT_RULESET, NULL);
return ruleset;
}
@@ -128,16 +88,7 @@ pango_ot_ruleset_get_for_description (PangoOTInfo *info,
PangoOTRuleset *
pango_ot_ruleset_new (PangoOTInfo *info)
{
- PangoOTRuleset *ruleset;
-
- g_return_val_if_fail (PANGO_IS_OT_INFO (info), NULL);
-
- ruleset = g_object_new (PANGO_TYPE_OT_RULESET, NULL);
-
- ruleset->info = info;
- g_object_add_weak_pointer (G_OBJECT (ruleset->info), (gpointer *)(void*)&ruleset->info);
-
- return ruleset;
+ return g_object_new (PANGO_TYPE_OT_RULESET, NULL);
}
/**
@@ -195,36 +146,7 @@ pango_ot_ruleset_new_for (PangoOTInfo *info,
PangoScript script,
PangoLanguage *language)
{
- PangoOTRuleset *ruleset;
- PangoOTTag script_tag, language_tag;
- PangoOTTableType table_type;
-
- g_return_val_if_fail (PANGO_IS_OT_INFO (info), NULL);
-
- ruleset = pango_ot_ruleset_new (info);
-
- script_tag = pango_ot_tag_from_script (script);
- language_tag = pango_ot_tag_from_language (language);
-
- for (table_type = PANGO_OT_TABLE_GSUB; table_type <= PANGO_OT_TABLE_GPOS; table_type++)
- {
- guint script_index, language_index, feature_index;
-
- pango_ot_info_find_script (ruleset->info, table_type,
- script_tag, &script_index);
- pango_ot_info_find_language (ruleset->info, table_type, script_index,
- language_tag, &language_index,
- &feature_index);
-
- ruleset->script_index[table_type] = script_index;
- ruleset->language_index[table_type] = language_index;
-
- /* add required feature of the language */
- pango_ot_ruleset_add_feature (ruleset, table_type,
- feature_index, PANGO_OT_ALL_GLYPHS);
- }
-
- return ruleset;
+ return g_object_new (PANGO_TYPE_OT_RULESET, NULL);
}
/**
@@ -251,35 +173,7 @@ 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;
+ return g_object_new (PANGO_TYPE_OT_RULESET, NULL);
}
/**
@@ -299,21 +193,6 @@ pango_ot_ruleset_add_feature (PangoOTRuleset *ruleset,
guint feature_index,
gulong property_bit)
{
- PangoOTRule tmp_rule;
-
- g_return_if_fail (PANGO_IS_OT_RULESET (ruleset));
- g_return_if_fail (ruleset->info != NULL);
-
- if (feature_index == PANGO_OT_NO_FEATURE)
- return;
-
- tmp_rule.table_type = table_type;
- tmp_rule.feature_index = feature_index;
- tmp_rule.property_bit = property_bit;
-
- g_array_append_val (ruleset->rules, tmp_rule);
-
- ruleset->n_features[table_type]++;
}
/**
@@ -344,24 +223,6 @@ pango_ot_ruleset_maybe_add_feature (PangoOTRuleset *ruleset,
PangoOTTag feature_tag,
gulong property_bit)
{
- guint feature_index;
-
- g_return_val_if_fail (PANGO_IS_OT_RULESET (ruleset), FALSE);
- g_return_val_if_fail (ruleset->info != NULL, FALSE);
-
- pango_ot_info_find_feature (ruleset->info, table_type,
- feature_tag,
- ruleset->script_index[table_type],
- ruleset->language_index[table_type],
- &feature_index);
-
- if (feature_index != PANGO_OT_NO_FEATURE)
- {
- pango_ot_ruleset_add_feature (ruleset, table_type,
- feature_index, property_bit);
- return TRUE;
- }
-
return FALSE;
}
@@ -388,25 +249,7 @@ pango_ot_ruleset_maybe_add_features (PangoOTRuleset *ruleset,
const PangoOTFeatureMap *features,
guint n_features)
{
- guint i, n_found_features = 0;
-
- g_return_val_if_fail (PANGO_IS_OT_RULESET (ruleset), 0);
- g_return_val_if_fail (ruleset->info != NULL, 0);
-
- for (i = 0; i < n_features; i++)
- {
- PangoOTTag feature_tag = PANGO_OT_TAG_MAKE (features[i].feature_name[0],
- features[i].feature_name[1],
- features[i].feature_name[2],
- features[i].feature_name[3]);
-
- n_found_features += pango_ot_ruleset_maybe_add_feature (ruleset,
- table_type,
- feature_tag,
- features[i].property_bit);
- }
-
- return n_found_features;
+ return 0;
}
/**
@@ -426,15 +269,7 @@ 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];
+ return 0;
}
/**
@@ -451,12 +286,6 @@ void
pango_ot_ruleset_substitute (const PangoOTRuleset *ruleset,
PangoOTBuffer *buffer)
{
- g_return_if_fail (PANGO_IS_OT_RULESET (ruleset));
- g_return_if_fail (ruleset->info != NULL);
-
- _pango_ot_info_substitute (ruleset->info,
- ruleset,
- buffer);
}
/**
@@ -473,12 +302,6 @@ void
pango_ot_ruleset_position (const PangoOTRuleset *ruleset,
PangoOTBuffer *buffer)
{
- g_return_if_fail (PANGO_IS_OT_RULESET (ruleset));
- g_return_if_fail (ruleset->info != NULL);
-
- _pango_ot_info_position (ruleset->info,
- ruleset,
- buffer);
}
@@ -498,26 +321,7 @@ pango_ot_ruleset_position (const PangoOTRuleset *ruleset,
guint
pango_ot_ruleset_description_hash (const PangoOTRulesetDescription *desc)
{
- guint hash = 0;
- guint i;
-
- hash ^= desc->script;
- hash ^= GPOINTER_TO_UINT (desc->language);
-
- hash ^= desc->n_static_gsub_features << 8;
- hash ^= GPOINTER_TO_UINT (desc->static_gsub_features);
-
- hash ^= desc->n_static_gpos_features << 12;
- hash ^= GPOINTER_TO_UINT (desc->static_gpos_features);
-
- hash ^= desc->n_other_features << 16;
- for (i = 0; i < desc->n_other_features; i++)
- {
- hash ^= * (guint32 *) desc->other_features[i].feature_name;
- hash ^= desc->other_features[i].property_bit;
- }
-
- return hash;
+ return 0;
}
/**
@@ -543,30 +347,6 @@ gboolean
pango_ot_ruleset_description_equal (const PangoOTRulesetDescription *desc1,
const PangoOTRulesetDescription *desc2)
{
- guint i;
-
-#undef CHECK
-#define CHECK(x) if (desc1->x != desc2->x) return FALSE;
-#define CHECK_FEATURE_NAME(x) if (*(guint32 *)desc1->x != *(guint32 *)desc2->x) return FALSE
-
- CHECK (script);
- CHECK (language);
-
- CHECK (static_gsub_features);
- CHECK (n_static_gsub_features);
- CHECK (static_gpos_features);
- CHECK (n_static_gpos_features);
-
- CHECK (n_other_features);
-
- for (i = 0; i < desc1->n_other_features; i++)
- {
- CHECK_FEATURE_NAME (other_features[i].feature_name);
- CHECK (other_features[i].property_bit);
- }
-
-#undef CHECK
-
return TRUE;
}
@@ -595,17 +375,6 @@ pango_ot_ruleset_description_copy (const PangoOTRulesetDescription *desc)
*copy = *desc;
- if (desc->n_other_features)
- {
- PangoOTFeatureMap *map = g_new (PangoOTFeatureMap, desc->n_other_features);
- memcpy (map, desc->other_features, desc->n_other_features * sizeof (PangoOTFeatureMap));
- copy->other_features = map;
- }
- else
- {
- copy->other_features = NULL;
- }
-
return copy;
}
@@ -621,9 +390,5 @@ pango_ot_ruleset_description_copy (const PangoOTRulesetDescription *desc)
void
pango_ot_ruleset_description_free (PangoOTRulesetDescription *desc)
{
- g_return_if_fail (desc != NULL);
-
- free ((gpointer) desc->other_features);
-
g_slice_free (PangoOTRulesetDescription, desc);
}
diff --git a/pango/pango-ot-tag.c b/pango/pango-ot-tag.c
index 756d051f..73628ac6 100644
--- a/pango/pango-ot-tag.c
+++ b/pango/pango-ot-tag.c
@@ -21,7 +21,7 @@
#include "config.h"
-#include "pango-ot.h"
+#include "pango-ot-private.h"
typedef union {
char string[4];
@@ -125,12 +125,9 @@ static const Tag ot_scripts[] = {
PangoOTTag
pango_ot_tag_from_script (PangoScript script)
{
- g_return_val_if_fail (script >= 0, PANGO_OT_TAG_DEFAULT_SCRIPT);
-
- if ((guint)script >= G_N_ELEMENTS (ot_scripts))
- return PANGO_OT_TAG_DEFAULT_SCRIPT;
-
- return GUINT32_FROM_BE (ot_scripts[script].integer);
+ hb_tag_t tag1, tag2;
+ hb_ot_tags_from_script (hb_glib_script_to_script (script), &tag1, &tag2);
+ return (PangoOTTag) tag1;
}
/**
@@ -157,460 +154,10 @@ pango_ot_tag_from_script (PangoScript script)
PangoScript
pango_ot_tag_to_script (PangoOTTag script_tag)
{
- PangoScript i;
- guint32 be_tag = GUINT32_TO_BE (script_tag);
-
- for (i = 0; i < (PangoScript) G_N_ELEMENTS (ot_scripts); i++)
- {
- guint32 tag = ot_scripts[i].integer;
-
- if (tag == be_tag)
- return i;
- }
-
- return PANGO_SCRIPT_UNKNOWN;
+ return (PangoScript) hb_glib_script_from_script (hb_ot_tag_to_script ((hb_tag_t) script_tag));
}
-typedef struct {
- char language[6];
- Tag tag;
-} LangTag;
-
-/*
- * complete list at:
- * http://www.microsoft.com/OpenType/OTSpec/languagetags.htm
- *
- * Generated by intersecting the OpenType language tag list from
- * Draft OpenType 1.5 spec, with with the ISO 639-3 codes from
- * 2008/08/04, matching on name, and finally adjusted manually.
- *
- * Many items still missing. Those are commented out at the end.
- * Keep sorted for bsearch.
- */
-static const LangTag ot_languages[] = {
- {"aa", {"AFR "}}, /* Afar */
- {"ab", {"ABK "}}, /* Abkhazian */
- {"abq", {"ABA "}}, /* Abaza */
- {"ady", {"ADY "}}, /* Adyghe */
- {"af", {"AFK "}}, /* Afrikaans */
- {"aiw", {"ARI "}}, /* Aari */
- {"am", {"AMH "}}, /* Amharic */
- {"ar", {"ARA "}}, /* Arabic */
- {"arn", {"MAP "}}, /* Mapudungun */
- {"as", {"ASM "}}, /* Assamese */
- {"av", {"AVR "}}, /* Avaric */
- {"awa", {"AWA "}}, /* Awadhi */
- {"ay", {"AYM "}}, /* Aymara */
- {"az", {"AZE "}}, /* Azerbaijani */
- {"ba", {"BSH "}}, /* Bashkir */
- {"bal", {"BLI "}}, /* Baluchi */
- {"bcq", {"BCH "}}, /* Bench */
- {"bem", {"BEM "}}, /* Bemba (Zambia) */
- {"bfq", {"BAD "}}, /* Badaga */
- {"bft", {"BLT "}}, /* Balti */
- {"bg", {"BGR "}}, /* Bulgarian */
- {"bhb", {"BHI "}}, /* Bhili */
- {"bho", {"BHO "}}, /* Bhojpuri */
- {"bik", {"BIK "}}, /* Bikol */
- {"bin", {"EDO "}}, /* Bini */
- {"bm", {"BMB "}}, /* Bambara */
- {"bn", {"BEN "}}, /* Bengali */
- {"bo", {"TIB "}}, /* Tibetan */
- {"br", {"BRE "}}, /* Breton */
- {"brh", {"BRH "}}, /* Brahui */
- {"bs", {"BOS "}}, /* Bosnian */
- {"btb", {"BTI "}}, /* Beti (Cameroon) */
- {"ca", {"CAT "}}, /* Catalan */
- {"ce", {"CHE "}}, /* Chechen */
- {"ceb", {"CEB "}}, /* Cebuano */
- {"chp", {"CHP "}}, /* Chipewyan */
- {"chr", {"CHR "}}, /* Cherokee */
- {"cop", {"COP "}}, /* Coptic */
- {"cr", {"CRE "}}, /* Cree */
- {"crh", {"CRT "}}, /* Crimean Tatar */
- {"crm", {"MCR "}}, /* Moose Cree */
- {"crx", {"CRR "}}, /* Carrier */
- {"cs", {"CSY "}}, /* Czech */
- {"cu", {"CSL "}}, /* Church Slavic */
- {"cv", {"CHU "}}, /* Chuvash */
- {"cwd", {"DCR "}}, /* Woods Cree */
- {"cy", {"WEL "}}, /* Welsh */
- {"da", {"DAN "}}, /* Danish */
- {"dap", {"NIS "}}, /* Nisi (India) */
- {"dar", {"DAR "}}, /* Dargwa */
- {"de", {"DEU "}}, /* German */
- {"din", {"DNK "}}, /* Dinka */
- {"dng", {"DUN "}}, /* Dungan */
- {"doi", {"DGR "}}, /* Dogri */
- {"dsb", {"LSB "}}, /* Lower Sorbian */
- {"dv", {"DIV "}}, /* Dhivehi */
- {"dz", {"DZN "}}, /* Dzongkha */
- {"ee", {"EWE "}}, /* Ewe */
- {"efi", {"EFI "}}, /* Efik */
- {"el", {"ELL "}}, /* Modern Greek (1453-) */
- {"en", {"ENG "}}, /* English */
- {"eo", {"NTO "}}, /* Esperanto */
- {"eot", {"BTI "}}, /* Beti (Côte d'Ivoire) */
- {"es", {"ESP "}}, /* Spanish */
- {"et", {"ETI "}}, /* Estonian */
- {"eu", {"EUQ "}}, /* Basque */
- {"eve", {"EVN "}}, /* Even */
- {"evn", {"EVK "}}, /* Evenki */
- {"fa", {"FAR "}}, /* Persian */
- {"ff", {"FUL "}}, /* Fulah */
- {"fi", {"FIN "}}, /* Finnish */
- {"fil", {"PIL "}}, /* Filipino */
- {"fj", {"FJI "}}, /* Fijian */
- {"fo", {"FOS "}}, /* Faroese */
- {"fon", {"FON "}}, /* Fon */
- {"fr", {"FRA "}}, /* French */
- {"fur", {"FRL "}}, /* Friulian */
- {"fy", {"FRI "}}, /* Western Frisian */
- {"ga", {"IRI "}}, /* Irish */
- {"gaa", {"GAD "}}, /* Ga */
- {"gag", {"GAG "}}, /* Gagauz */
- {"gbm", {"GAW "}}, /* Garhwali */
- {"gd", {"GAE "}}, /* Scottish Gaelic */
- {"gl", {"GAL "}}, /* Galician */
- {"gld", {"NAN "}}, /* Nanai */
- {"gn", {"GUA "}}, /* Guarani */
- {"gon", {"GON "}}, /* Gondi */
- {"grt", {"GRO "}}, /* Garo */
- {"gu", {"GUJ "}}, /* Gujarati */
- {"guk", {"GMZ "}}, /* Gumuz */
- {"gv", {"MNX "}}, /* Manx Gaelic */
- {"ha", {"HAU "}}, /* Hausa */
- {"har", {"HRI "}}, /* Harari */
- {"he", {"IWR "}}, /* Hebrew */
- {"hi", {"HIN "}}, /* Hindi */
- {"hil", {"HIL "}}, /* Hiligaynon */
- {"hoc", {"HO "}}, /* Ho */
- {"hr", {"HRV "}}, /* Croatian */
- {"hsb", {"USB "}}, /* Upper Sorbian */
- {"ht", {"HAI "}}, /* Haitian */
- {"hu", {"HUN "}}, /* Hungarian */
- {"hy", {"HYE "}}, /* Armenian */
- {"id", {"IND "}}, /* Indonesian */
- {"ig", {"IBO "}}, /* Igbo */
- {"igb", {"EBI "}}, /* Ebira */
- {"inh", {"ING "}}, /* Ingush */
- {"is", {"ISL "}}, /* Icelandic */
- {"it", {"ITA "}}, /* Italian */
- {"iu", {"INU "}}, /* Inuktitut */
- {"ja", {"JAN "}}, /* Japanese */
- {"jv", {"JAV "}}, /* Javanese */
- {"ka", {"KAT "}}, /* Georgian */
- {"kam", {"KMB "}}, /* Kamba (Kenya) */
- {"kbd", {"KAB "}}, /* Kabardian */
- {"kdr", {"KRM "}}, /* Karaim */
- {"kdt", {"KUY "}}, /* Kuy */
- {"kfr", {"KAC "}}, /* Kachchi */
- {"kfy", {"KMN "}}, /* Kumaoni */
- {"kha", {"KSI "}}, /* Khasi */
- {"khw", {"KHW "}}, /* Khowar */
- {"ki", {"KIK "}}, /* Kikuyu */
- {"kk", {"KAZ "}}, /* Kazakh */
- {"kl", {"GRN "}}, /* Kalaallisut */
- {"kln", {"KAL "}}, /* Kalenjin */
- {"km", {"KHM "}}, /* Central Khmer */
- {"kmw", {"KMO "}}, /* Komo (Democratic Republic of Congo) */
- {"kn", {"KAN "}}, /* Kannada */
- {"ko", {"KOR "}}, /* Korean */
- {"koi", {"KOP "}}, /* Komi-Permyak */
- {"kok", {"KOK "}}, /* Konkani */
- {"kpe", {"KPL "}}, /* Kpelle */
- {"kpv", {"KOZ "}}, /* Komi-Zyrian */
- {"kpy", {"KYK "}}, /* Koryak */
- {"kqy", {"KRT "}}, /* Koorete */
- {"kr", {"KNR "}}, /* Kanuri */
- {"kri", {"KRI "}}, /* Krio */
- {"krl", {"KRL "}}, /* Karelian */
- {"kru", {"KUU "}}, /* Kurukh */
- {"ks", {"KSH "}}, /* Kashmiri */
- {"ku", {"KUR "}}, /* Kurdish */
- {"kum", {"KUM "}}, /* Kumyk */
- {"kvd", {"KUI "}}, /* Kui (Indonesia) */
- {"kxu", {"KUI "}}, /* Kui (India) */
- {"ky", {"KIR "}}, /* Kirghiz */
- {"la", {"LAT "}}, /* Latin */
- {"lad", {"JUD "}}, /* Ladino */
- {"lb", {"LTZ "}}, /* Luxembourgish */
- {"lbe", {"LAK "}}, /* Lak */
- {"lbj", {"LDK "}}, /* Ladakhi */
- {"lif", {"LMB "}}, /* Limbu */
- {"lld", {"LAD "}}, /* Ladin */
- {"ln", {"LIN "}}, /* Lingala */
- {"lo", {"LAO "}}, /* Lao */
- {"lt", {"LTH "}}, /* Lithuanian */
- {"luo", {"LUO "}}, /* Luo (Kenya and Tanzania) */
- {"luw", {"LUO "}}, /* Luo (Cameroon) */
- {"lv", {"LVI "}}, /* Latvian */
- {"lzz", {"LAZ "}}, /* Laz */
- {"mai", {"MTH "}}, /* Maithili */
- {"mdc", {"MLE "}}, /* Male (Papua New Guinea) */
- {"mdf", {"MOK "}}, /* Moksha */
- {"mdy", {"MLE "}}, /* Male (Ethiopia) */
- {"men", {"MDE "}}, /* Mende (Sierra Leone) */
- {"mg", {"MLG "}}, /* Malagasy */
- {"mi", {"MRI "}}, /* Maori */
- {"mk", {"MKD "}}, /* Macedonian */
- {"ml", {"MLR "}}, /* Malayalam */
- {"mn", {"MNG "}}, /* Mongolian */
- {"mnc", {"MCH "}}, /* Manchu */
- {"mni", {"MNI "}}, /* Manipuri */
- {"mnk", {"MND "}}, /* Mandinka */
- {"mns", {"MAN "}}, /* Mansi */
- {"mnw", {"MON "}}, /* Mon */
- {"mo", {"MOL "}}, /* Moldavian */
- {"moh", {"MOH "}}, /* Mohawk */
- {"mpe", {"MAJ "}}, /* Majang */
- {"mr", {"MAR "}}, /* Marathi */
- {"ms", {"MLY "}}, /* Malay */
- {"mt", {"MTS "}}, /* Maltese */
- {"mwr", {"MAW "}}, /* Marwari */
- {"my", {"BRM "}}, /* Burmese */
- {"mym", {"MEN "}}, /* Me'en */
- {"myv", {"ERZ "}}, /* Erzya */
- {"nb", {"NOR "}}, /* Norwegian Bokmål */
- {"nco", {"SIB "}}, /* Sibe */
- {"ne", {"NEP "}}, /* Nepali */
- {"new", {"NEW "}}, /* Newari */
- {"ng", {"NDG "}}, /* Ndonga */
- {"ngl", {"LMW "}}, /* Lomwe */
- {"niu", {"NIU "}}, /* Niuean */
- {"niv", {"GIL "}}, /* Gilyak */
- {"nl", {"NLD "}}, /* Dutch */
- {"nn", {"NYN "}}, /* Norwegian Nynorsk */
- {"no", {"NOR "}}, /* Norwegian (deprecated) */
- {"nog", {"NOG "}}, /* Nogai */
- {"nqo", {"NKO "}}, /* N'Ko */
- {"nsk", {"NAS "}}, /* Naskapi */
- {"ny", {"CHI "}}, /* Nyanja */
- {"oc", {"OCI "}}, /* Occitan (post 1500) */
- {"oj", {"OJB "}}, /* Ojibwa */
- {"om", {"ORO "}}, /* Oromo */
- {"or", {"ORI "}}, /* Oriya */
- {"os", {"OSS "}}, /* Ossetian */
- {"pa", {"PAN "}}, /* Panjabi */
- {"pi", {"PAL "}}, /* Pali */
- {"pl", {"PLK "}}, /* Polish */
- {"plp", {"PAP "}}, /* Palpa */
- {"prs", {"DRI "}}, /* Dari */
- {"ps", {"PAS "}}, /* Pushto */
- {"pt", {"PTG "}}, /* Portuguese */
- {"raj", {"RAJ "}}, /* Rajasthani */
- {"ria", {"RIA "}}, /* Riang (India) */
- {"ril", {"RIA "}}, /* Riang (Myanmar) */
- {"ro", {"ROM "}}, /* Romanian */
- {"rom", {"ROY "}}, /* Romany */
- {"ru", {"RUS "}}, /* Russian */
- {"rue", {"RSY "}}, /* Rusyn */
- {"sa", {"SAN "}}, /* Sanskrit */
- {"sah", {"YAK "}}, /* Yakut */
- {"sat", {"SAT "}}, /* Santali */
- {"sck", {"SAD "}}, /* Sadri */
- {"sd", {"SND "}}, /* Sindhi */
- {"se", {"NSM "}}, /* Northern Sami */
- {"seh", {"SNA "}}, /* Sena */
- {"sel", {"SEL "}}, /* Selkup */
- {"sg", {"SGO "}}, /* Sango */
- {"shn", {"SHN "}}, /* Shan */
- {"si", {"SNH "}}, /* Sinhala */
- {"sid", {"SID "}}, /* Sidamo */
- {"sjd", {"KSM "}}, /* Kildin Sami */
- {"sk", {"SKY "}}, /* Slovak */
- {"skr", {"SRK "}}, /* Seraiki */
- {"sl", {"SLV "}}, /* Slovenian */
- {"sm", {"SMO "}}, /* Samoan */
- {"sma", {"SSM "}}, /* Southern Sami */
- {"smj", {"LSM "}}, /* Lule Sami */
- {"smn", {"ISM "}}, /* Inari Sami */
- {"sms", {"SKS "}}, /* Skolt Sami */
- {"snk", {"SNK "}}, /* Soninke */
- {"so", {"SML "}}, /* Somali */
- {"sq", {"SQI "}}, /* Albanian */
- {"sr", {"SRB "}}, /* Serbian */
- {"srr", {"SRR "}}, /* Serer */
- {"suq", {"SUR "}}, /* Suri */
- {"sv", {"SVE "}}, /* Swedish */
- {"sva", {"SVA "}}, /* Svan */
- {"sw", {"SWK "}}, /* Swahili */
- {"swb", {"CMR "}}, /* Comorian */
- {"syr", {"SYR "}}, /* Syriac */
- {"ta", {"TAM "}}, /* Tamil */
- {"tcy", {"TUL "}}, /* Tulu */
- {"te", {"TEL "}}, /* Telugu */
- {"tg", {"TAJ "}}, /* Tajik */
- {"th", {"THA "}}, /* Thai */
- {"ti", {"TGY "}}, /* Tigrinya */
- {"tig", {"TGR "}}, /* Tigre */
- {"tk", {"TKM "}}, /* Turkmen */
- {"tn", {"TNA "}}, /* Tswana */
- {"tnz", {"TNG "}}, /* Tonga (Thailand) */
- {"to", {"TNG "}}, /* Tonga (Tonga Islands) */
- {"tog", {"TNG "}}, /* Tonga (Nyasa) */
- {"toi", {"TNG "}}, /* Tonga (Zambia) */
- {"tr", {"TRK "}}, /* Turkish */
- {"ts", {"TSG "}}, /* Tsonga */
- {"tt", {"TAT "}}, /* Tatar */
- {"tw", {"TWI "}}, /* Twi */
- {"ty", {"THT "}}, /* Tahitian */
- {"udm", {"UDM "}}, /* Udmurt */
- {"ug", {"UYG "}}, /* Uighur */
- {"uk", {"UKR "}}, /* Ukrainian */
- {"unr", {"MUN "}}, /* Mundari */
- {"ur", {"URD "}}, /* Urdu */
- {"uz", {"UZB "}}, /* Uzbek */
- {"ve", {"VEN "}}, /* Venda */
- {"vi", {"VIT "}}, /* Vietnamese */
- {"wbm", {"WA "}}, /* Wa */
- {"wbr", {"WAG "}}, /* Wagdi */
- {"wo", {"WLF "}}, /* Wolof */
- {"xal", {"KLM "}}, /* Kalmyk */
- {"xh", {"XHS "}}, /* Xhosa */
- {"xom", {"KMO "}}, /* Komo (Sudan) */
- {"xsl", {"SSL "}}, /* South Slavey */
- {"yi", {"JII "}}, /* Yiddish */
- {"yo", {"YBA "}}, /* Yoruba */
- {"yso", {"NIS "}}, /* Nisi (China) */
- {"zh-cn", {"ZHS "}}, /* Chinese (China) */
- {"zh-hk", {"ZHH "}}, /* Chinese (Hong Kong) */
- {"zh-mo", {"ZHT "}}, /* Chinese (Macao) */
- {"zh-sg", {"ZHS "}}, /* Chinese (Singapore) */
- {"zh-tw", {"ZHT "}}, /* Chinese (Taiwan) */
- {"zne", {"ZND "}}, /* Zande */
- {"zu", {"ZUL "}} /* Zulu */
-
- /* I couldn't find the language id for these */
-
-/*{"??", {"AGW "}},*/ /* Agaw */
-/*{"??", {"ALS "}},*/ /* Alsatian */
-/*{"??", {"ALT "}},*/ /* Altai */
-/*{"??", {"ARK "}},*/ /* Arakanese */
-/*{"??", {"ATH "}},*/ /* Athapaskan */
-/*{"??", {"BAG "}},*/ /* Baghelkhandi */
-/*{"??", {"BAL "}},*/ /* Balkar */
-/*{"??", {"BAU "}},*/ /* Baule */
-/*{"??", {"BBR "}},*/ /* Berber */
-/*{"??", {"BCR "}},*/ /* Bible Cree */
-/*{"??", {"BEL "}},*/ /* Belarussian */
-/*{"??", {"BIL "}},*/ /* Bilen */
-/*{"??", {"BKF "}},*/ /* Blackfoot */
-/*{"??", {"BLN "}},*/ /* Balante */
-/*{"??", {"BML "}},*/ /* Bamileke */
-/*{"??", {"BRI "}},*/ /* Braj Bhasha */
-/*{"??", {"CHG "}},*/ /* Chaha Gurage */
-/*{"??", {"CHH "}},*/ /* Chattisgarhi */
-/*{"??", {"CHK "}},*/ /* Chukchi */
-/*{"??", {"DJR "}},*/ /* Djerma */
-/*{"??", {"DNG "}},*/ /* Dangme */
-/*{"??", {"ECR "}},*/ /* Eastern Cree */
-/*{"??", {"FAN "}},*/ /* French Antillean */
-/*{"??", {"FLE "}},*/ /* Flemish */
-/*{"??", {"FNE "}},*/ /* Forest Nenets */
-/*{"??", {"FTA "}},*/ /* Futa */
-/*{"??", {"GAR "}},*/ /* Garshuni */
-/*{"??", {"GEZ "}},*/ /* Ge'ez */
-/*{"??", {"HAL "}},*/ /* Halam */
-/*{"??", {"HAR "}},*/ /* Harauti */
-/*{"??", {"HAW "}},*/ /* Hawaiin */
-/*{"??", {"HBN "}},*/ /* Hammer-Banna */
-/*{"??", {"HMA "}},*/ /* High Mari */
-/*{"??", {"HND "}},*/ /* Hindko */
-/*{"??", {"IJO "}},*/ /* Ijo */
-/*{"??", {"ILO "}},*/ /* Ilokano */
-/*{"??", {"IRT "}},*/ /* Irish Traditional */
-/*{"??", {"JUL "}},*/ /* Jula */
-/*{"??", {"KAR "}},*/ /* Karachay */
-/*{"??", {"KEB "}},*/ /* Kebena */
-/*{"??", {"KGE "}},*/ /* Khutsuri Georgian */
-/*{"??", {"KHA "}},*/ /* Khakass */
-/*{"??", {"KHK "}},*/ /* Khanty-Kazim */
-/*{"??", {"KHS "}},*/ /* Khanty-Shurishkar */
-/*{"??", {"KHV "}},*/ /* Khanty-Vakhi */
-/*{"??", {"KIS "}},*/ /* Kisii */
-/*{"??", {"KKN "}},*/ /* Kokni */
-/*{"??", {"KMS "}},*/ /* Komso */
-/*{"??", {"KOD "}},*/ /* Kodagu */
-/*{"??", {"KOH "}},*/ /* Korean Old Hangul */
-/*{"??", {"KON "}},*/ /* Kikongo */
-/*{"??", {"KRK "}},*/ /* Karakalpak */
-/*{"??", {"KRN "}},*/ /* Karen */
-/*{"??", {"KUL "}},*/ /* Kulvi */
-/*{"??", {"LAH "}},*/ /* Lahuli */
-/*{"??", {"LAM "}},*/ /* Lambani */
-/*{"??", {"LCR "}},*/ /* L-Cree */
-/*{"??", {"LEZ "}},*/ /* Lezgi */
-/*{"??", {"LMA "}},*/ /* Low Mari */
-/*{"??", {"LUB "}},*/ /* Luba */
-/*{"??", {"LUG "}},*/ /* Luganda */
-/*{"??", {"LUH "}},*/ /* Luhya */
-/*{"??", {"MAK "}},*/ /* Makua */
-/*{"??", {"MAL "}},*/ /* Malayalam Traditional */
-/*{"??", {"MBN "}},*/ /* Mbundu */
-/*{"??", {"MIZ "}},*/ /* Mizo */
-/*{"??", {"MLN "}},*/ /* Malinke */
-/*{"??", {"MNK "}},*/ /* Maninka */
-/*{"??", {"MOR "}},*/ /* Moroccan */
-/*{"??", {"NAG "}},*/ /* Naga-Assamese */
-/*{"??", {"NCR "}},*/ /* N-Cree */
-/*{"??", {"NDB "}},*/ /* Ndebele */
-/*{"??", {"NGR "}},*/ /* Nagari */
-/*{"??", {"NHC "}},*/ /* Norway House Cree */
-/*{"??", {"NKL "}},*/ /* Nkole */
-/*{"??", {"NTA "}},*/ /* Northern Tai */
-/*{"??", {"OCR "}},*/ /* Oji-Cree */
-/*{"??", {"PAA "}},*/ /* Palestinian Aramaic */
-/*{"??", {"PGR "}},*/ /* Polytonic Greek */
-/*{"??", {"PLG "}},*/ /* Palaung */
-/*{"??", {"QIN "}},*/ /* Chin */
-/*{"??", {"RBU "}},*/ /* Russian Buriat */
-/*{"??", {"RCR "}},*/ /* R-Cree */
-/*{"??", {"RMS "}},*/ /* Rhaeto-Romanic */
-/*{"??", {"RUA "}},*/ /* Ruanda */
-/*{"??", {"SAY "}},*/ /* Sayisi */
-/*{"??", {"SEK "}},*/ /* Sekota */
-/*{"??", {"SIG "}},*/ /* Silte Gurage */
-/*{"??", {"SLA "}},*/ /* Slavey */
-/*{"??", {"SOG "}},*/ /* Sodo Gurage */
-/*{"??", {"SOT "}},*/ /* Sotho */
-/*{"??", {"SWA "}},*/ /* Swadaya Aramaic */
-/*{"??", {"SWZ "}},*/ /* Swazi */
-/*{"??", {"SXT "}},*/ /* Sutu */
-/*{"??", {"TAB "}},*/ /* Tabasaran */
-/*{"??", {"TCR "}},*/ /* TH-Cree */
-/*{"??", {"TGN "}},*/ /* Tongan */
-/*{"??", {"TMN "}},*/ /* Temne */
-/*{"??", {"TNE "}},*/ /* Tundra Nenets */
-/*{"??", {"TOD "}},*/ /* Todo */
-/*{"??", {"TUA "}},*/ /* Turoyo Aramaic */
-/*{"??", {"TUV "}},*/ /* Tuvin */
-/*{"??", {"WCR "}},*/ /* West-Cree */
-/*{"??", {"XBD "}},*/ /* Tai Lue */
-/*{"??", {"YCR "}},*/ /* Y-Cree */
-/*{"??", {"YIC "}},*/ /* Yi Classic */
-/*{"??", {"YIM "}},*/ /* Yi Modern */
-/*{"??", {"ZHP "}},*/ /* Chinese Phonetic */
-};
-
-static int
-lang_compare_first_component (gconstpointer pa,
- gconstpointer pb)
-{
- const char *a = pa, *b = pb;
- unsigned int da, db;
- const char *p;
-
- p = strstr (a, "-");
- da = p ? (unsigned int) (p - a) : strlen (a);
-
- p = strstr (b, "-");
- db = p ? (unsigned int) (p - b) : strlen (b);
-
- return strncmp (a, b, MAX (da, db));
-}
-
/**
* pango_ot_tag_from_language:
* @language: A #PangoLanguage, or %NULL
@@ -626,50 +173,7 @@ lang_compare_first_component (gconstpointer pa,
PangoOTTag
pango_ot_tag_from_language (PangoLanguage *language)
{
- const char *lang_str;
- LangTag *lang_tag;
-
- if (language == NULL)
- return PANGO_OT_TAG_DEFAULT_LANGUAGE;
-
- lang_str = pango_language_to_string (language);
-
- /* find a language matching in the first component */
- lang_tag = bsearch (lang_str, ot_languages,
- G_N_ELEMENTS (ot_languages), sizeof (LangTag),
- lang_compare_first_component);
-
- /* we now need to find the best language matching */
- if (lang_tag)
- {
- gboolean found = FALSE;
-
- /* go to the final one matching in the first component */
- while (lang_tag + 1 < ot_languages + G_N_ELEMENTS (ot_languages) &&
- lang_compare_first_component (lang_str, lang_tag + 1) == 0)
- lang_tag++;
-
- /* go back, find which one matches completely */
- while (lang_tag >= ot_languages &&
- lang_compare_first_component (lang_str, lang_tag) == 0)
- {
- if (pango_language_matches (language, lang_tag->language))
- {
- found = TRUE;
- break;
- }
-
- lang_tag--;
- }
-
- if (!found)
- lang_tag = NULL;
- }
-
- if (lang_tag)
- return GUINT32_FROM_BE (lang_tag->tag.integer);
-
- return PANGO_OT_TAG_DEFAULT_LANGUAGE;
+ return (PangoOTTag) hb_ot_tag_from_language (hb_language_from_string (pango_language_to_string (language), -1));
}
/**
@@ -686,16 +190,5 @@ pango_ot_tag_from_language (PangoLanguage *language)
PangoLanguage *
pango_ot_tag_to_language (PangoOTTag language_tag)
{
- int i;
- guint32 be_tag = GUINT32_TO_BE (language_tag);
-
- for (i = 0; i < (int) G_N_ELEMENTS (ot_languages); i++)
- {
- guint32 tag = ot_languages[i].tag.integer;
-
- if (tag == be_tag)
- return pango_language_from_string (ot_languages[i].language);
- }
-
- return pango_language_from_string ("xx");
+ return pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language ((hb_tag_t) language_tag)));
}
diff --git a/pango/pango-ot.h b/pango/pango-ot.h
index 6a436fc2..cca5ef51 100644
--- a/pango/pango-ot.h
+++ b/pango/pango-ot.h
@@ -22,6 +22,8 @@
#ifndef __PANGO_OT_H__
#define __PANGO_OT_H__
+/* Deprecated. Use HarfBuzz directly! */
+
#include <pango/pangofc-font.h>
#include <pango/pango-glyph.h>
#include <pango/pango-font.h>
@@ -102,18 +104,23 @@ GType pango_ot_info_get_type (void) G_GNUC_CONST;
GType pango_ot_ruleset_get_type (void) G_GNUC_CONST;
+G_DEPRECATED
PangoOTInfo *pango_ot_info_get (FT_Face face);
+G_DEPRECATED
gboolean pango_ot_info_find_script (PangoOTInfo *info,
PangoOTTableType table_type,
PangoOTTag script_tag,
guint *script_index);
+
+G_DEPRECATED
gboolean pango_ot_info_find_language (PangoOTInfo *info,
PangoOTTableType table_type,
guint script_index,
PangoOTTag language_tag,
guint *language_index,
guint *required_feature_index);
+G_DEPRECATED
gboolean pango_ot_info_find_feature (PangoOTInfo *info,
PangoOTTableType table_type,
PangoOTTag feature_tag,
@@ -121,72 +128,110 @@ gboolean pango_ot_info_find_feature (PangoOTInfo *info,
guint language_index,
guint *feature_index);
+G_DEPRECATED
PangoOTTag *pango_ot_info_list_scripts (PangoOTInfo *info,
PangoOTTableType table_type);
+G_DEPRECATED
PangoOTTag *pango_ot_info_list_languages (PangoOTInfo *info,
PangoOTTableType table_type,
guint script_index,
PangoOTTag language_tag);
+G_DEPRECATED
PangoOTTag *pango_ot_info_list_features (PangoOTInfo *info,
PangoOTTableType table_type,
PangoOTTag tag,
guint script_index,
guint language_index);
+G_DEPRECATED
PangoOTBuffer *pango_ot_buffer_new (PangoFcFont *font);
+G_DEPRECATED
void pango_ot_buffer_destroy (PangoOTBuffer *buffer);
+G_DEPRECATED
void pango_ot_buffer_clear (PangoOTBuffer *buffer);
+G_DEPRECATED
void pango_ot_buffer_set_rtl (PangoOTBuffer *buffer,
gboolean rtl);
+G_DEPRECATED
void pango_ot_buffer_add_glyph (PangoOTBuffer *buffer,
guint glyph,
guint properties,
guint cluster);
+G_DEPRECATED
void pango_ot_buffer_get_glyphs (const PangoOTBuffer *buffer,
PangoOTGlyph **glyphs,
int *n_glyphs);
+G_DEPRECATED
void pango_ot_buffer_output (const PangoOTBuffer *buffer,
PangoGlyphString *glyphs);
+G_DEPRECATED
void pango_ot_buffer_set_zero_width_marks (PangoOTBuffer *buffer,
gboolean zero_width_marks);
+G_DEPRECATED
const PangoOTRuleset *pango_ot_ruleset_get_for_description (PangoOTInfo *info,
const PangoOTRulesetDescription *desc);
+G_DEPRECATED
PangoOTRuleset *pango_ot_ruleset_new (PangoOTInfo *info);
+G_DEPRECATED
PangoOTRuleset *pango_ot_ruleset_new_for (PangoOTInfo *info,
PangoScript script,
PangoLanguage *language);
+G_DEPRECATED
PangoOTRuleset *pango_ot_ruleset_new_from_description (PangoOTInfo *info,
const PangoOTRulesetDescription *desc);
+G_DEPRECATED
void pango_ot_ruleset_add_feature (PangoOTRuleset *ruleset,
PangoOTTableType table_type,
guint feature_index,
gulong property_bit);
+G_DEPRECATED
gboolean pango_ot_ruleset_maybe_add_feature (PangoOTRuleset *ruleset,
PangoOTTableType table_type,
PangoOTTag feature_tag,
gulong property_bit);
+G_DEPRECATED
guint pango_ot_ruleset_maybe_add_features (PangoOTRuleset *ruleset,
PangoOTTableType table_type,
const PangoOTFeatureMap *features,
guint n_features);
+G_DEPRECATED
guint pango_ot_ruleset_get_feature_count (const PangoOTRuleset *ruleset,
guint *n_gsub_features,
guint *n_gpos_features);
+
+G_DEPRECATED
void pango_ot_ruleset_substitute (const PangoOTRuleset *ruleset,
PangoOTBuffer *buffer);
+
+G_DEPRECATED
void pango_ot_ruleset_position (const PangoOTRuleset *ruleset,
PangoOTBuffer *buffer);
+
+G_DEPRECATED
PangoScript pango_ot_tag_to_script (PangoOTTag script_tag) G_GNUC_CONST;
+
+G_DEPRECATED
PangoOTTag pango_ot_tag_from_script (PangoScript script) G_GNUC_CONST;
+
+G_DEPRECATED
PangoLanguage *pango_ot_tag_to_language (PangoOTTag language_tag) G_GNUC_CONST;
+
+G_DEPRECATED
PangoOTTag pango_ot_tag_from_language (PangoLanguage *language) G_GNUC_CONST;
+G_DEPRECATED
guint pango_ot_ruleset_description_hash (const PangoOTRulesetDescription *desc) G_GNUC_PURE;
+
+G_DEPRECATED
gboolean pango_ot_ruleset_description_equal (const PangoOTRulesetDescription *desc1,
const PangoOTRulesetDescription *desc2) G_GNUC_PURE;
+
+G_DEPRECATED
PangoOTRulesetDescription *pango_ot_ruleset_description_copy (const PangoOTRulesetDescription *desc);
+
+G_DEPRECATED
void pango_ot_ruleset_description_free (PangoOTRulesetDescription *desc);
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index b5a776cb..7dcb64a9 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -821,8 +821,6 @@ pango_fc_font_kern_glyphs (PangoFcFont *font,
return;
}
- /* This is a kludge, and dupped in pango_ot_buffer_output().
- * Should move the scale factor to PangoFcFont layer. */
key = _pango_fc_font_get_font_key (font);
if (key) {
const PangoMatrix *matrix = pango_fc_font_key_get_matrix (key);