From e7ecbba2cc3c9369c5e7dc7296cb210018aca3bb Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Thu, 18 Aug 2016 12:48:38 +0200 Subject: [PATCH] Support Americanist Phonetic Notation OpenType language system tag: `APPH` https://www.microsoft.com/typography/otspec/languagetags.htm IETF BCP47 variant tag: `fonnapa` http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry --- src/hb-ot-tag.cc | 14 ++++++++++++-- test/api/test-ot-tag.c | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc index 34d7b37c1..5f21ac096 100644 --- a/src/hb-ot-tag.cc +++ b/src/hb-ot-tag.cc @@ -892,13 +892,21 @@ hb_ot_tag_from_language (hb_language_t language) } /* - * The International Phonetic Alphabet is a variant tag in BCP-47, - * which can be applied to any language. + * "fonipa" is a variant tag in BCP-47, meaning the International Phonetic Alphabet. + * It can be applied to any language. */ if (strstr (lang_str, "-fonipa")) { return HB_TAG('I','P','P','H'); /* Phonetic transcription—IPA conventions */ } + /* + * "fonnapa" is a variant tag in BCP-47, meaning the North American Phonetic Alphabet + * also known as Americanist Phonetic Notation. It can be applied to any language. + */ + if (strstr (lang_str, "-fonnapa")) { + return HB_TAG('A','P','P','H'); /* Phonetic transcription—Americanist conventions */ + } + /* Find a language matching in the first component */ { const LangTag *lang_tag; @@ -970,6 +978,8 @@ hb_ot_tag_to_language (hb_tag_t tag) /* struct LangTag has only room for 3-letter language tags. */ switch (tag) { + case HB_TAG('A','P','P','H'): /* Phonetic transcription—Americanist conventions */ + return hb_language_from_string ("und-fonnapa", -1); case HB_TAG('I','P','P','H'): /* Phonetic transcription—IPA conventions */ return hb_language_from_string ("und-fonipa", -1); } diff --git a/test/api/test-ot-tag.c b/test/api/test-ot-tag.c index eda87ff8c..e54e55269 100644 --- a/test/api/test-ot-tag.c +++ b/test/api/test-ot-tag.c @@ -232,6 +232,12 @@ test_ot_tag_language (void) test_tag_from_language ("IPPH", "zh-fonipa"); test_tag_to_language ("IPPH", "und-fonipa"); + /* North American Phonetic Alphabet (Americanist Phonetic Notation) */ + test_tag_from_language ("APPH", "en-fonnapa"); + test_tag_from_language ("APPH", "chr-fonnapa"); + test_tag_from_language ("APPH", "und-fonnapa"); + test_tag_to_language ("APPH", "und-fonnapa"); + /* Test that x-hbot overrides the base language */ test_tag_from_language ("ABC", "fa-x-hbotabc-zxc"); test_tag_from_language ("ABC", "fa-ir-x-hbotabc-zxc");