OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2009 Red Hat, Inc. |
| 3 * |
| 4 * This is part of HarfBuzz, a text shaping library. |
| 5 * |
| 6 * Permission is hereby granted, without written agreement and without |
| 7 * license or royalty fees, to use, copy, modify, and distribute this |
| 8 * software and its documentation for any purpose, provided that the |
| 9 * above copyright notice and the following two paragraphs appear in |
| 10 * all copies of this software. |
| 11 * |
| 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
| 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
| 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
| 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 16 * DAMAGE. |
| 17 * |
| 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
| 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
| 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
| 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 23 * |
| 24 * Red Hat Author(s): Behdad Esfahbod |
| 25 */ |
| 26 |
| 27 #include "hb-private.h" |
| 28 #include "hb-ot.h" |
| 29 |
| 30 #include <string.h> |
| 31 |
| 32 HB_BEGIN_DECLS |
| 33 |
| 34 |
| 35 /* |
| 36 * Complete list at: |
| 37 * http://www.microsoft.com/typography/otspec/scripttags.htm |
| 38 */ |
| 39 static const hb_tag_t ot_scripts[][3] = { |
| 40 {HB_TAG('D','F','L','T')}, /* HB_SCRIPT_COMMON */ |
| 41 {HB_TAG('D','F','L','T')}, /* HB_SCRIPT_INHERITED */ |
| 42 {HB_TAG('a','r','a','b')}, /* HB_SCRIPT_ARABIC */ |
| 43 {HB_TAG('a','r','m','n')}, /* HB_SCRIPT_ARMENIAN */ |
| 44 {HB_TAG('b','n','g','2'), HB_TAG('b','e','n','g')}, /* HB_SCRIPT_BENGALI */ |
| 45 {HB_TAG('b','o','p','o')}, /* HB_SCRIPT_BOPOMOFO */ |
| 46 {HB_TAG('c','h','e','r')}, /* HB_SCRIPT_CHEROKEE */ |
| 47 {HB_TAG('c','o','p','t')}, /* HB_SCRIPT_COPTIC */ |
| 48 {HB_TAG('c','y','r','l')}, /* HB_SCRIPT_CYRILLIC */ |
| 49 {HB_TAG('d','s','r','t')}, /* HB_SCRIPT_DESERET */ |
| 50 {HB_TAG('d','e','v','2'), HB_TAG('d','e','v','a')}, /* HB_SCRIPT_DEVANAGARI
*/ |
| 51 {HB_TAG('e','t','h','i')}, /* HB_SCRIPT_ETHIOPIC */ |
| 52 {HB_TAG('g','e','o','r')}, /* HB_SCRIPT_GEORGIAN */ |
| 53 {HB_TAG('g','o','t','h')}, /* HB_SCRIPT_GOTHIC */ |
| 54 {HB_TAG('g','r','e','k')}, /* HB_SCRIPT_GREEK */ |
| 55 {HB_TAG('g','j','r','2'), HB_TAG('g','u','j','r')}, /* HB_SCRIPT_GUJARATI */ |
| 56 {HB_TAG('g','u','r','2'), HB_TAG('g','u','r','u')}, /* HB_SCRIPT_GURMUKHI */ |
| 57 {HB_TAG('h','a','n','i')}, /* HB_SCRIPT_HAN */ |
| 58 {HB_TAG('h','a','n','g')}, /* HB_SCRIPT_HANGUL */ |
| 59 {HB_TAG('h','e','b','r')}, /* HB_SCRIPT_HEBREW */ |
| 60 {HB_TAG('k','a','n','a')}, /* HB_SCRIPT_HIRAGANA */ |
| 61 {HB_TAG('k','n','d','2'), HB_TAG('k','n','d','a')}, /* HB_SCRIPT_KANNADA */ |
| 62 {HB_TAG('k','a','n','a')}, /* HB_SCRIPT_KATAKANA */ |
| 63 {HB_TAG('k','h','m','r')}, /* HB_SCRIPT_KHMER */ |
| 64 {HB_TAG('l','a','o',' ')}, /* HB_SCRIPT_LAO */ |
| 65 {HB_TAG('l','a','t','n')}, /* HB_SCRIPT_LATIN */ |
| 66 {HB_TAG('m','l','m','2'), HB_TAG('m','l','y','m')}, /* HB_SCRIPT_MALAYALAM *
/ |
| 67 {HB_TAG('m','o','n','g')}, /* HB_SCRIPT_MONGOLIAN */ |
| 68 {HB_TAG('m','y','m','r')}, /* HB_SCRIPT_MYANMAR */ |
| 69 {HB_TAG('o','g','a','m')}, /* HB_SCRIPT_OGHAM */ |
| 70 {HB_TAG('i','t','a','l')}, /* HB_SCRIPT_OLD_ITALIC */ |
| 71 {HB_TAG('o','r','y','2'), HB_TAG('o','r','y','a')}, /* HB_SCRIPT_ORIYA */ |
| 72 {HB_TAG('r','u','n','r')}, /* HB_SCRIPT_RUNIC */ |
| 73 {HB_TAG('s','i','n','h')}, /* HB_SCRIPT_SINHALA */ |
| 74 {HB_TAG('s','y','r','c')}, /* HB_SCRIPT_SYRIAC */ |
| 75 {HB_TAG('t','m','l','2'), HB_TAG('t','a','m','l')}, /* HB_SCRIPT_TAMIL */ |
| 76 {HB_TAG('t','e','l','2'), HB_TAG('t','e','l','u')}, /* HB_SCRIPT_TELUGU */ |
| 77 {HB_TAG('t','h','a','a')}, /* HB_SCRIPT_THAANA */ |
| 78 {HB_TAG('t','h','a','i')}, /* HB_SCRIPT_THAI */ |
| 79 {HB_TAG('t','i','b','t')}, /* HB_SCRIPT_TIBETAN */ |
| 80 {HB_TAG('c','a','n','s')}, /* HB_SCRIPT_CANADIAN_ABORIGINAL */ |
| 81 {HB_TAG('y','i',' ',' ')}, /* HB_SCRIPT_YI */ |
| 82 {HB_TAG('t','g','l','g')}, /* HB_SCRIPT_TAGALOG */ |
| 83 {HB_TAG('h','a','n','o')}, /* HB_SCRIPT_HANUNOO */ |
| 84 {HB_TAG('b','u','h','d')}, /* HB_SCRIPT_BUHID */ |
| 85 {HB_TAG('t','a','g','b')}, /* HB_SCRIPT_TAGBANWA */ |
| 86 |
| 87 /* Unicode-4.0 additions */ |
| 88 {HB_TAG('b','r','a','i')}, /* HB_SCRIPT_BRAILLE */ |
| 89 {HB_TAG('c','p','r','t')}, /* HB_SCRIPT_CYPRIOT */ |
| 90 {HB_TAG('l','i','m','b')}, /* HB_SCRIPT_LIMBU */ |
| 91 {HB_TAG('o','s','m','a')}, /* HB_SCRIPT_OSMANYA */ |
| 92 {HB_TAG('s','h','a','w')}, /* HB_SCRIPT_SHAVIAN */ |
| 93 {HB_TAG('l','i','n','b')}, /* HB_SCRIPT_LINEAR_B */ |
| 94 {HB_TAG('t','a','l','e')}, /* HB_SCRIPT_TAI_LE */ |
| 95 {HB_TAG('u','g','a','r')}, /* HB_SCRIPT_UGARITIC */ |
| 96 |
| 97 /* Unicode-4.1 additions */ |
| 98 {HB_TAG('t','a','l','u')}, /* HB_SCRIPT_NEW_TAI_LUE */ |
| 99 {HB_TAG('b','u','g','i')}, /* HB_SCRIPT_BUGINESE */ |
| 100 {HB_TAG('g','l','a','g')}, /* HB_SCRIPT_GLAGOLITIC */ |
| 101 {HB_TAG('t','f','n','g')}, /* HB_SCRIPT_TIFINAGH */ |
| 102 {HB_TAG('s','y','l','o')}, /* HB_SCRIPT_SYLOTI_NAGRI */ |
| 103 {HB_TAG('x','p','e','o')}, /* HB_SCRIPT_OLD_PERSIAN */ |
| 104 {HB_TAG('k','h','a','r')}, /* HB_SCRIPT_KHAROSHTHI */ |
| 105 |
| 106 /* Unicode-5.0 additions */ |
| 107 {HB_TAG('D','F','L','T')}, /* HB_SCRIPT_UNKNOWN */ |
| 108 {HB_TAG('b','a','l','i')}, /* HB_SCRIPT_BALINESE */ |
| 109 {HB_TAG('x','s','u','x')}, /* HB_SCRIPT_CUNEIFORM */ |
| 110 {HB_TAG('p','h','n','x')}, /* HB_SCRIPT_PHOENICIAN */ |
| 111 {HB_TAG('p','h','a','g')}, /* HB_SCRIPT_PHAGS_PA */ |
| 112 {HB_TAG('n','k','o',' ')}, /* HB_SCRIPT_NKO */ |
| 113 |
| 114 /* Unicode-5.1 additions */ |
| 115 {HB_TAG('k','a','l','i')}, /* HB_SCRIPT_KAYAH_LI */ |
| 116 {HB_TAG('l','e','p','c')}, /* HB_SCRIPT_LEPCHA */ |
| 117 {HB_TAG('r','j','n','g')}, /* HB_SCRIPT_REJANG */ |
| 118 {HB_TAG('s','u','n','d')}, /* HB_SCRIPT_SUNDANESE */ |
| 119 {HB_TAG('s','a','u','r')}, /* HB_SCRIPT_SAURASHTRA */ |
| 120 {HB_TAG('c','h','a','m')}, /* HB_SCRIPT_CHAM */ |
| 121 {HB_TAG('o','l','c','k')}, /* HB_SCRIPT_OL_CHIKI */ |
| 122 {HB_TAG('v','a','i',' ')}, /* HB_SCRIPT_VAI */ |
| 123 {HB_TAG('c','a','r','i')}, /* HB_SCRIPT_CARIAN */ |
| 124 {HB_TAG('l','y','c','i')}, /* HB_SCRIPT_LYCIAN */ |
| 125 {HB_TAG('l','y','d','i')}, /* HB_SCRIPT_LYDIAN */ |
| 126 |
| 127 /* Unicode-5.2 additions */ |
| 128 {HB_TAG('a','v','s','t')}, /* HB_SCRIPT_AVESTAN */ |
| 129 {HB_TAG('b','a','m','u')}, /* HB_SCRIPT_BAMUM */ |
| 130 {HB_TAG('e','g','y','p')}, /* HB_SCRIPT_EGYPTIAN_HIEROGLYPHS */ |
| 131 {HB_TAG('a','r','m','i')}, /* HB_SCRIPT_IMPERIAL_ARAMAIC */ |
| 132 {HB_TAG('p','h','l','i')}, /* HB_SCRIPT_INSCRIPTIONAL_PAHLAVI */ |
| 133 {HB_TAG('p','r','t','i')}, /* HB_SCRIPT_INSCRIPTIONAL_PARTHIAN */ |
| 134 {HB_TAG('j','a','v','a')}, /* HB_SCRIPT_JAVANESE */ |
| 135 {HB_TAG('k','t','h','i')}, /* HB_SCRIPT_KAITHI */ |
| 136 {HB_TAG('l','i','s','u')}, /* HB_SCRIPT_LISU */ |
| 137 {HB_TAG('m','y','e','i')}, /* HB_SCRIPT_MEETEI_MAYEK */ |
| 138 {HB_TAG('s','a','r','b')}, /* HB_SCRIPT_OLD_SOUTH_ARABIAN */ |
| 139 {HB_TAG('o','r','k','h')}, /* HB_SCRIPT_OLD_TURKIC */ |
| 140 {HB_TAG('s','a','m','r')}, /* HB_SCRIPT_SAMARITAN */ |
| 141 {HB_TAG('l','a','n','a')}, /* HB_SCRIPT_TAI_THAM */ |
| 142 {HB_TAG('t','a','v','t')}, /* HB_SCRIPT_TAI_VIET */ |
| 143 |
| 144 /* Unicode-6.0 additions */ |
| 145 {HB_TAG('b','a','t','k')}, /* HB_SCRIPT_BATAK */ |
| 146 {HB_TAG('b','r','a','h')}, /* HB_SCRIPT_BRAHMI */ |
| 147 {HB_TAG('m','a','n','d')} /* HB_SCRIPT_MANDAIC */ |
| 148 }; |
| 149 |
| 150 const hb_tag_t * |
| 151 hb_ot_tags_from_script (hb_script_t script) |
| 152 { |
| 153 static const hb_tag_t def_tag[] = {HB_OT_TAG_DEFAULT_SCRIPT, HB_TAG_NONE}; |
| 154 |
| 155 if (unlikely ((unsigned int) script >= ARRAY_LENGTH (ot_scripts))) |
| 156 return def_tag; |
| 157 |
| 158 return ot_scripts[script]; |
| 159 } |
| 160 |
| 161 hb_script_t |
| 162 hb_ot_tag_to_script (hb_tag_t tag) |
| 163 { |
| 164 int i; |
| 165 |
| 166 for (i = 0; i < ARRAY_LENGTH (ot_scripts); i++) { |
| 167 const hb_tag_t *p; |
| 168 for (p = ot_scripts[i]; *p; p++) |
| 169 if (tag == *p) |
| 170 return i; |
| 171 } |
| 172 |
| 173 return HB_SCRIPT_UNKNOWN; |
| 174 } |
| 175 |
| 176 typedef struct { |
| 177 char language[6]; |
| 178 hb_tag_t tag; |
| 179 } LangTag; |
| 180 |
| 181 /* |
| 182 * Complete list at: |
| 183 * http://www.microsoft.com/typography/otspec/languagetags.htm |
| 184 * |
| 185 * Generated by intersecting the OpenType language tag list from |
| 186 * Draft OpenType 1.5 spec, with with the ISO 639-3 codes from |
| 187 * 2008/08/04, matching on name, and finally adjusted manually. |
| 188 * |
| 189 * Many items still missing. Those are commented out at the end. |
| 190 * Keep sorted for bsearch. |
| 191 */ |
| 192 static const LangTag ot_languages[] = { |
| 193 {"aa", HB_TAG('A','F','R',' ')}, /* Afar */ |
| 194 {"ab", HB_TAG('A','B','K',' ')}, /* Abkhazian */ |
| 195 {"abq", HB_TAG('A','B','A',' ')}, /* Abaza */ |
| 196 {"ady", HB_TAG('A','D','Y',' ')}, /* Adyghe */ |
| 197 {"af", HB_TAG('A','F','K',' ')}, /* Afrikaans */ |
| 198 {"aiw", HB_TAG('A','R','I',' ')}, /* Aari */ |
| 199 {"am", HB_TAG('A','M','H',' ')}, /* Amharic */ |
| 200 {"ar", HB_TAG('A','R','A',' ')}, /* Arabic */ |
| 201 {"arn", HB_TAG('M','A','P',' ')}, /* Mapudungun */ |
| 202 {"as", HB_TAG('A','S','M',' ')}, /* Assamese */ |
| 203 {"av", HB_TAG('A','V','R',' ')}, /* Avaric */ |
| 204 {"awa", HB_TAG('A','W','A',' ')}, /* Awadhi */ |
| 205 {"ay", HB_TAG('A','Y','M',' ')}, /* Aymara */ |
| 206 {"az", HB_TAG('A','Z','E',' ')}, /* Azerbaijani */ |
| 207 {"ba", HB_TAG('B','S','H',' ')}, /* Bashkir */ |
| 208 {"bal", HB_TAG('B','L','I',' ')}, /* Baluchi */ |
| 209 {"bcq", HB_TAG('B','C','H',' ')}, /* Bench */ |
| 210 {"bem", HB_TAG('B','E','M',' ')}, /* Bemba (Zambia) */ |
| 211 {"bfq", HB_TAG('B','A','D',' ')}, /* Badaga */ |
| 212 {"bft", HB_TAG('B','L','T',' ')}, /* Balti */ |
| 213 {"bg", HB_TAG('B','G','R',' ')}, /* Bulgarian */ |
| 214 {"bhb", HB_TAG('B','H','I',' ')}, /* Bhili */ |
| 215 {"bho", HB_TAG('B','H','O',' ')}, /* Bhojpuri */ |
| 216 {"bik", HB_TAG('B','I','K',' ')}, /* Bikol */ |
| 217 {"bin", HB_TAG('E','D','O',' ')}, /* Bini */ |
| 218 {"bm", HB_TAG('B','M','B',' ')}, /* Bambara */ |
| 219 {"bn", HB_TAG('B','E','N',' ')}, /* Bengali */ |
| 220 {"bo", HB_TAG('T','I','B',' ')}, /* Tibetan */ |
| 221 {"br", HB_TAG('B','R','E',' ')}, /* Breton */ |
| 222 {"brh", HB_TAG('B','R','H',' ')}, /* Brahui */ |
| 223 {"bs", HB_TAG('B','O','S',' ')}, /* Bosnian */ |
| 224 {"btb", HB_TAG('B','T','I',' ')}, /* Beti (Cameroon) */ |
| 225 {"ca", HB_TAG('C','A','T',' ')}, /* Catalan */ |
| 226 {"ce", HB_TAG('C','H','E',' ')}, /* Chechen */ |
| 227 {"ceb", HB_TAG('C','E','B',' ')}, /* Cebuano */ |
| 228 {"chp", HB_TAG('C','H','P',' ')}, /* Chipewyan */ |
| 229 {"chr", HB_TAG('C','H','R',' ')}, /* Cherokee */ |
| 230 {"cop", HB_TAG('C','O','P',' ')}, /* Coptic */ |
| 231 {"cr", HB_TAG('C','R','E',' ')}, /* Cree */ |
| 232 {"crh", HB_TAG('C','R','T',' ')}, /* Crimean Tatar */ |
| 233 {"crm", HB_TAG('M','C','R',' ')}, /* Moose Cree */ |
| 234 {"crx", HB_TAG('C','R','R',' ')}, /* Carrier */ |
| 235 {"cs", HB_TAG('C','S','Y',' ')}, /* Czech */ |
| 236 {"cu", HB_TAG('C','S','L',' ')}, /* Church Slavic */ |
| 237 {"cv", HB_TAG('C','H','U',' ')}, /* Chuvash */ |
| 238 {"cwd", HB_TAG('D','C','R',' ')}, /* Woods Cree */ |
| 239 {"cy", HB_TAG('W','E','L',' ')}, /* Welsh */ |
| 240 {"da", HB_TAG('D','A','N',' ')}, /* Danish */ |
| 241 {"dap", HB_TAG('N','I','S',' ')}, /* Nisi (India) */ |
| 242 {"dar", HB_TAG('D','A','R',' ')}, /* Dargwa */ |
| 243 {"de", HB_TAG('D','E','U',' ')}, /* German */ |
| 244 {"din", HB_TAG('D','N','K',' ')}, /* Dinka */ |
| 245 {"dng", HB_TAG('D','U','N',' ')}, /* Dungan */ |
| 246 {"doi", HB_TAG('D','G','R',' ')}, /* Dogri */ |
| 247 {"dsb", HB_TAG('L','S','B',' ')}, /* Lower Sorbian */ |
| 248 {"dv", HB_TAG('D','I','V',' ')}, /* Dhivehi */ |
| 249 {"dz", HB_TAG('D','Z','N',' ')}, /* Dzongkha */ |
| 250 {"ee", HB_TAG('E','W','E',' ')}, /* Ewe */ |
| 251 {"efi", HB_TAG('E','F','I',' ')}, /* Efik */ |
| 252 {"el", HB_TAG('E','L','L',' ')}, /* Modern Greek (1453-) */ |
| 253 {"en", HB_TAG('E','N','G',' ')}, /* English */ |
| 254 {"eo", HB_TAG('N','T','O',' ')}, /* Esperanto */ |
| 255 {"eot", HB_TAG('B','T','I',' ')}, /* Beti (Côte d'Ivoire) */ |
| 256 {"es", HB_TAG('E','S','P',' ')}, /* Spanish */ |
| 257 {"et", HB_TAG('E','T','I',' ')}, /* Estonian */ |
| 258 {"eu", HB_TAG('E','U','Q',' ')}, /* Basque */ |
| 259 {"eve", HB_TAG('E','V','N',' ')}, /* Even */ |
| 260 {"evn", HB_TAG('E','V','K',' ')}, /* Evenki */ |
| 261 {"fa", HB_TAG('F','A','R',' ')}, /* Persian */ |
| 262 {"ff", HB_TAG('F','U','L',' ')}, /* Fulah */ |
| 263 {"fi", HB_TAG('F','I','N',' ')}, /* Finnish */ |
| 264 {"fil", HB_TAG('P','I','L',' ')}, /* Filipino */ |
| 265 {"fj", HB_TAG('F','J','I',' ')}, /* Fijian */ |
| 266 {"fo", HB_TAG('F','O','S',' ')}, /* Faroese */ |
| 267 {"fon", HB_TAG('F','O','N',' ')}, /* Fon */ |
| 268 {"fr", HB_TAG('F','R','A',' ')}, /* French */ |
| 269 {"fur", HB_TAG('F','R','L',' ')}, /* Friulian */ |
| 270 {"fy", HB_TAG('F','R','I',' ')}, /* Western Frisian */ |
| 271 {"ga", HB_TAG('I','R','I',' ')}, /* Irish */ |
| 272 {"gaa", HB_TAG('G','A','D',' ')}, /* Ga */ |
| 273 {"gag", HB_TAG('G','A','G',' ')}, /* Gagauz */ |
| 274 {"gbm", HB_TAG('G','A','W',' ')}, /* Garhwali */ |
| 275 {"gd", HB_TAG('G','A','E',' ')}, /* Scottish Gaelic */ |
| 276 {"gl", HB_TAG('G','A','L',' ')}, /* Galician */ |
| 277 {"gld", HB_TAG('N','A','N',' ')}, /* Nanai */ |
| 278 {"gn", HB_TAG('G','U','A',' ')}, /* Guarani */ |
| 279 {"gon", HB_TAG('G','O','N',' ')}, /* Gondi */ |
| 280 {"grt", HB_TAG('G','R','O',' ')}, /* Garo */ |
| 281 {"gu", HB_TAG('G','U','J',' ')}, /* Gujarati */ |
| 282 {"guk", HB_TAG('G','M','Z',' ')}, /* Gumuz */ |
| 283 {"gv", HB_TAG('M','N','X',' ')}, /* Manx Gaelic */ |
| 284 {"ha", HB_TAG('H','A','U',' ')}, /* Hausa */ |
| 285 {"har", HB_TAG('H','R','I',' ')}, /* Harari */ |
| 286 {"he", HB_TAG('I','W','R',' ')}, /* Hebrew */ |
| 287 {"hi", HB_TAG('H','I','N',' ')}, /* Hindi */ |
| 288 {"hil", HB_TAG('H','I','L',' ')}, /* Hiligaynon */ |
| 289 {"hoc", HB_TAG('H','O',' ',' ')}, /* Ho */ |
| 290 {"hr", HB_TAG('H','R','V',' ')}, /* Croatian */ |
| 291 {"hsb", HB_TAG('U','S','B',' ')}, /* Upper Sorbian */ |
| 292 {"ht", HB_TAG('H','A','I',' ')}, /* Haitian */ |
| 293 {"hu", HB_TAG('H','U','N',' ')}, /* Hungarian */ |
| 294 {"hy", HB_TAG('H','Y','E',' ')}, /* Armenian */ |
| 295 {"id", HB_TAG('I','N','D',' ')}, /* Indonesian */ |
| 296 {"ig", HB_TAG('I','B','O',' ')}, /* Igbo */ |
| 297 {"igb", HB_TAG('E','B','I',' ')}, /* Ebira */ |
| 298 {"inh", HB_TAG('I','N','G',' ')}, /* Ingush */ |
| 299 {"is", HB_TAG('I','S','L',' ')}, /* Icelandic */ |
| 300 {"it", HB_TAG('I','T','A',' ')}, /* Italian */ |
| 301 {"iu", HB_TAG('I','N','U',' ')}, /* Inuktitut */ |
| 302 {"ja", HB_TAG('J','A','N',' ')}, /* Japanese */ |
| 303 {"jv", HB_TAG('J','A','V',' ')}, /* Javanese */ |
| 304 {"ka", HB_TAG('K','A','T',' ')}, /* Georgian */ |
| 305 {"kam", HB_TAG('K','M','B',' ')}, /* Kamba (Kenya) */ |
| 306 {"kbd", HB_TAG('K','A','B',' ')}, /* Kabardian */ |
| 307 {"kdr", HB_TAG('K','R','M',' ')}, /* Karaim */ |
| 308 {"kdt", HB_TAG('K','U','Y',' ')}, /* Kuy */ |
| 309 {"kfr", HB_TAG('K','A','C',' ')}, /* Kachchi */ |
| 310 {"kfy", HB_TAG('K','M','N',' ')}, /* Kumaoni */ |
| 311 {"kha", HB_TAG('K','S','I',' ')}, /* Khasi */ |
| 312 {"khw", HB_TAG('K','H','W',' ')}, /* Khowar */ |
| 313 {"ki", HB_TAG('K','I','K',' ')}, /* Kikuyu */ |
| 314 {"kk", HB_TAG('K','A','Z',' ')}, /* Kazakh */ |
| 315 {"kl", HB_TAG('G','R','N',' ')}, /* Kalaallisut */ |
| 316 {"kln", HB_TAG('K','A','L',' ')}, /* Kalenjin */ |
| 317 {"km", HB_TAG('K','H','M',' ')}, /* Central Khmer */ |
| 318 {"kmw", HB_TAG('K','M','O',' ')}, /* Komo (Democratic Republic of
Congo) */ |
| 319 {"kn", HB_TAG('K','A','N',' ')}, /* Kannada */ |
| 320 {"ko", HB_TAG('K','O','R',' ')}, /* Korean */ |
| 321 {"koi", HB_TAG('K','O','P',' ')}, /* Komi-Permyak */ |
| 322 {"kok", HB_TAG('K','O','K',' ')}, /* Konkani */ |
| 323 {"kpe", HB_TAG('K','P','L',' ')}, /* Kpelle */ |
| 324 {"kpv", HB_TAG('K','O','Z',' ')}, /* Komi-Zyrian */ |
| 325 {"kpy", HB_TAG('K','Y','K',' ')}, /* Koryak */ |
| 326 {"kqy", HB_TAG('K','R','T',' ')}, /* Koorete */ |
| 327 {"kr", HB_TAG('K','N','R',' ')}, /* Kanuri */ |
| 328 {"kri", HB_TAG('K','R','I',' ')}, /* Krio */ |
| 329 {"krl", HB_TAG('K','R','L',' ')}, /* Karelian */ |
| 330 {"kru", HB_TAG('K','U','U',' ')}, /* Kurukh */ |
| 331 {"ks", HB_TAG('K','S','H',' ')}, /* Kashmiri */ |
| 332 {"ku", HB_TAG('K','U','R',' ')}, /* Kurdish */ |
| 333 {"kum", HB_TAG('K','U','M',' ')}, /* Kumyk */ |
| 334 {"kvd", HB_TAG('K','U','I',' ')}, /* Kui (Indonesia) */ |
| 335 {"kxu", HB_TAG('K','U','I',' ')}, /* Kui (India) */ |
| 336 {"ky", HB_TAG('K','I','R',' ')}, /* Kirghiz */ |
| 337 {"la", HB_TAG('L','A','T',' ')}, /* Latin */ |
| 338 {"lad", HB_TAG('J','U','D',' ')}, /* Ladino */ |
| 339 {"lb", HB_TAG('L','T','Z',' ')}, /* Luxembourgish */ |
| 340 {"lbe", HB_TAG('L','A','K',' ')}, /* Lak */ |
| 341 {"lbj", HB_TAG('L','D','K',' ')}, /* Ladakhi */ |
| 342 {"lif", HB_TAG('L','M','B',' ')}, /* Limbu */ |
| 343 {"lld", HB_TAG('L','A','D',' ')}, /* Ladin */ |
| 344 {"ln", HB_TAG('L','I','N',' ')}, /* Lingala */ |
| 345 {"lo", HB_TAG('L','A','O',' ')}, /* Lao */ |
| 346 {"lt", HB_TAG('L','T','H',' ')}, /* Lithuanian */ |
| 347 {"luo", HB_TAG('L','U','O',' ')}, /* Luo (Kenya and Tanzania) */ |
| 348 {"luw", HB_TAG('L','U','O',' ')}, /* Luo (Cameroon) */ |
| 349 {"lv", HB_TAG('L','V','I',' ')}, /* Latvian */ |
| 350 {"lzz", HB_TAG('L','A','Z',' ')}, /* Laz */ |
| 351 {"mai", HB_TAG('M','T','H',' ')}, /* Maithili */ |
| 352 {"mdc", HB_TAG('M','L','E',' ')}, /* Male (Papua New Guinea) */ |
| 353 {"mdf", HB_TAG('M','O','K',' ')}, /* Moksha */ |
| 354 {"mdy", HB_TAG('M','L','E',' ')}, /* Male (Ethiopia) */ |
| 355 {"men", HB_TAG('M','D','E',' ')}, /* Mende (Sierra Leone) */ |
| 356 {"mg", HB_TAG('M','L','G',' ')}, /* Malagasy */ |
| 357 {"mi", HB_TAG('M','R','I',' ')}, /* Maori */ |
| 358 {"mk", HB_TAG('M','K','D',' ')}, /* Macedonian */ |
| 359 {"ml", HB_TAG('M','L','R',' ')}, /* Malayalam */ |
| 360 {"mn", HB_TAG('M','N','G',' ')}, /* Mongolian */ |
| 361 {"mnc", HB_TAG('M','C','H',' ')}, /* Manchu */ |
| 362 {"mni", HB_TAG('M','N','I',' ')}, /* Manipuri */ |
| 363 {"mnk", HB_TAG('M','N','D',' ')}, /* Mandinka */ |
| 364 {"mns", HB_TAG('M','A','N',' ')}, /* Mansi */ |
| 365 {"mnw", HB_TAG('M','O','N',' ')}, /* Mon */ |
| 366 {"mo", HB_TAG('M','O','L',' ')}, /* Moldavian */ |
| 367 {"moh", HB_TAG('M','O','H',' ')}, /* Mohawk */ |
| 368 {"mpe", HB_TAG('M','A','J',' ')}, /* Majang */ |
| 369 {"mr", HB_TAG('M','A','R',' ')}, /* Marathi */ |
| 370 {"ms", HB_TAG('M','L','Y',' ')}, /* Malay */ |
| 371 {"mt", HB_TAG('M','T','S',' ')}, /* Maltese */ |
| 372 {"mwr", HB_TAG('M','A','W',' ')}, /* Marwari */ |
| 373 {"my", HB_TAG('B','R','M',' ')}, /* Burmese */ |
| 374 {"mym", HB_TAG('M','E','N',' ')}, /* Me'en */ |
| 375 {"myv", HB_TAG('E','R','Z',' ')}, /* Erzya */ |
| 376 {"nb", HB_TAG('N','O','R',' ')}, /* Norwegian Bokmål */ |
| 377 {"nco", HB_TAG('S','I','B',' ')}, /* Sibe */ |
| 378 {"ne", HB_TAG('N','E','P',' ')}, /* Nepali */ |
| 379 {"new", HB_TAG('N','E','W',' ')}, /* Newari */ |
| 380 {"ng", HB_TAG('N','D','G',' ')}, /* Ndonga */ |
| 381 {"ngl", HB_TAG('L','M','W',' ')}, /* Lomwe */ |
| 382 {"niu", HB_TAG('N','I','U',' ')}, /* Niuean */ |
| 383 {"niv", HB_TAG('G','I','L',' ')}, /* Gilyak */ |
| 384 {"nl", HB_TAG('N','L','D',' ')}, /* Dutch */ |
| 385 {"nn", HB_TAG('N','Y','N',' ')}, /* Norwegian Nynorsk */ |
| 386 {"no", HB_TAG('N','O','R',' ')}, /* Norwegian (deprecated) */ |
| 387 {"nog", HB_TAG('N','O','G',' ')}, /* Nogai */ |
| 388 {"nqo", HB_TAG('N','K','O',' ')}, /* N'Ko */ |
| 389 {"nsk", HB_TAG('N','A','S',' ')}, /* Naskapi */ |
| 390 {"ny", HB_TAG('C','H','I',' ')}, /* Nyanja */ |
| 391 {"oc", HB_TAG('O','C','I',' ')}, /* Occitan (post 1500) */ |
| 392 {"oj", HB_TAG('O','J','B',' ')}, /* Ojibwa */ |
| 393 {"om", HB_TAG('O','R','O',' ')}, /* Oromo */ |
| 394 {"or", HB_TAG('O','R','I',' ')}, /* Oriya */ |
| 395 {"os", HB_TAG('O','S','S',' ')}, /* Ossetian */ |
| 396 {"pa", HB_TAG('P','A','N',' ')}, /* Panjabi */ |
| 397 {"pi", HB_TAG('P','A','L',' ')}, /* Pali */ |
| 398 {"pl", HB_TAG('P','L','K',' ')}, /* Polish */ |
| 399 {"plp", HB_TAG('P','A','P',' ')}, /* Palpa */ |
| 400 {"prs", HB_TAG('D','R','I',' ')}, /* Dari */ |
| 401 {"ps", HB_TAG('P','A','S',' ')}, /* Pushto */ |
| 402 {"pt", HB_TAG('P','T','G',' ')}, /* Portuguese */ |
| 403 {"raj", HB_TAG('R','A','J',' ')}, /* Rajasthani */ |
| 404 {"ria", HB_TAG('R','I','A',' ')}, /* Riang (India) */ |
| 405 {"ril", HB_TAG('R','I','A',' ')}, /* Riang (Myanmar) */ |
| 406 {"ro", HB_TAG('R','O','M',' ')}, /* Romanian */ |
| 407 {"rom", HB_TAG('R','O','Y',' ')}, /* Romany */ |
| 408 {"ru", HB_TAG('R','U','S',' ')}, /* Russian */ |
| 409 {"rue", HB_TAG('R','S','Y',' ')}, /* Rusyn */ |
| 410 {"sa", HB_TAG('S','A','N',' ')}, /* Sanskrit */ |
| 411 {"sah", HB_TAG('Y','A','K',' ')}, /* Yakut */ |
| 412 {"sat", HB_TAG('S','A','T',' ')}, /* Santali */ |
| 413 {"sck", HB_TAG('S','A','D',' ')}, /* Sadri */ |
| 414 {"sd", HB_TAG('S','N','D',' ')}, /* Sindhi */ |
| 415 {"se", HB_TAG('N','S','M',' ')}, /* Northern Sami */ |
| 416 {"seh", HB_TAG('S','N','A',' ')}, /* Sena */ |
| 417 {"sel", HB_TAG('S','E','L',' ')}, /* Selkup */ |
| 418 {"sg", HB_TAG('S','G','O',' ')}, /* Sango */ |
| 419 {"shn", HB_TAG('S','H','N',' ')}, /* Shan */ |
| 420 {"si", HB_TAG('S','N','H',' ')}, /* Sinhala */ |
| 421 {"sid", HB_TAG('S','I','D',' ')}, /* Sidamo */ |
| 422 {"sjd", HB_TAG('K','S','M',' ')}, /* Kildin Sami */ |
| 423 {"sk", HB_TAG('S','K','Y',' ')}, /* Slovak */ |
| 424 {"skr", HB_TAG('S','R','K',' ')}, /* Seraiki */ |
| 425 {"sl", HB_TAG('S','L','V',' ')}, /* Slovenian */ |
| 426 {"sm", HB_TAG('S','M','O',' ')}, /* Samoan */ |
| 427 {"sma", HB_TAG('S','S','M',' ')}, /* Southern Sami */ |
| 428 {"smj", HB_TAG('L','S','M',' ')}, /* Lule Sami */ |
| 429 {"smn", HB_TAG('I','S','M',' ')}, /* Inari Sami */ |
| 430 {"sms", HB_TAG('S','K','S',' ')}, /* Skolt Sami */ |
| 431 {"snk", HB_TAG('S','N','K',' ')}, /* Soninke */ |
| 432 {"so", HB_TAG('S','M','L',' ')}, /* Somali */ |
| 433 {"sq", HB_TAG('S','Q','I',' ')}, /* Albanian */ |
| 434 {"sr", HB_TAG('S','R','B',' ')}, /* Serbian */ |
| 435 {"srr", HB_TAG('S','R','R',' ')}, /* Serer */ |
| 436 {"suq", HB_TAG('S','U','R',' ')}, /* Suri */ |
| 437 {"sv", HB_TAG('S','V','E',' ')}, /* Swedish */ |
| 438 {"sva", HB_TAG('S','V','A',' ')}, /* Svan */ |
| 439 {"sw", HB_TAG('S','W','K',' ')}, /* Swahili */ |
| 440 {"swb", HB_TAG('C','M','R',' ')}, /* Comorian */ |
| 441 {"syr", HB_TAG('S','Y','R',' ')}, /* Syriac */ |
| 442 {"ta", HB_TAG('T','A','M',' ')}, /* Tamil */ |
| 443 {"tcy", HB_TAG('T','U','L',' ')}, /* Tulu */ |
| 444 {"te", HB_TAG('T','E','L',' ')}, /* Telugu */ |
| 445 {"tg", HB_TAG('T','A','J',' ')}, /* Tajik */ |
| 446 {"th", HB_TAG('T','H','A',' ')}, /* Thai */ |
| 447 {"ti", HB_TAG('T','G','Y',' ')}, /* Tigrinya */ |
| 448 {"tig", HB_TAG('T','G','R',' ')}, /* Tigre */ |
| 449 {"tk", HB_TAG('T','K','M',' ')}, /* Turkmen */ |
| 450 {"tn", HB_TAG('T','N','A',' ')}, /* Tswana */ |
| 451 {"tnz", HB_TAG('T','N','G',' ')}, /* Tonga (Thailand) */ |
| 452 {"to", HB_TAG('T','N','G',' ')}, /* Tonga (Tonga Islands) */ |
| 453 {"tog", HB_TAG('T','N','G',' ')}, /* Tonga (Nyasa) */ |
| 454 {"toi", HB_TAG('T','N','G',' ')}, /* Tonga (Zambia) */ |
| 455 {"tr", HB_TAG('T','R','K',' ')}, /* Turkish */ |
| 456 {"ts", HB_TAG('T','S','G',' ')}, /* Tsonga */ |
| 457 {"tt", HB_TAG('T','A','T',' ')}, /* Tatar */ |
| 458 {"tw", HB_TAG('T','W','I',' ')}, /* Twi */ |
| 459 {"ty", HB_TAG('T','H','T',' ')}, /* Tahitian */ |
| 460 {"udm", HB_TAG('U','D','M',' ')}, /* Udmurt */ |
| 461 {"ug", HB_TAG('U','Y','G',' ')}, /* Uighur */ |
| 462 {"uk", HB_TAG('U','K','R',' ')}, /* Ukrainian */ |
| 463 {"unr", HB_TAG('M','U','N',' ')}, /* Mundari */ |
| 464 {"ur", HB_TAG('U','R','D',' ')}, /* Urdu */ |
| 465 {"uz", HB_TAG('U','Z','B',' ')}, /* Uzbek */ |
| 466 {"ve", HB_TAG('V','E','N',' ')}, /* Venda */ |
| 467 {"vi", HB_TAG('V','I','T',' ')}, /* Vietnamese */ |
| 468 {"wbm", HB_TAG('W','A',' ',' ')}, /* Wa */ |
| 469 {"wbr", HB_TAG('W','A','G',' ')}, /* Wagdi */ |
| 470 {"wo", HB_TAG('W','L','F',' ')}, /* Wolof */ |
| 471 {"xal", HB_TAG('K','L','M',' ')}, /* Kalmyk */ |
| 472 {"xh", HB_TAG('X','H','S',' ')}, /* Xhosa */ |
| 473 {"xom", HB_TAG('K','M','O',' ')}, /* Komo (Sudan) */ |
| 474 {"xsl", HB_TAG('S','S','L',' ')}, /* South Slavey */ |
| 475 {"yi", HB_TAG('J','I','I',' ')}, /* Yiddish */ |
| 476 {"yo", HB_TAG('Y','B','A',' ')}, /* Yoruba */ |
| 477 {"yso", HB_TAG('N','I','S',' ')}, /* Nisi (China) */ |
| 478 {"zh-cn", HB_TAG('Z','H','S',' ')}, /* Chinese (China) */ |
| 479 {"zh-hk", HB_TAG('Z','H','H',' ')}, /* Chinese (Hong Kong) */ |
| 480 {"zh-mo", HB_TAG('Z','H','T',' ')}, /* Chinese (Macao) */ |
| 481 {"zh-sg", HB_TAG('Z','H','S',' ')}, /* Chinese (Singapore) */ |
| 482 {"zh-tw", HB_TAG('Z','H','T',' ')}, /* Chinese (Taiwan) */ |
| 483 {"zne", HB_TAG('Z','N','D',' ')}, /* Zande */ |
| 484 {"zu", HB_TAG('Z','U','L',' ')} /* Zulu */ |
| 485 |
| 486 /* I couldn't find the language id for these */ |
| 487 |
| 488 /*{"??", HB_TAG('A','G','W',' ')},*/ /* Agaw */ |
| 489 /*{"??", HB_TAG('A','L','S',' ')},*/ /* Alsatian */ |
| 490 /*{"??", HB_TAG('A','L','T',' ')},*/ /* Altai */ |
| 491 /*{"??", HB_TAG('A','R','K',' ')},*/ /* Arakanese */ |
| 492 /*{"??", HB_TAG('A','T','H',' ')},*/ /* Athapaskan */ |
| 493 /*{"??", HB_TAG('B','A','G',' ')},*/ /* Baghelkhandi */ |
| 494 /*{"??", HB_TAG('B','A','L',' ')},*/ /* Balkar */ |
| 495 /*{"??", HB_TAG('B','A','U',' ')},*/ /* Baule */ |
| 496 /*{"??", HB_TAG('B','B','R',' ')},*/ /* Berber */ |
| 497 /*{"??", HB_TAG('B','C','R',' ')},*/ /* Bible Cree */ |
| 498 /*{"??", HB_TAG('B','E','L',' ')},*/ /* Belarussian */ |
| 499 /*{"??", HB_TAG('B','I','L',' ')},*/ /* Bilen */ |
| 500 /*{"??", HB_TAG('B','K','F',' ')},*/ /* Blackfoot */ |
| 501 /*{"??", HB_TAG('B','L','N',' ')},*/ /* Balante */ |
| 502 /*{"??", HB_TAG('B','M','L',' ')},*/ /* Bamileke */ |
| 503 /*{"??", HB_TAG('B','R','I',' ')},*/ /* Braj Bhasha */ |
| 504 /*{"??", HB_TAG('C','H','G',' ')},*/ /* Chaha Gurage */ |
| 505 /*{"??", HB_TAG('C','H','H',' ')},*/ /* Chattisgarhi */ |
| 506 /*{"??", HB_TAG('C','H','K',' ')},*/ /* Chukchi */ |
| 507 /*{"??", HB_TAG('D','J','R',' ')},*/ /* Djerma */ |
| 508 /*{"??", HB_TAG('D','N','G',' ')},*/ /* Dangme */ |
| 509 /*{"??", HB_TAG('E','C','R',' ')},*/ /* Eastern Cree */ |
| 510 /*{"??", HB_TAG('F','A','N',' ')},*/ /* French Antillean */ |
| 511 /*{"??", HB_TAG('F','L','E',' ')},*/ /* Flemish */ |
| 512 /*{"??", HB_TAG('F','N','E',' ')},*/ /* Forest Nenets */ |
| 513 /*{"??", HB_TAG('F','T','A',' ')},*/ /* Futa */ |
| 514 /*{"??", HB_TAG('G','A','R',' ')},*/ /* Garshuni */ |
| 515 /*{"??", HB_TAG('G','E','Z',' ')},*/ /* Ge'ez */ |
| 516 /*{"??", HB_TAG('H','A','L',' ')},*/ /* Halam */ |
| 517 /*{"??", HB_TAG('H','A','R',' ')},*/ /* Harauti */ |
| 518 /*{"??", HB_TAG('H','A','W',' ')},*/ /* Hawaiin */ |
| 519 /*{"??", HB_TAG('H','B','N',' ')},*/ /* Hammer-Banna */ |
| 520 /*{"??", HB_TAG('H','M','A',' ')},*/ /* High Mari */ |
| 521 /*{"??", HB_TAG('H','N','D',' ')},*/ /* Hindko */ |
| 522 /*{"??", HB_TAG('I','J','O',' ')},*/ /* Ijo */ |
| 523 /*{"??", HB_TAG('I','L','O',' ')},*/ /* Ilokano */ |
| 524 /*{"??", HB_TAG('I','R','T',' ')},*/ /* Irish Traditional */ |
| 525 /*{"??", HB_TAG('J','U','L',' ')},*/ /* Jula */ |
| 526 /*{"??", HB_TAG('K','A','R',' ')},*/ /* Karachay */ |
| 527 /*{"??", HB_TAG('K','E','B',' ')},*/ /* Kebena */ |
| 528 /*{"??", HB_TAG('K','G','E',' ')},*/ /* Khutsuri Georgian */ |
| 529 /*{"??", HB_TAG('K','H','A',' ')},*/ /* Khakass */ |
| 530 /*{"??", HB_TAG('K','H','K',' ')},*/ /* Khanty-Kazim */ |
| 531 /*{"??", HB_TAG('K','H','S',' ')},*/ /* Khanty-Shurishkar */ |
| 532 /*{"??", HB_TAG('K','H','V',' ')},*/ /* Khanty-Vakhi */ |
| 533 /*{"??", HB_TAG('K','I','S',' ')},*/ /* Kisii */ |
| 534 /*{"??", HB_TAG('K','K','N',' ')},*/ /* Kokni */ |
| 535 /*{"??", HB_TAG('K','M','S',' ')},*/ /* Komso */ |
| 536 /*{"??", HB_TAG('K','O','D',' ')},*/ /* Kodagu */ |
| 537 /*{"??", HB_TAG('K','O','H',' ')},*/ /* Korean Old Hangul */ |
| 538 /*{"??", HB_TAG('K','O','N',' ')},*/ /* Kikongo */ |
| 539 /*{"??", HB_TAG('K','R','K',' ')},*/ /* Karakalpak */ |
| 540 /*{"??", HB_TAG('K','R','N',' ')},*/ /* Karen */ |
| 541 /*{"??", HB_TAG('K','U','L',' ')},*/ /* Kulvi */ |
| 542 /*{"??", HB_TAG('L','A','H',' ')},*/ /* Lahuli */ |
| 543 /*{"??", HB_TAG('L','A','M',' ')},*/ /* Lambani */ |
| 544 /*{"??", HB_TAG('L','C','R',' ')},*/ /* L-Cree */ |
| 545 /*{"??", HB_TAG('L','E','Z',' ')},*/ /* Lezgi */ |
| 546 /*{"??", HB_TAG('L','M','A',' ')},*/ /* Low Mari */ |
| 547 /*{"??", HB_TAG('L','U','B',' ')},*/ /* Luba */ |
| 548 /*{"??", HB_TAG('L','U','G',' ')},*/ /* Luganda */ |
| 549 /*{"??", HB_TAG('L','U','H',' ')},*/ /* Luhya */ |
| 550 /*{"??", HB_TAG('M','A','K',' ')},*/ /* Makua */ |
| 551 /*{"??", HB_TAG('M','A','L',' ')},*/ /* Malayalam Traditional */ |
| 552 /*{"??", HB_TAG('M','B','N',' ')},*/ /* Mbundu */ |
| 553 /*{"??", HB_TAG('M','I','Z',' ')},*/ /* Mizo */ |
| 554 /*{"??", HB_TAG('M','L','N',' ')},*/ /* Malinke */ |
| 555 /*{"??", HB_TAG('M','N','K',' ')},*/ /* Maninka */ |
| 556 /*{"??", HB_TAG('M','O','R',' ')},*/ /* Moroccan */ |
| 557 /*{"??", HB_TAG('N','A','G',' ')},*/ /* Naga-Assamese */ |
| 558 /*{"??", HB_TAG('N','C','R',' ')},*/ /* N-Cree */ |
| 559 /*{"??", HB_TAG('N','D','B',' ')},*/ /* Ndebele */ |
| 560 /*{"??", HB_TAG('N','G','R',' ')},*/ /* Nagari */ |
| 561 /*{"??", HB_TAG('N','H','C',' ')},*/ /* Norway House Cree */ |
| 562 /*{"??", HB_TAG('N','K','L',' ')},*/ /* Nkole */ |
| 563 /*{"??", HB_TAG('N','T','A',' ')},*/ /* Northern Tai */ |
| 564 /*{"??", HB_TAG('O','C','R',' ')},*/ /* Oji-Cree */ |
| 565 /*{"??", HB_TAG('P','A','A',' ')},*/ /* Palestinian Aramaic */ |
| 566 /*{"??", HB_TAG('P','G','R',' ')},*/ /* Polytonic Greek */ |
| 567 /*{"??", HB_TAG('P','L','G',' ')},*/ /* Palaung */ |
| 568 /*{"??", HB_TAG('Q','I','N',' ')},*/ /* Chin */ |
| 569 /*{"??", HB_TAG('R','B','U',' ')},*/ /* Russian Buriat */ |
| 570 /*{"??", HB_TAG('R','C','R',' ')},*/ /* R-Cree */ |
| 571 /*{"??", HB_TAG('R','M','S',' ')},*/ /* Rhaeto-Romanic */ |
| 572 /*{"??", HB_TAG('R','U','A',' ')},*/ /* Ruanda */ |
| 573 /*{"??", HB_TAG('S','A','Y',' ')},*/ /* Sayisi */ |
| 574 /*{"??", HB_TAG('S','E','K',' ')},*/ /* Sekota */ |
| 575 /*{"??", HB_TAG('S','I','G',' ')},*/ /* Silte Gurage */ |
| 576 /*{"??", HB_TAG('S','L','A',' ')},*/ /* Slavey */ |
| 577 /*{"??", HB_TAG('S','O','G',' ')},*/ /* Sodo Gurage */ |
| 578 /*{"??", HB_TAG('S','O','T',' ')},*/ /* Sotho */ |
| 579 /*{"??", HB_TAG('S','W','A',' ')},*/ /* Swadaya Aramaic */ |
| 580 /*{"??", HB_TAG('S','W','Z',' ')},*/ /* Swazi */ |
| 581 /*{"??", HB_TAG('S','X','T',' ')},*/ /* Sutu */ |
| 582 /*{"??", HB_TAG('T','A','B',' ')},*/ /* Tabasaran */ |
| 583 /*{"??", HB_TAG('T','C','R',' ')},*/ /* TH-Cree */ |
| 584 /*{"??", HB_TAG('T','G','N',' ')},*/ /* Tongan */ |
| 585 /*{"??", HB_TAG('T','M','N',' ')},*/ /* Temne */ |
| 586 /*{"??", HB_TAG('T','N','E',' ')},*/ /* Tundra Nenets */ |
| 587 /*{"??", HB_TAG('T','O','D',' ')},*/ /* Todo */ |
| 588 /*{"??", HB_TAG('T','U','A',' ')},*/ /* Turoyo Aramaic */ |
| 589 /*{"??", HB_TAG('T','U','V',' ')},*/ /* Tuvin */ |
| 590 /*{"??", HB_TAG('W','C','R',' ')},*/ /* West-Cree */ |
| 591 /*{"??", HB_TAG('X','B','D',' ')},*/ /* Tai Lue */ |
| 592 /*{"??", HB_TAG('Y','C','R',' ')},*/ /* Y-Cree */ |
| 593 /*{"??", HB_TAG('Y','I','C',' ')},*/ /* Yi Classic */ |
| 594 /*{"??", HB_TAG('Y','I','M',' ')},*/ /* Yi Modern */ |
| 595 /*{"??", HB_TAG('Z','H','P',' ')},*/ /* Chinese Phonetic */ |
| 596 }; |
| 597 |
| 598 static int |
| 599 lang_compare_first_component (const char *a, |
| 600 const char *b) |
| 601 { |
| 602 unsigned int da, db; |
| 603 const char *p; |
| 604 |
| 605 p = strstr (a, "-"); |
| 606 da = p ? (unsigned int) (p - a) : strlen (a); |
| 607 |
| 608 p = strstr (b, "-"); |
| 609 db = p ? (unsigned int) (p - b) : strlen (b); |
| 610 |
| 611 return strncmp (a, b, MAX (da, db)); |
| 612 } |
| 613 |
| 614 static hb_bool_t |
| 615 lang_matches (const char *lang_str, const char *spec) |
| 616 { |
| 617 unsigned int len = strlen (spec); |
| 618 |
| 619 return lang_str && strncmp (lang_str, spec, len) == 0 && |
| 620 (lang_str[len] == '\0' || lang_str[len] == '-'); |
| 621 } |
| 622 |
| 623 hb_tag_t |
| 624 hb_ot_tag_from_language (hb_language_t language) |
| 625 { |
| 626 const char *lang_str; |
| 627 LangTag *lang_tag; |
| 628 |
| 629 if (language == NULL) |
| 630 return HB_OT_TAG_DEFAULT_LANGUAGE; |
| 631 |
| 632 lang_str = hb_language_to_string (language); |
| 633 |
| 634 if (0 == strcmp (lang_str, "x-hbot")) { |
| 635 char tag[4]; |
| 636 int i; |
| 637 lang_str += 6; |
| 638 #define IS_LETTER(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) |
| 639 #define TO_UPPER(c) (((c) >= 'a' && (c) <= 'z') ? (c) + 'A' - 'a' : (c)) |
| 640 for (i = 0; i < 4 && IS_LETTER (lang_str[i]); i++) |
| 641 tag[i] = TO_UPPER (lang_str[i]); |
| 642 for (; i < 4; i++) |
| 643 tag[i] = ' '; |
| 644 return HB_TAG_STR (tag); |
| 645 } |
| 646 |
| 647 /* find a language matching in the first component */ |
| 648 lang_tag = bsearch (lang_str, ot_languages, |
| 649 ARRAY_LENGTH (ot_languages), sizeof (LangTag), |
| 650 (hb_compare_func_t) lang_compare_first_component); |
| 651 |
| 652 /* we now need to find the best language matching */ |
| 653 if (lang_tag) |
| 654 { |
| 655 hb_bool_t found = FALSE; |
| 656 |
| 657 /* go to the final one matching in the first component */ |
| 658 while (lang_tag + 1 < ot_languages + ARRAY_LENGTH (ot_languages) && |
| 659 lang_compare_first_component (lang_str, (lang_tag + 1)->language) ==
0) |
| 660 lang_tag++; |
| 661 |
| 662 /* go back, find which one matches completely */ |
| 663 while (lang_tag >= ot_languages && |
| 664 lang_compare_first_component (lang_str, lang_tag->language) == 0) |
| 665 { |
| 666 if (lang_matches (lang_str, lang_tag->language)) { |
| 667 found = TRUE; |
| 668 break; |
| 669 } |
| 670 |
| 671 lang_tag--; |
| 672 } |
| 673 |
| 674 if (!found) |
| 675 lang_tag = NULL; |
| 676 } |
| 677 |
| 678 if (lang_tag) |
| 679 return lang_tag->tag; |
| 680 |
| 681 return HB_OT_TAG_DEFAULT_LANGUAGE; |
| 682 } |
| 683 |
| 684 hb_language_t |
| 685 hb_ot_tag_to_language (hb_tag_t tag) |
| 686 { |
| 687 unsigned int i; |
| 688 unsigned char buf[11] = "x-hbot"; |
| 689 |
| 690 for (i = 0; i < ARRAY_LENGTH (ot_languages); i++) |
| 691 if (ot_languages[i].tag == tag) |
| 692 return hb_language_from_string (ot_languages[i].language); |
| 693 |
| 694 buf[6] = tag >> 24; |
| 695 buf[7] = (tag >> 16) & 0xFF; |
| 696 buf[8] = (tag >> 8) & 0xFF; |
| 697 buf[9] = tag & 0xFF; |
| 698 buf[10] = '\0'; |
| 699 return hb_language_from_string ((char *) buf); |
| 700 } |
| 701 |
| 702 |
| 703 HB_END_DECLS |
OLD | NEW |