From b490fa343322f1b5abaf880abc073287c1f34132 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 21 May 2010 11:15:07 +0100 Subject: [PATCH] Add hb_ot_tag_to_script() --- src/hb-ot-tag.c | 14 ++++++++++++++ src/hb-ot-tag.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/hb-ot-tag.c b/src/hb-ot-tag.c index fc4889b6f..a77fef836 100644 --- a/src/hb-ot-tag.c +++ b/src/hb-ot-tag.c @@ -134,6 +134,20 @@ hb_ot_tags_from_script (hb_script_t script) return ot_scripts[script]; } +hb_script_t +hb_ot_tag_to_script (hb_tag_t tag) +{ + int i; + + for (i = 0; i < ARRAY_LENGTH (ot_scripts); i++) { + hb_tag_t *p = ot_scripts[i]; + while (*p) + if (tag == *p) + return i; + } + + return HB_SCRIPT_UNKNOWN; +} typedef struct { char language[6]; diff --git a/src/hb-ot-tag.h b/src/hb-ot-tag.h index 2dab2e812..6d15d4e28 100644 --- a/src/hb-ot-tag.h +++ b/src/hb-ot-tag.h @@ -38,6 +38,9 @@ HB_BEGIN_DECLS const hb_tag_t * hb_ot_tags_from_script (hb_script_t script); +hb_script_t +hb_ot_tag_to_script (hb_tag_t tag); + hb_tag_t hb_ot_tag_from_language (hb_language_t language);