gfx/harfbuzz/src/hb-ot-tag.cc

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /*
michael@0 2 * Copyright © 2009 Red Hat, Inc.
michael@0 3 * Copyright © 2011 Google, Inc.
michael@0 4 *
michael@0 5 * This is part of HarfBuzz, a text shaping library.
michael@0 6 *
michael@0 7 * Permission is hereby granted, without written agreement and without
michael@0 8 * license or royalty fees, to use, copy, modify, and distribute this
michael@0 9 * software and its documentation for any purpose, provided that the
michael@0 10 * above copyright notice and the following two paragraphs appear in
michael@0 11 * all copies of this software.
michael@0 12 *
michael@0 13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
michael@0 14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
michael@0 15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
michael@0 16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
michael@0 17 * DAMAGE.
michael@0 18 *
michael@0 19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
michael@0 20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
michael@0 21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
michael@0 22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
michael@0 23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
michael@0 24 *
michael@0 25 * Red Hat Author(s): Behdad Esfahbod
michael@0 26 * Google Author(s): Behdad Esfahbod, Roozbeh Pournader
michael@0 27 */
michael@0 28
michael@0 29 #include "hb-private.hh"
michael@0 30
michael@0 31 #include <string.h>
michael@0 32
michael@0 33
michael@0 34
michael@0 35 /* hb_script_t */
michael@0 36
michael@0 37 static hb_tag_t
michael@0 38 hb_ot_old_tag_from_script (hb_script_t script)
michael@0 39 {
michael@0 40 /* This seems to be accurate as of end of 2012. */
michael@0 41
michael@0 42 switch ((hb_tag_t) script) {
michael@0 43 case HB_SCRIPT_INVALID: return HB_OT_TAG_DEFAULT_SCRIPT;
michael@0 44
michael@0 45 /* KATAKANA and HIRAGANA both map to 'kana' */
michael@0 46 case HB_SCRIPT_HIRAGANA: return HB_TAG('k','a','n','a');
michael@0 47
michael@0 48 /* Spaces at the end are preserved, unlike ISO 15924 */
michael@0 49 case HB_SCRIPT_LAO: return HB_TAG('l','a','o',' ');
michael@0 50 case HB_SCRIPT_YI: return HB_TAG('y','i',' ',' ');
michael@0 51 /* Unicode-5.0 additions */
michael@0 52 case HB_SCRIPT_NKO: return HB_TAG('n','k','o',' ');
michael@0 53 /* Unicode-5.1 additions */
michael@0 54 case HB_SCRIPT_VAI: return HB_TAG('v','a','i',' ');
michael@0 55 /* Unicode-5.2 additions */
michael@0 56 /* Unicode-6.0 additions */
michael@0 57 }
michael@0 58
michael@0 59 /* Else, just change first char to lowercase and return */
michael@0 60 return ((hb_tag_t) script) | 0x20000000;
michael@0 61 }
michael@0 62
michael@0 63 static hb_script_t
michael@0 64 hb_ot_old_tag_to_script (hb_tag_t tag)
michael@0 65 {
michael@0 66 if (unlikely (tag == HB_OT_TAG_DEFAULT_SCRIPT))
michael@0 67 return HB_SCRIPT_INVALID;
michael@0 68
michael@0 69 /* This side of the conversion is fully algorithmic. */
michael@0 70
michael@0 71 /* Any spaces at the end of the tag are replaced by repeating the last
michael@0 72 * letter. Eg 'nko ' -> 'Nkoo' */
michael@0 73 if (unlikely ((tag & 0x0000FF00) == 0x00002000))
michael@0 74 tag |= (tag >> 8) & 0x0000FF00; /* Copy second letter to third */
michael@0 75 if (unlikely ((tag & 0x000000FF) == 0x00000020))
michael@0 76 tag |= (tag >> 8) & 0x000000FF; /* Copy third letter to fourth */
michael@0 77
michael@0 78 /* Change first char to uppercase and return */
michael@0 79 return (hb_script_t) (tag & ~0x20000000);
michael@0 80 }
michael@0 81
michael@0 82 static hb_tag_t
michael@0 83 hb_ot_new_tag_from_script (hb_script_t script)
michael@0 84 {
michael@0 85 switch ((hb_tag_t) script) {
michael@0 86 case HB_SCRIPT_BENGALI: return HB_TAG('b','n','g','2');
michael@0 87 case HB_SCRIPT_DEVANAGARI: return HB_TAG('d','e','v','2');
michael@0 88 case HB_SCRIPT_GUJARATI: return HB_TAG('g','j','r','2');
michael@0 89 case HB_SCRIPT_GURMUKHI: return HB_TAG('g','u','r','2');
michael@0 90 case HB_SCRIPT_KANNADA: return HB_TAG('k','n','d','2');
michael@0 91 case HB_SCRIPT_MALAYALAM: return HB_TAG('m','l','m','2');
michael@0 92 case HB_SCRIPT_ORIYA: return HB_TAG('o','r','y','2');
michael@0 93 case HB_SCRIPT_TAMIL: return HB_TAG('t','m','l','2');
michael@0 94 case HB_SCRIPT_TELUGU: return HB_TAG('t','e','l','2');
michael@0 95 case HB_SCRIPT_MYANMAR: return HB_TAG('m','y','m','2');
michael@0 96 }
michael@0 97
michael@0 98 return HB_OT_TAG_DEFAULT_SCRIPT;
michael@0 99 }
michael@0 100
michael@0 101 static hb_script_t
michael@0 102 hb_ot_new_tag_to_script (hb_tag_t tag)
michael@0 103 {
michael@0 104 switch (tag) {
michael@0 105 case HB_TAG('b','n','g','2'): return HB_SCRIPT_BENGALI;
michael@0 106 case HB_TAG('d','e','v','2'): return HB_SCRIPT_DEVANAGARI;
michael@0 107 case HB_TAG('g','j','r','2'): return HB_SCRIPT_GUJARATI;
michael@0 108 case HB_TAG('g','u','r','2'): return HB_SCRIPT_GURMUKHI;
michael@0 109 case HB_TAG('k','n','d','2'): return HB_SCRIPT_KANNADA;
michael@0 110 case HB_TAG('m','l','m','2'): return HB_SCRIPT_MALAYALAM;
michael@0 111 case HB_TAG('o','r','y','2'): return HB_SCRIPT_ORIYA;
michael@0 112 case HB_TAG('t','m','l','2'): return HB_SCRIPT_TAMIL;
michael@0 113 case HB_TAG('t','e','l','2'): return HB_SCRIPT_TELUGU;
michael@0 114 case HB_TAG('m','y','m','2'): return HB_SCRIPT_MYANMAR;
michael@0 115 }
michael@0 116
michael@0 117 return HB_SCRIPT_UNKNOWN;
michael@0 118 }
michael@0 119
michael@0 120 /*
michael@0 121 * Complete list at:
michael@0 122 * https://www.microsoft.com/typography/otspec/scripttags.htm
michael@0 123 * https://www.microsoft.com/typography/otspec160/scripttagsProposed.htm
michael@0 124 *
michael@0 125 * Most of the script tags are the same as the ISO 15924 tag but lowercased.
michael@0 126 * So we just do that, and handle the exceptional cases in a switch.
michael@0 127 */
michael@0 128
michael@0 129 void
michael@0 130 hb_ot_tags_from_script (hb_script_t script,
michael@0 131 hb_tag_t *script_tag_1,
michael@0 132 hb_tag_t *script_tag_2)
michael@0 133 {
michael@0 134 hb_tag_t new_tag;
michael@0 135
michael@0 136 *script_tag_2 = HB_OT_TAG_DEFAULT_SCRIPT;
michael@0 137 *script_tag_1 = hb_ot_old_tag_from_script (script);
michael@0 138
michael@0 139 new_tag = hb_ot_new_tag_from_script (script);
michael@0 140 if (unlikely (new_tag != HB_OT_TAG_DEFAULT_SCRIPT)) {
michael@0 141 *script_tag_2 = *script_tag_1;
michael@0 142 *script_tag_1 = new_tag;
michael@0 143 }
michael@0 144 }
michael@0 145
michael@0 146 hb_script_t
michael@0 147 hb_ot_tag_to_script (hb_tag_t tag)
michael@0 148 {
michael@0 149 if (unlikely ((tag & 0x000000FF) == '2'))
michael@0 150 return hb_ot_new_tag_to_script (tag);
michael@0 151
michael@0 152 return hb_ot_old_tag_to_script (tag);
michael@0 153 }
michael@0 154
michael@0 155
michael@0 156 /* hb_language_t */
michael@0 157
michael@0 158 typedef struct {
michael@0 159 char language[6];
michael@0 160 hb_tag_t tag;
michael@0 161 } LangTag;
michael@0 162
michael@0 163 /*
michael@0 164 * Complete list at:
michael@0 165 * http://www.microsoft.com/typography/otspec/languagetags.htm
michael@0 166 *
michael@0 167 * Generated by intersecting the OpenType language tag list from
michael@0 168 * Draft OpenType 1.5 spec, with with the ISO 639-3 codes from
michael@0 169 * 2008-08-04, matching on name, and finally adjusted manually.
michael@0 170 *
michael@0 171 * Updated on 2012-12-07 with more research into remaining codes.
michael@0 172 *
michael@0 173 * Updated on 2013-11-23 based on usage in SIL and Microsoft fonts,
michael@0 174 * the new proposal from Microsoft, and latest ISO 639-3 names.
michael@0 175 *
michael@0 176 * Some items still missing. Those are commented out at the end.
michael@0 177 * Keep sorted for bsearch.
michael@0 178 */
michael@0 179
michael@0 180 static const LangTag ot_languages[] = {
michael@0 181 {"aa", HB_TAG('A','F','R',' ')}, /* Afar */
michael@0 182 {"ab", HB_TAG('A','B','K',' ')}, /* Abkhazian */
michael@0 183 {"abq", HB_TAG('A','B','A',' ')}, /* Abaza */
michael@0 184 {"ach", HB_TAG('A','C','H',' ')}, /* Acoli */
michael@0 185 {"ada", HB_TAG('D','N','G',' ')}, /* Dangme */
michael@0 186 {"ady", HB_TAG('A','D','Y',' ')}, /* Adyghe */
michael@0 187 {"af", HB_TAG('A','F','K',' ')}, /* Afrikaans */
michael@0 188 {"aii", HB_TAG('S','W','A',' ')}, /* Swadaya Aramaic */
michael@0 189 {"aio", HB_TAG('A','I','O',' ')}, /* Aiton */
michael@0 190 {"aiw", HB_TAG('A','R','I',' ')}, /* Aari */
michael@0 191 {"ak", HB_TAG('T','W','I',' ')}, /* Akan [macrolanguage] */
michael@0 192 {"alt", HB_TAG('A','L','T',' ')}, /* [Southern] Altai */
michael@0 193 {"am", HB_TAG('A','M','H',' ')}, /* Amharic */
michael@0 194 {"amf", HB_TAG('H','B','N',' ')}, /* Hammer-Banna */
michael@0 195 {"an", HB_TAG('A','R','G',' ')}, /* Aragonese */
michael@0 196 {"ang", HB_TAG('A','N','G',' ')}, /* Old English (ca. 450-1100) */
michael@0 197 {"ar", HB_TAG('A','R','A',' ')}, /* Arabic [macrolanguage] */
michael@0 198 {"arb", HB_TAG('A','R','A',' ')}, /* Standard Arabic */
michael@0 199 {"arn", HB_TAG('M','A','P',' ')}, /* Mapudungun */
michael@0 200 {"ary", HB_TAG('M','O','R',' ')}, /* Moroccan Arabic */
michael@0 201 {"as", HB_TAG('A','S','M',' ')}, /* Assamese */
michael@0 202 {"ast", HB_TAG('A','S','T',' ')}, /* Asturian/Asturleonese/Bable/Leonese */
michael@0 203 {"ath", HB_TAG('A','T','H',' ')}, /* Athapaskan [family] */
michael@0 204 {"atv", HB_TAG('A','L','T',' ')}, /* [Northern] Altai */
michael@0 205 {"av", HB_TAG('A','V','R',' ')}, /* Avaric */
michael@0 206 {"awa", HB_TAG('A','W','A',' ')}, /* Awadhi */
michael@0 207 {"ay", HB_TAG('A','Y','M',' ')}, /* Aymara [macrolanguage] */
michael@0 208 {"az", HB_TAG('A','Z','E',' ')}, /* Azerbaijani [macrolanguage] */
michael@0 209 {"azb", HB_TAG('A','Z','B',' ')}, /* South Azerbaijani */
michael@0 210 {"azj", HB_TAG('A','Z','E',' ')}, /* North Azerbaijani */
michael@0 211 {"ba", HB_TAG('B','S','H',' ')}, /* Bashkir */
michael@0 212 {"bai", HB_TAG('B','M','L',' ')}, /* Bamileke [family] */
michael@0 213 {"bal", HB_TAG('B','L','I',' ')}, /* Baluchi [macrolangauge] */
michael@0 214 {"ban", HB_TAG('B','A','N',' ')}, /* Balinese */
michael@0 215 {"bar", HB_TAG('B','A','R',' ')}, /* Bavarian */
michael@0 216 {"bbc", HB_TAG('B','B','C',' ')}, /* Batak Toba */
michael@0 217 {"bci", HB_TAG('B','A','U',' ')}, /* Baoulé */
michael@0 218 {"bcl", HB_TAG('B','I','K',' ')}, /* Central Bikol */
michael@0 219 {"bcq", HB_TAG('B','C','H',' ')}, /* Bench */
michael@0 220 {"be", HB_TAG('B','E','L',' ')}, /* Belarusian */
michael@0 221 {"bem", HB_TAG('B','E','M',' ')}, /* Bemba (Zambia) */
michael@0 222 {"ber", HB_TAG('B','E','R',' ')}, /* Berber [family] */
michael@0 223 {"bfq", HB_TAG('B','A','D',' ')}, /* Badaga */
michael@0 224 {"bft", HB_TAG('B','L','T',' ')}, /* Balti */
michael@0 225 {"bfy", HB_TAG('B','A','G',' ')}, /* Baghelkhandi */
michael@0 226 {"bg", HB_TAG('B','G','R',' ')}, /* Bulgarian */
michael@0 227 {"bgc", HB_TAG('B','G','C',' ')}, /* Haryanvi */
michael@0 228 {"bgq", HB_TAG('B','G','Q',' ')}, /* Bagri */
michael@0 229 {"bhb", HB_TAG('B','H','I',' ')}, /* Bhili */
michael@0 230 {"bhk", HB_TAG('B','I','K',' ')}, /* Albay Bicolano (retired code) */
michael@0 231 {"bho", HB_TAG('B','H','O',' ')}, /* Bhojpuri */
michael@0 232 {"bi", HB_TAG('B','I','S',' ')}, /* Bislama */
michael@0 233 {"bik", HB_TAG('B','I','K',' ')}, /* Bikol [macrolanguage] */
michael@0 234 {"bin", HB_TAG('E','D','O',' ')}, /* Bini */
michael@0 235 {"bjj", HB_TAG('B','J','J',' ')}, /* Kanauji */
michael@0 236 {"bjt", HB_TAG('B','L','N',' ')}, /* Balanta-Ganja */
michael@0 237 {"bla", HB_TAG('B','K','F',' ')}, /* Blackfoot */
michael@0 238 {"ble", HB_TAG('B','L','N',' ')}, /* Balanta-Kentohe */
michael@0 239 {"blk", HB_TAG('B','L','K',' ')}, /* Pa'O/Pa'o Karen */
michael@0 240 {"bln", HB_TAG('B','I','K',' ')}, /* Southern Catanduanes Bikol */
michael@0 241 {"bm", HB_TAG('B','M','B',' ')}, /* Bambara */
michael@0 242 {"bn", HB_TAG('B','E','N',' ')}, /* Bengali */
michael@0 243 {"bo", HB_TAG('T','I','B',' ')}, /* Tibetan */
michael@0 244 {"bpy", HB_TAG('B','P','Y',' ')}, /* Bishnupriya */
michael@0 245 {"bqi", HB_TAG('L','R','C',' ')}, /* Bakhtiari */
michael@0 246 {"br", HB_TAG('B','R','E',' ')}, /* Breton */
michael@0 247 {"bra", HB_TAG('B','R','I',' ')}, /* Braj Bhasha */
michael@0 248 {"brh", HB_TAG('B','R','H',' ')}, /* Brahui */
michael@0 249 {"brx", HB_TAG('B','R','X',' ')}, /* Bodo (India) */
michael@0 250 {"bs", HB_TAG('B','O','S',' ')}, /* Bosnian */
michael@0 251 {"btb", HB_TAG('B','T','I',' ')}, /* Beti (Cameroon) */
michael@0 252 {"bto", HB_TAG('B','I','K',' ')}, /* Rinconada Bikol */
michael@0 253 {"bts", HB_TAG('B','T','S',' ')}, /* Batak Simalungun */
michael@0 254 {"bug", HB_TAG('B','U','G',' ')}, /* Buginese */
michael@0 255 {"bxr", HB_TAG('R','B','U',' ')}, /* Russian Buriat */
michael@0 256 {"byn", HB_TAG('B','I','L',' ')}, /* Bilen */
michael@0 257 {"ca", HB_TAG('C','A','T',' ')}, /* Catalan */
michael@0 258 {"cbk", HB_TAG('C','B','K',' ')}, /* Chavacano */
michael@0 259 {"ce", HB_TAG('C','H','E',' ')}, /* Chechen */
michael@0 260 {"ceb", HB_TAG('C','E','B',' ')}, /* Cebuano */
michael@0 261 {"cgg", HB_TAG('C','G','G',' ')}, /* Chiga */
michael@0 262 {"ch", HB_TAG('C','H','A',' ')}, /* Chamorro */
michael@0 263 {"cho", HB_TAG('C','H','O',' ')}, /* Choctaw */
michael@0 264 {"chp", HB_TAG('C','H','P',' ')}, /* Chipewyan */
michael@0 265 {"chr", HB_TAG('C','H','R',' ')}, /* Cherokee */
michael@0 266 {"chy", HB_TAG('C','H','Y',' ')}, /* Cheyenne */
michael@0 267 {"ckb", HB_TAG('K','U','R',' ')}, /* Central Kurdish (Sorani) */
michael@0 268 {"ckt", HB_TAG('C','H','K',' ')}, /* Chukchi */
michael@0 269 {"cop", HB_TAG('C','O','P',' ')}, /* Coptic */
michael@0 270 {"cr", HB_TAG('C','R','E',' ')}, /* Cree */
michael@0 271 {"crh", HB_TAG('C','R','T',' ')}, /* Crimean Tatar */
michael@0 272 {"crj", HB_TAG('E','C','R',' ')}, /* [Southern] East Cree */
michael@0 273 {"crl", HB_TAG('E','C','R',' ')}, /* [Northern] East Cree */
michael@0 274 {"crm", HB_TAG('M','C','R',' ')}, /* Moose Cree */
michael@0 275 {"crx", HB_TAG('C','R','R',' ')}, /* Carrier */
michael@0 276 {"cs", HB_TAG('C','S','Y',' ')}, /* Czech */
michael@0 277 {"csb", HB_TAG('C','S','B',' ')}, /* Kashubian */
michael@0 278 {"ctg", HB_TAG('C','T','G',' ')}, /* Chittagonian */
michael@0 279 {"cts", HB_TAG('B','I','K',' ')}, /* Northern Catanduanes Bikol */
michael@0 280 {"cu", HB_TAG('C','S','L',' ')}, /* Church Slavic */
michael@0 281 {"cv", HB_TAG('C','H','U',' ')}, /* Chuvash */
michael@0 282 {"cwd", HB_TAG('D','C','R',' ')}, /* Woods Cree */
michael@0 283 {"cy", HB_TAG('W','E','L',' ')}, /* Welsh */
michael@0 284 {"da", HB_TAG('D','A','N',' ')}, /* Danish */
michael@0 285 {"dap", HB_TAG('N','I','S',' ')}, /* Nisi (India) */
michael@0 286 {"dar", HB_TAG('D','A','R',' ')}, /* Dargwa */
michael@0 287 {"de", HB_TAG('D','E','U',' ')}, /* German */
michael@0 288 {"dgo", HB_TAG('D','G','O',' ')}, /* Dogri */
michael@0 289 {"dhd", HB_TAG('M','A','W',' ')}, /* Dhundari */
michael@0 290 {"din", HB_TAG('D','N','K',' ')}, /* Dinka [macrolanguage] */
michael@0 291 {"diq", HB_TAG('D','I','Q',' ')}, /* Dimli */
michael@0 292 {"dje", HB_TAG('D','J','R',' ')}, /* Zarma */
michael@0 293 {"dng", HB_TAG('D','U','N',' ')}, /* Dungan */
michael@0 294 {"doi", HB_TAG('D','G','R',' ')}, /* Dogri [macrolanguage] */
michael@0 295 {"dsb", HB_TAG('L','S','B',' ')}, /* Lower Sorbian */
michael@0 296 {"dv", HB_TAG('D','I','V',' ')}, /* Dhivehi/Divehi/Maldivian */
michael@0 297 {"dyu", HB_TAG('J','U','L',' ')}, /* Jula */
michael@0 298 {"dz", HB_TAG('D','Z','N',' ')}, /* Dzongkha */
michael@0 299 {"ee", HB_TAG('E','W','E',' ')}, /* Ewe */
michael@0 300 {"efi", HB_TAG('E','F','I',' ')}, /* Efik */
michael@0 301 {"ekk", HB_TAG('E','T','I',' ')}, /* Standard Estonian */
michael@0 302 {"el", HB_TAG('E','L','L',' ')}, /* Modern Greek (1453-) */
michael@0 303 {"emk", HB_TAG('M','N','K',' ')}, /* Eastern Maninkakan */
michael@0 304 {"en", HB_TAG('E','N','G',' ')}, /* English */
michael@0 305 {"eo", HB_TAG('N','T','O',' ')}, /* Esperanto */
michael@0 306 {"eot", HB_TAG('B','T','I',' ')}, /* Beti (Côte d'Ivoire) */
michael@0 307 {"es", HB_TAG('E','S','P',' ')}, /* Spanish */
michael@0 308 {"et", HB_TAG('E','T','I',' ')}, /* Estonian [macrolanguage] */
michael@0 309 {"eu", HB_TAG('E','U','Q',' ')}, /* Basque */
michael@0 310 {"eve", HB_TAG('E','V','N',' ')}, /* Even */
michael@0 311 {"evn", HB_TAG('E','V','K',' ')}, /* Evenki */
michael@0 312 {"fa", HB_TAG('F','A','R',' ')}, /* Persian [macrolanguage] */
michael@0 313 {"ff", HB_TAG('F','U','L',' ')}, /* Fulah [macrolanguage] */
michael@0 314 {"fi", HB_TAG('F','I','N',' ')}, /* Finnish */
michael@0 315 {"fil", HB_TAG('P','I','L',' ')}, /* Filipino */
michael@0 316 {"fj", HB_TAG('F','J','I',' ')}, /* Fijian */
michael@0 317 {"fo", HB_TAG('F','O','S',' ')}, /* Faroese */
michael@0 318 {"fon", HB_TAG('F','O','N',' ')}, /* Fon */
michael@0 319 {"fr", HB_TAG('F','R','A',' ')}, /* French */
michael@0 320 {"frc", HB_TAG('F','R','C',' ')}, /* Cajun French */
michael@0 321 {"frp", HB_TAG('F','R','P',' ')}, /* Arpitan/Francoprovençal */
michael@0 322 {"fur", HB_TAG('F','R','L',' ')}, /* Friulian */
michael@0 323 {"fuv", HB_TAG('F','U','V',' ')}, /* Nigerian Fulfulde */
michael@0 324 {"fy", HB_TAG('F','R','I',' ')}, /* Western Frisian */
michael@0 325 {"ga", HB_TAG('I','R','I',' ')}, /* Irish */
michael@0 326 {"gaa", HB_TAG('G','A','D',' ')}, /* Ga */
michael@0 327 {"gag", HB_TAG('G','A','G',' ')}, /* Gagauz */
michael@0 328 {"gbm", HB_TAG('G','A','W',' ')}, /* Garhwali */
michael@0 329 {"gd", HB_TAG('G','A','E',' ')}, /* Scottish Gaelic */
michael@0 330 {"gez", HB_TAG('G','E','Z',' ')}, /* Ge'ez */
michael@0 331 {"ggo", HB_TAG('G','O','N',' ')}, /* Southern Gondi */
michael@0 332 {"gl", HB_TAG('G','A','L',' ')}, /* Galician */
michael@0 333 {"gld", HB_TAG('N','A','N',' ')}, /* Nanai */
michael@0 334 {"glk", HB_TAG('G','L','K',' ')}, /* Gilaki */
michael@0 335 {"gn", HB_TAG('G','U','A',' ')}, /* Guarani [macrolanguage] */
michael@0 336 {"gno", HB_TAG('G','O','N',' ')}, /* Northern Gondi */
michael@0 337 {"gog", HB_TAG('G','O','G',' ')}, /* Gogo */
michael@0 338 {"gon", HB_TAG('G','O','N',' ')}, /* Gondi [macrolanguage] */
michael@0 339 {"grt", HB_TAG('G','R','O',' ')}, /* Garo */
michael@0 340 {"gru", HB_TAG('S','O','G',' ')}, /* Sodo Gurage */
michael@0 341 {"gu", HB_TAG('G','U','J',' ')}, /* Gujarati */
michael@0 342 {"guc", HB_TAG('G','U','C',' ')}, /* Wayuu */
michael@0 343 {"guk", HB_TAG('G','M','Z',' ')}, /* Gumuz */
michael@0 344 /*{"guk", HB_TAG('G','U','K',' ')},*/ /* Gumuz (in SIL fonts) */
michael@0 345 {"guz", HB_TAG('G','U','Z',' ')}, /* Ekegusii/Gusii */
michael@0 346 {"gv", HB_TAG('M','N','X',' ')}, /* Manx */
michael@0 347 {"ha", HB_TAG('H','A','U',' ')}, /* Hausa */
michael@0 348 {"har", HB_TAG('H','R','I',' ')}, /* Harari */
michael@0 349 {"haw", HB_TAG('H','A','W',' ')}, /* Hawaiian */
michael@0 350 {"hay", HB_TAG('H','A','Y',' ')}, /* Haya */
michael@0 351 {"haz", HB_TAG('H','A','Z',' ')}, /* Hazaragi */
michael@0 352 {"he", HB_TAG('I','W','R',' ')}, /* Hebrew */
michael@0 353 {"hz", HB_TAG('H','E','R',' ')}, /* Herero */
michael@0 354 {"hi", HB_TAG('H','I','N',' ')}, /* Hindi */
michael@0 355 {"hil", HB_TAG('H','I','L',' ')}, /* Hiligaynon */
michael@0 356 {"hnd", HB_TAG('H','N','D',' ')}, /* [Southern] Hindko */
michael@0 357 {"hne", HB_TAG('C','H','H',' ')}, /* Chattisgarhi */
michael@0 358 {"hno", HB_TAG('H','N','D',' ')}, /* [Northern] Hindko */
michael@0 359 {"ho", HB_TAG('H','M','O',' ')}, /* Hiri Motu */
michael@0 360 {"hoc", HB_TAG('H','O',' ',' ')}, /* Ho */
michael@0 361 {"hoj", HB_TAG('H','A','R',' ')}, /* Harauti */
michael@0 362 {"hr", HB_TAG('H','R','V',' ')}, /* Croatian */
michael@0 363 {"hsb", HB_TAG('U','S','B',' ')}, /* Upper Sorbian */
michael@0 364 {"ht", HB_TAG('H','A','I',' ')}, /* Haitian/Haitian Creole */
michael@0 365 {"hu", HB_TAG('H','U','N',' ')}, /* Hungarian */
michael@0 366 {"hy", HB_TAG('H','Y','E',' ')}, /* Armenian */
michael@0 367 {"hz", HB_TAG('H','E','R',' ')}, /* Herero */
michael@0 368 {"ia", HB_TAG('I','N','A',' ')}, /* Interlingua (International Auxiliary Language Association) */
michael@0 369 {"ibb", HB_TAG('I','B','B',' ')}, /* Ibibio */
michael@0 370 {"id", HB_TAG('I','N','D',' ')}, /* Indonesian */
michael@0 371 {"ie", HB_TAG('I','L','E',' ')}, /* Interlingue/Occidental */
michael@0 372 {"ig", HB_TAG('I','B','O',' ')}, /* Igbo */
michael@0 373 {"igb", HB_TAG('E','B','I',' ')}, /* Ebira */
michael@0 374 {"ijc", HB_TAG('I','J','O',' ')}, /* Izon */
michael@0 375 {"ijo", HB_TAG('I','J','O',' ')}, /* Ijo [family] */
michael@0 376 {"ik", HB_TAG('I','P','K',' ')}, /* Inupiaq [macrolanguage] */
michael@0 377 {"ilo", HB_TAG('I','L','O',' ')}, /* Ilokano */
michael@0 378 {"inh", HB_TAG('I','N','G',' ')}, /* Ingush */
michael@0 379 {"io", HB_TAG('I','D','O',' ')}, /* Ido */
michael@0 380 {"is", HB_TAG('I','S','L',' ')}, /* Icelandic */
michael@0 381 {"it", HB_TAG('I','T','A',' ')}, /* Italian */
michael@0 382 {"iu", HB_TAG('I','N','U',' ')}, /* Inuktitut [macrolanguage] */
michael@0 383 {"ja", HB_TAG('J','A','N',' ')}, /* Japanese */
michael@0 384 {"jam", HB_TAG('J','A','M',' ')}, /* Jamaican Creole English */
michael@0 385 {"jbo", HB_TAG('J','B','O',' ')}, /* Lojban */
michael@0 386 {"jv", HB_TAG('J','A','V',' ')}, /* Javanese */
michael@0 387 {"ka", HB_TAG('K','A','T',' ')}, /* Georgian */
michael@0 388 {"kaa", HB_TAG('K','R','K',' ')}, /* Karakalpak */
michael@0 389 {"kab", HB_TAG('K','A','B',' ')}, /* Kabyle */
michael@0 390 {"kam", HB_TAG('K','M','B',' ')}, /* Kamba (Kenya) */
michael@0 391 {"kar", HB_TAG('K','R','N',' ')}, /* Karen [family] */
michael@0 392 {"kbd", HB_TAG('K','A','B',' ')}, /* Kabardian */
michael@0 393 {"kde", HB_TAG('K','D','E',' ')}, /* Makonde */
michael@0 394 {"kdr", HB_TAG('K','R','M',' ')}, /* Karaim */
michael@0 395 {"kdt", HB_TAG('K','U','Y',' ')}, /* Kuy */
michael@0 396 {"kex", HB_TAG('K','K','N',' ')}, /* Kokni */
michael@0 397 {"kfr", HB_TAG('K','A','C',' ')}, /* Kachchi */
michael@0 398 {"kfy", HB_TAG('K','M','N',' ')}, /* Kumaoni */
michael@0 399 {"kg", HB_TAG('K','O','N',' ')}, /* Kongo [macrolanguage] */
michael@0 400 {"kha", HB_TAG('K','S','I',' ')}, /* Khasi */
michael@0 401 {"khb", HB_TAG('X','B','D',' ')}, /* Lü */
michael@0 402 {"kht", HB_TAG('K','H','N',' ')}, /* Khamti (Microsoft fonts) */
michael@0 403 /*{"kht", HB_TAG('K','H','T',' ')},*/ /* Khamti (OpenType spec and SIL fonts) */
michael@0 404 {"khw", HB_TAG('K','H','W',' ')}, /* Khowar */
michael@0 405 {"ki", HB_TAG('K','I','K',' ')}, /* Gikuyu/Kikuyu */
michael@0 406 {"kj", HB_TAG('K','U','A',' ')}, /* Kuanyama/Kwanyama */
michael@0 407 {"kjh", HB_TAG('K','H','A',' ')}, /* Khakass */
michael@0 408 {"kjp", HB_TAG('K','J','P',' ')}, /* Pwo Eastern Karen */
michael@0 409 {"kk", HB_TAG('K','A','Z',' ')}, /* Kazakh */
michael@0 410 {"kl", HB_TAG('G','R','N',' ')}, /* Kalaallisut */
michael@0 411 {"kln", HB_TAG('K','A','L',' ')}, /* Kalenjin */
michael@0 412 {"km", HB_TAG('K','H','M',' ')}, /* Central Khmer */
michael@0 413 {"kmb", HB_TAG('M','B','N',' ')}, /* Kimbundu */
michael@0 414 {"kmw", HB_TAG('K','M','O',' ')}, /* Komo (Democratic Republic of Congo) */
michael@0 415 {"kn", HB_TAG('K','A','N',' ')}, /* Kannada */
michael@0 416 {"knn", HB_TAG('K','O','K',' ')}, /* Konkani */
michael@0 417 {"ko", HB_TAG('K','O','R',' ')}, /* Korean */
michael@0 418 {"koi", HB_TAG('K','O','P',' ')}, /* Komi-Permyak */
michael@0 419 {"kok", HB_TAG('K','O','K',' ')}, /* Konkani [macrolanguage] */
michael@0 420 {"kpe", HB_TAG('K','P','L',' ')}, /* Kpelle [macrolanguage] */
michael@0 421 {"kpv", HB_TAG('K','O','Z',' ')}, /* Komi-Zyrian */
michael@0 422 {"kpy", HB_TAG('K','Y','K',' ')}, /* Koryak */
michael@0 423 {"kqy", HB_TAG('K','R','T',' ')}, /* Koorete */
michael@0 424 {"kr", HB_TAG('K','N','R',' ')}, /* Kanuri [macrolanguage] */
michael@0 425 {"kri", HB_TAG('K','R','I',' ')}, /* Krio */
michael@0 426 {"krl", HB_TAG('K','R','L',' ')}, /* Karelian */
michael@0 427 {"kru", HB_TAG('K','U','U',' ')}, /* Kurukh */
michael@0 428 {"ks", HB_TAG('K','S','H',' ')}, /* Kashmiri */
michael@0 429 {"ksh", HB_TAG('K','S','H',' ')}, /* Kölsch */
michael@0 430 /*{"ksw", HB_TAG('K','R','N',' ')},*/ /* S'gaw Karen (Microsoft fonts?) */
michael@0 431 {"ksw", HB_TAG('K','S','W',' ')}, /* S'gaw Karen (OpenType spec and SIL fonts) */
michael@0 432 {"ku", HB_TAG('K','U','R',' ')}, /* Kurdish [macrolanguage] */
michael@0 433 {"kum", HB_TAG('K','U','M',' ')}, /* Kumyk */
michael@0 434 {"kv", HB_TAG('K','O','M',' ')}, /* Komi [macrolanguage] */
michael@0 435 {"kvd", HB_TAG('K','U','I',' ')}, /* Kui (Indonesia) */
michael@0 436 {"kw", HB_TAG('C','O','R',' ')}, /* Cornish */
michael@0 437 {"kxc", HB_TAG('K','M','S',' ')}, /* Komso */
michael@0 438 {"kxu", HB_TAG('K','U','I',' ')}, /* Kui (India) */
michael@0 439 {"ky", HB_TAG('K','I','R',' ')}, /* Kirghiz/Kyrgyz */
michael@0 440 {"kyu", HB_TAG('K','Y','U',' ')}, /* Western Kayah */
michael@0 441 {"la", HB_TAG('L','A','T',' ')}, /* Latin */
michael@0 442 {"lad", HB_TAG('J','U','D',' ')}, /* Ladino */
michael@0 443 {"lb", HB_TAG('L','T','Z',' ')}, /* Luxembourgish */
michael@0 444 {"lbe", HB_TAG('L','A','K',' ')}, /* Lak */
michael@0 445 {"lbj", HB_TAG('L','D','K',' ')}, /* Ladakhi */
michael@0 446 {"lez", HB_TAG('L','E','Z',' ')}, /* Lezgi */
michael@0 447 {"lg", HB_TAG('L','U','G',' ')}, /* Ganda */
michael@0 448 {"li", HB_TAG('L','I','M',' ')}, /* Limburgan/Limburger/Limburgish */
michael@0 449 {"lif", HB_TAG('L','M','B',' ')}, /* Limbu */
michael@0 450 {"lij", HB_TAG('L','I','J',' ')}, /* Ligurian */
michael@0 451 {"lis", HB_TAG('L','I','S',' ')}, /* Lisu */
michael@0 452 {"ljp", HB_TAG('L','J','P',' ')}, /* Lampung Api */
michael@0 453 {"lki", HB_TAG('L','K','I',' ')}, /* Laki */
michael@0 454 {"lld", HB_TAG('L','A','D',' ')}, /* Ladin */
michael@0 455 {"lmn", HB_TAG('L','A','M',' ')}, /* Lambani */
michael@0 456 {"lmo", HB_TAG('L','M','O',' ')}, /* Lombard */
michael@0 457 {"ln", HB_TAG('L','I','N',' ')}, /* Lingala */
michael@0 458 {"lo", HB_TAG('L','A','O',' ')}, /* Lao */
michael@0 459 {"lrc", HB_TAG('L','R','C',' ')}, /* Northern Luri */
michael@0 460 {"lt", HB_TAG('L','T','H',' ')}, /* Lithuanian */
michael@0 461 {"lu", HB_TAG('L','U','B',' ')}, /* Luba-Katanga */
michael@0 462 {"lua", HB_TAG('L','U','B',' ')}, /* Luba-Kasai */
michael@0 463 {"luo", HB_TAG('L','U','O',' ')}, /* Luo (Kenya and Tanzania) */
michael@0 464 {"lus", HB_TAG('M','I','Z',' ')}, /* Mizo */
michael@0 465 {"luy", HB_TAG('L','U','H',' ')}, /* Luyia/Oluluyia [macrolanguage] */
michael@0 466 {"luz", HB_TAG('L','R','C',' ')}, /* Southern Luri */
michael@0 467 {"lv", HB_TAG('L','V','I',' ')}, /* Latvian */
michael@0 468 {"lzz", HB_TAG('L','A','Z',' ')}, /* Laz */
michael@0 469 {"mad", HB_TAG('M','A','D',' ')}, /* Madurese */
michael@0 470 {"mag", HB_TAG('M','A','G',' ')}, /* Magahi */
michael@0 471 {"mai", HB_TAG('M','T','H',' ')}, /* Maithili */
michael@0 472 {"mak", HB_TAG('M','K','R',' ')}, /* Makasar */
michael@0 473 {"man", HB_TAG('M','N','K',' ')}, /* Manding/Mandingo [macrolanguage] */
michael@0 474 {"mdc", HB_TAG('M','L','E',' ')}, /* Male (Papua New Guinea) */
michael@0 475 {"mdf", HB_TAG('M','O','K',' ')}, /* Moksha */
michael@0 476 {"mdr", HB_TAG('M','D','R',' ')}, /* Mandar */
michael@0 477 {"mdy", HB_TAG('M','L','E',' ')}, /* Male (Ethiopia) */
michael@0 478 {"men", HB_TAG('M','D','E',' ')}, /* Mende (Sierra Leone) */
michael@0 479 {"mer", HB_TAG('M','E','R',' ')}, /* Meru */
michael@0 480 {"mfe", HB_TAG('M','F','E',' ')}, /* Morisyen */
michael@0 481 {"mg", HB_TAG('M','L','G',' ')}, /* Malagasy [macrolanguage] */
michael@0 482 {"mh", HB_TAG('M','A','H',' ')}, /* Marshallese */
michael@0 483 {"mhr", HB_TAG('L','M','A',' ')}, /* Low Mari */
michael@0 484 {"mi", HB_TAG('M','R','I',' ')}, /* Maori */
michael@0 485 {"min", HB_TAG('M','I','N',' ')}, /* Minangkabau */
michael@0 486 {"mk", HB_TAG('M','K','D',' ')}, /* Macedonian */
michael@0 487 {"mku", HB_TAG('M','N','K',' ')}, /* Konyanka Maninka */
michael@0 488 {"mkw", HB_TAG('M','K','W',' ')}, /* Kituba (Congo) */
michael@0 489 {"ml", HB_TAG('M','L','R',' ')}, /* Malayalam */
michael@0 490 {"mlq", HB_TAG('M','N','K',' ')}, /* Western Maninkakan */
michael@0 491 {"mn", HB_TAG('M','N','G',' ')}, /* Mongolian [macrolanguage] */
michael@0 492 {"mnc", HB_TAG('M','C','H',' ')}, /* Manchu */
michael@0 493 {"mni", HB_TAG('M','N','I',' ')}, /* Manipuri */
michael@0 494 {"mnk", HB_TAG('M','N','D',' ')}, /* Mandinka */
michael@0 495 {"mns", HB_TAG('M','A','N',' ')}, /* Mansi */
michael@0 496 {"mnw", HB_TAG('M','O','N',' ')}, /* Mon */
michael@0 497 {"mo", HB_TAG('M','O','L',' ')}, /* Moldavian */
michael@0 498 {"moh", HB_TAG('M','O','H',' ')}, /* Mohawk */
michael@0 499 {"mos", HB_TAG('M','O','S',' ')}, /* Mossi */
michael@0 500 {"mpe", HB_TAG('M','A','J',' ')}, /* Majang */
michael@0 501 {"mr", HB_TAG('M','A','R',' ')}, /* Marathi */
michael@0 502 {"mrj", HB_TAG('H','M','A',' ')}, /* High Mari */
michael@0 503 {"ms", HB_TAG('M','L','Y',' ')}, /* Malay [macrolanguage] */
michael@0 504 {"msc", HB_TAG('M','N','K',' ')}, /* Sankaran Maninka */
michael@0 505 {"mt", HB_TAG('M','T','S',' ')}, /* Maltese */
michael@0 506 {"mtr", HB_TAG('M','A','W',' ')}, /* Mewari */
michael@0 507 {"mus", HB_TAG('M','U','S',' ')}, /* Creek */
michael@0 508 {"mve", HB_TAG('M','A','W',' ')}, /* Marwari (Pakistan) */
michael@0 509 {"mwk", HB_TAG('M','N','K',' ')}, /* Kita Maninkakan */
michael@0 510 {"mwl", HB_TAG('M','W','L',' ')}, /* Mirandese */
michael@0 511 {"mwr", HB_TAG('M','A','W',' ')}, /* Marwari [macrolanguage] */
michael@0 512 {"mww", HB_TAG('M','W','W',' ')}, /* Hmong Daw */
michael@0 513 {"my", HB_TAG('B','R','M',' ')}, /* Burmese */
michael@0 514 {"mym", HB_TAG('M','E','N',' ')}, /* Me'en */
michael@0 515 {"myq", HB_TAG('M','N','K',' ')}, /* Forest Maninka (retired code) */
michael@0 516 {"myv", HB_TAG('E','R','Z',' ')}, /* Erzya */
michael@0 517 {"mzn", HB_TAG('M','Z','N',' ')}, /* Mazanderani */
michael@0 518 {"na", HB_TAG('N','A','U',' ')}, /* Nauru */
michael@0 519 {"nag", HB_TAG('N','A','G',' ')}, /* Naga-Assamese */
michael@0 520 {"nah", HB_TAG('N','A','H',' ')}, /* Nahuatl [family] */
michael@0 521 {"nap", HB_TAG('N','A','P',' ')}, /* Neapolitan */
michael@0 522 {"nb", HB_TAG('N','O','R',' ')}, /* Norwegian Bokmål */
michael@0 523 {"nco", HB_TAG('S','I','B',' ')}, /* Sibe */
michael@0 524 {"nd", HB_TAG('N','D','B',' ')}, /* [North] Ndebele */
michael@0 525 {"ndc", HB_TAG('N','D','C',' ')}, /* Ndau */
michael@0 526 {"nds", HB_TAG('N','D','S',' ')}, /* Low German/Low Saxon */
michael@0 527 {"ne", HB_TAG('N','E','P',' ')}, /* Nepali */
michael@0 528 {"new", HB_TAG('N','E','W',' ')}, /* Newari */
michael@0 529 {"ng", HB_TAG('N','D','G',' ')}, /* Ndonga */
michael@0 530 {"nga", HB_TAG('N','G','A',' ')}, /* Ngabaka */
michael@0 531 {"ngl", HB_TAG('L','M','W',' ')}, /* Lomwe */
michael@0 532 {"niu", HB_TAG('N','I','U',' ')}, /* Niuean */
michael@0 533 {"niv", HB_TAG('G','I','L',' ')}, /* Gilyak */
michael@0 534 {"nl", HB_TAG('N','L','D',' ')}, /* Dutch */
michael@0 535 {"nn", HB_TAG('N','Y','N',' ')}, /* Norwegian Nynorsk */
michael@0 536 {"no", HB_TAG('N','O','R',' ')}, /* Norwegian [macrolanguage] */
michael@0 537 {"nod", HB_TAG('N','T','A',' ')}, /* Northern Thai */
michael@0 538 {"noe", HB_TAG('N','O','E',' ')}, /* Nimadi */
michael@0 539 {"nog", HB_TAG('N','O','G',' ')}, /* Nogai */
michael@0 540 {"nov", HB_TAG('N','O','V',' ')}, /* Novial */
michael@0 541 {"nqo", HB_TAG('N','K','O',' ')}, /* N'Ko */
michael@0 542 {"nr", HB_TAG('N','D','B',' ')}, /* [South] Ndebele */
michael@0 543 {"nsk", HB_TAG('N','A','S',' ')}, /* Naskapi */
michael@0 544 {"nso", HB_TAG('S','O','T',' ')}, /* [Northern] Sotho */
michael@0 545 {"ny", HB_TAG('C','H','I',' ')}, /* Chewa/Chichwa/Nyanja */
michael@0 546 {"nym", HB_TAG('N','Y','M',' ')}, /* Nyamwezi */
michael@0 547 {"nyn", HB_TAG('N','K','L',' ')}, /* Nyankole */
michael@0 548 {"oc", HB_TAG('O','C','I',' ')}, /* Occitan (post 1500) */
michael@0 549 {"oj", HB_TAG('O','J','B',' ')}, /* Ojibwa [macrolanguage] */
michael@0 550 {"ojs", HB_TAG('O','C','R',' ')}, /* Oji-Cree */
michael@0 551 {"om", HB_TAG('O','R','O',' ')}, /* Oromo [macrolanguage] */
michael@0 552 {"or", HB_TAG('O','R','I',' ')}, /* Oriya */
michael@0 553 {"os", HB_TAG('O','S','S',' ')}, /* Ossetian */
michael@0 554 {"pa", HB_TAG('P','A','N',' ')}, /* Panjabi */
michael@0 555 {"pag", HB_TAG('P','A','G',' ')}, /* Pangasinan */
michael@0 556 {"pam", HB_TAG('P','A','M',' ')}, /* Kapampangan/Pampanga */
michael@0 557 {"pap", HB_TAG('P','A','P',' ')}, /* Papiamento */
michael@0 558 {"pcc", HB_TAG('P','C','C',' ')}, /* Bouyei */
michael@0 559 {"pcd", HB_TAG('P','C','D',' ')}, /* Picard */
michael@0 560 {"pce", HB_TAG('P','L','G',' ')}, /* [Ruching] Palaung */
michael@0 561 {"pdc", HB_TAG('P','D','C',' ')}, /* Pennsylvania German */
michael@0 562 {"pes", HB_TAG('F','A','R',' ')}, /* Iranian Persian */
michael@0 563 {"phk", HB_TAG('P','H','K',' ')}, /* Phake */
michael@0 564 {"pi", HB_TAG('P','A','L',' ')}, /* Pali */
michael@0 565 {"pih", HB_TAG('P','I','H',' ')}, /* Pitcairn-Norfolk */
michael@0 566 {"pl", HB_TAG('P','L','K',' ')}, /* Polish */
michael@0 567 {"pll", HB_TAG('P','L','G',' ')}, /* [Shwe] Palaung */
michael@0 568 {"plp", HB_TAG('P','A','P',' ')}, /* Palpa */
michael@0 569 {"pms", HB_TAG('P','M','S',' ')}, /* Piemontese */
michael@0 570 {"pnb", HB_TAG('P','N','B',' ')}, /* Western Panjabi */
michael@0 571 {"prs", HB_TAG('D','R','I',' ')}, /* Afghan Persian/Dari */
michael@0 572 {"ps", HB_TAG('P','A','S',' ')}, /* Pashto/Pushto [macrolanguage] */
michael@0 573 {"pt", HB_TAG('P','T','G',' ')}, /* Portuguese */
michael@0 574 {"pwo", HB_TAG('P','W','O',' ')}, /* Pwo Western Karen */
michael@0 575 {"qu", HB_TAG('Q','U','Z',' ')}, /* Quechua [macrolanguage] */
michael@0 576 {"quc", HB_TAG('Q','U','C',' ')}, /* K'iche'/Quiché */
michael@0 577 {"quz", HB_TAG('Q','U','Z',' ')}, /* Cusco Quechua */
michael@0 578 {"raj", HB_TAG('R','A','J',' ')}, /* Rajasthani [macrolanguage] */
michael@0 579 {"rbb", HB_TAG('P','L','G',' ')}, /* Rumai Palaung */
michael@0 580 {"rej", HB_TAG('R','E','J',' ')}, /* Rejang */
michael@0 581 {"ria", HB_TAG('R','I','A',' ')}, /* Riang (India) */
michael@0 582 {"ril", HB_TAG('R','I','A',' ')}, /* Riang (Myanmar) */
michael@0 583 {"rki", HB_TAG('A','R','K',' ')}, /* Rakhine */
michael@0 584 {"rm", HB_TAG('R','M','S',' ')}, /* Romansh */
michael@0 585 {"rmy", HB_TAG('R','M','Y',' ')}, /* Vlax Romani */
michael@0 586 {"rn", HB_TAG('R','U','N',' ')}, /* Rundi */
michael@0 587 {"ro", HB_TAG('R','O','M',' ')}, /* Romanian */
michael@0 588 {"rom", HB_TAG('R','O','Y',' ')}, /* Romany [macrolanguage] */
michael@0 589 {"ru", HB_TAG('R','U','S',' ')}, /* Russian */
michael@0 590 {"rue", HB_TAG('R','S','Y',' ')}, /* Rusyn */
michael@0 591 {"rup", HB_TAG('R','U','P',' ')}, /* Aromanian/Arumanian/Macedo-Romanian */
michael@0 592 {"rw", HB_TAG('R','U','A',' ')}, /* Kinyarwanda */
michael@0 593 {"rwr", HB_TAG('M','A','W',' ')}, /* Marwari (India) */
michael@0 594 {"sa", HB_TAG('S','A','N',' ')}, /* Sanskrit */
michael@0 595 {"sah", HB_TAG('Y','A','K',' ')}, /* Yakut */
michael@0 596 {"sas", HB_TAG('S','A','S',' ')}, /* Sasak */
michael@0 597 {"sat", HB_TAG('S','A','T',' ')}, /* Santali */
michael@0 598 {"sck", HB_TAG('S','A','D',' ')}, /* Sadri */
michael@0 599 {"sc", HB_TAG('S','R','D',' ')}, /* Sardinian [macrolanguage] */
michael@0 600 {"scn", HB_TAG('S','C','N',' ')}, /* Sicilian */
michael@0 601 {"sco", HB_TAG('S','C','O',' ')}, /* Scots */
michael@0 602 {"scs", HB_TAG('S','L','A',' ')}, /* [North] Slavey */
michael@0 603 {"sd", HB_TAG('S','N','D',' ')}, /* Sindhi */
michael@0 604 {"se", HB_TAG('N','S','M',' ')}, /* Northern Sami */
michael@0 605 {"seh", HB_TAG('S','N','A',' ')}, /* Sena */
michael@0 606 {"sel", HB_TAG('S','E','L',' ')}, /* Selkup */
michael@0 607 {"sg", HB_TAG('S','G','O',' ')}, /* Sango */
michael@0 608 {"sga", HB_TAG('S','G','A',' ')}, /* Old Irish (to 900) */
michael@0 609 {"sgs", HB_TAG('S','G','S',' ')}, /* Samogitian */
michael@0 610 {"sgw", HB_TAG('C','H','G',' ')}, /* Sebat Bet Gurage */
michael@0 611 /*{"sgw", HB_TAG('S','G','W',' ')},*/ /* Sebat Bet Gurage (in SIL fonts) */
michael@0 612 {"shn", HB_TAG('S','H','N',' ')}, /* Shan */
michael@0 613 {"si", HB_TAG('S','N','H',' ')}, /* Sinhala */
michael@0 614 {"sid", HB_TAG('S','I','D',' ')}, /* Sidamo */
michael@0 615 {"sjd", HB_TAG('K','S','M',' ')}, /* Kildin Sami */
michael@0 616 {"sk", HB_TAG('S','K','Y',' ')}, /* Slovak */
michael@0 617 {"skr", HB_TAG('S','R','K',' ')}, /* Seraiki */
michael@0 618 {"sl", HB_TAG('S','L','V',' ')}, /* Slovenian */
michael@0 619 {"sm", HB_TAG('S','M','O',' ')}, /* Samoan */
michael@0 620 {"sma", HB_TAG('S','S','M',' ')}, /* Southern Sami */
michael@0 621 {"smj", HB_TAG('L','S','M',' ')}, /* Lule Sami */
michael@0 622 {"smn", HB_TAG('I','S','M',' ')}, /* Inari Sami */
michael@0 623 {"sms", HB_TAG('S','K','S',' ')}, /* Skolt Sami */
michael@0 624 {"sn", HB_TAG('S','N','A',' ')}, /* Shona */
michael@0 625 {"snk", HB_TAG('S','N','K',' ')}, /* Soninke */
michael@0 626 {"so", HB_TAG('S','M','L',' ')}, /* Somali */
michael@0 627 {"sop", HB_TAG('S','O','P',' ')}, /* Songe */
michael@0 628 {"sq", HB_TAG('S','Q','I',' ')}, /* Albanian [macrolanguage] */
michael@0 629 {"sr", HB_TAG('S','R','B',' ')}, /* Serbian */
michael@0 630 {"srr", HB_TAG('S','R','R',' ')}, /* Serer */
michael@0 631 {"ss", HB_TAG('S','W','Z',' ')}, /* Swati */
michael@0 632 {"st", HB_TAG('S','O','T',' ')}, /* [Southern] Sotho */
michael@0 633 {"stq", HB_TAG('S','T','Q',' ')}, /* Saterfriesisch */
michael@0 634 {"stv", HB_TAG('S','I','G',' ')}, /* Silt'e */
michael@0 635 {"su", HB_TAG('S','U','N',' ')}, /* Sundanese */
michael@0 636 {"suk", HB_TAG('S','U','K',' ')}, /* Sukama */
michael@0 637 {"suq", HB_TAG('S','U','R',' ')}, /* Suri */
michael@0 638 {"sv", HB_TAG('S','V','E',' ')}, /* Swedish */
michael@0 639 {"sva", HB_TAG('S','V','A',' ')}, /* Svan */
michael@0 640 {"sw", HB_TAG('S','W','K',' ')}, /* Swahili [macrolanguage] */
michael@0 641 {"swb", HB_TAG('C','M','R',' ')}, /* Comorian */
michael@0 642 {"swh", HB_TAG('S','W','K',' ')}, /* Kiswahili/Swahili */
michael@0 643 {"swv", HB_TAG('M','A','W',' ')}, /* Shekhawati */
michael@0 644 {"sxu", HB_TAG('S','X','U',' ')}, /* Upper Saxon */
michael@0 645 {"syl", HB_TAG('S','Y','L',' ')}, /* Sylheti */
michael@0 646 {"syr", HB_TAG('S','Y','R',' ')}, /* Syriac [macrolanguage] */
michael@0 647 {"szl", HB_TAG('S','Z','L',' ')}, /* Silesian */
michael@0 648 {"ta", HB_TAG('T','A','M',' ')}, /* Tamil */
michael@0 649 {"tab", HB_TAG('T','A','B',' ')}, /* Tabasaran */
michael@0 650 {"tcy", HB_TAG('T','U','L',' ')}, /* Tulu */
michael@0 651 {"tdd", HB_TAG('T','D','D',' ')}, /* Tai Nüa */
michael@0 652 {"te", HB_TAG('T','E','L',' ')}, /* Telugu */
michael@0 653 {"tem", HB_TAG('T','M','N',' ')}, /* Temne */
michael@0 654 {"tet", HB_TAG('T','E','T',' ')}, /* Tetum */
michael@0 655 {"tg", HB_TAG('T','A','J',' ')}, /* Tajik */
michael@0 656 {"th", HB_TAG('T','H','A',' ')}, /* Thai */
michael@0 657 {"ti", HB_TAG('T','G','Y',' ')}, /* Tigrinya */
michael@0 658 {"tig", HB_TAG('T','G','R',' ')}, /* Tigre */
michael@0 659 {"tiv", HB_TAG('T','I','V',' ')}, /* Tiv */
michael@0 660 {"tk", HB_TAG('T','K','M',' ')}, /* Turkmen */
michael@0 661 {"tl", HB_TAG('T','G','L',' ')}, /* Tagalog */
michael@0 662 {"tmh", HB_TAG('t','m','h',' ')}, /* Tamashek [macrolanguage] */
michael@0 663 {"tn", HB_TAG('T','N','A',' ')}, /* Tswana */
michael@0 664 {"to", HB_TAG('T','G','N',' ')}, /* Tonga (Tonga Islands) */
michael@0 665 {"tpi", HB_TAG('T','P','I',' ')}, /* Tok Pisin */
michael@0 666 {"tr", HB_TAG('T','R','K',' ')}, /* Turkish */
michael@0 667 {"tru", HB_TAG('T','U','A',' ')}, /* Turoyo Aramaic */
michael@0 668 {"ts", HB_TAG('T','S','G',' ')}, /* Tsonga */
michael@0 669 {"tt", HB_TAG('T','A','T',' ')}, /* Tatar */
michael@0 670 {"tum", HB_TAG('T','U','M',' ')}, /* Tumbuka */
michael@0 671 {"tw", HB_TAG('T','W','I',' ')}, /* Twi */
michael@0 672 {"ty", HB_TAG('T','H','T',' ')}, /* Tahitian */
michael@0 673 {"tyv", HB_TAG('T','U','V',' ')}, /* Tuvin */
michael@0 674 {"tyz", HB_TAG('T','Y','Z',' ')}, /* Tày */
michael@0 675 {"tzm", HB_TAG('T','Z','M',' ')}, /* Central Atlas Tamazight */
michael@0 676 {"udm", HB_TAG('U','D','M',' ')}, /* Udmurt */
michael@0 677 {"ug", HB_TAG('U','Y','G',' ')}, /* Uighur */
michael@0 678 {"uk", HB_TAG('U','K','R',' ')}, /* Ukrainian */
michael@0 679 {"umb", HB_TAG('U','M','B',' ')}, /* Umbundu */
michael@0 680 {"unr", HB_TAG('M','U','N',' ')}, /* Mundari */
michael@0 681 {"ur", HB_TAG('U','R','D',' ')}, /* Urdu */
michael@0 682 {"uz", HB_TAG('U','Z','B',' ')}, /* Uzbek [macrolanguage] */
michael@0 683 {"uzn", HB_TAG('U','Z','B',' ')}, /* Northern Uzbek */
michael@0 684 {"uzs", HB_TAG('U','Z','B',' ')}, /* Southern Uzbek */
michael@0 685 {"ve", HB_TAG('V','E','N',' ')}, /* Venda */
michael@0 686 {"vec", HB_TAG('V','E','C',' ')}, /* Venetian */
michael@0 687 {"vls", HB_TAG('F','L','E',' ')}, /* Vlaams */
michael@0 688 {"vi", HB_TAG('V','I','T',' ')}, /* Vietnamese */
michael@0 689 {"vmw", HB_TAG('M','A','K',' ')}, /* Makhuwa */
michael@0 690 {"vo", HB_TAG('V','O','L',' ')}, /* Volapük */
michael@0 691 {"vro", HB_TAG('V','R','O',' ')}, /* Võro */
michael@0 692 {"wa", HB_TAG('W','L','N',' ')}, /* Walloon */
michael@0 693 {"war", HB_TAG('W','A','R',' ')}, /* Waray (Philippines) */
michael@0 694 {"wbm", HB_TAG('W','A',' ',' ')}, /* Wa */
michael@0 695 {"wbr", HB_TAG('W','A','G',' ')}, /* Wagdi */
michael@0 696 {"wle", HB_TAG('S','I','G',' ')}, /* Wolane */
michael@0 697 {"wry", HB_TAG('M','A','W',' ')}, /* Merwari */
michael@0 698 {"wtm", HB_TAG('W','T','M',' ')}, /* Mewati */
michael@0 699 {"wo", HB_TAG('W','L','F',' ')}, /* Wolof */
michael@0 700 {"xal", HB_TAG('K','L','M',' ')}, /* Kalmyk */
michael@0 701 {"xh", HB_TAG('X','H','S',' ')}, /* Xhosa */
michael@0 702 {"xog", HB_TAG('X','O','G',' ')}, /* Soga */
michael@0 703 {"xom", HB_TAG('K','M','O',' ')}, /* Komo (Sudan) */
michael@0 704 {"xsl", HB_TAG('S','S','L',' ')}, /* South Slavey */
michael@0 705 {"xst", HB_TAG('S','I','G',' ')}, /* Silt'e (retired code) */
michael@0 706 {"xwo", HB_TAG('T','O','D',' ')}, /* Written Oirat (Todo) */
michael@0 707 {"yao", HB_TAG('Y','A','O',' ')}, /* Yao */
michael@0 708 {"yi", HB_TAG('J','I','I',' ')}, /* Yiddish [macrolanguage] */
michael@0 709 {"yo", HB_TAG('Y','B','A',' ')}, /* Yoruba */
michael@0 710 {"yso", HB_TAG('N','I','S',' ')}, /* Nisi (China) */
michael@0 711 {"za", HB_TAG('Z','H','A',' ')}, /* Chuang/Zhuang [macrolanguage] */
michael@0 712 {"zea", HB_TAG('Z','E','A',' ')}, /* Zeeuws */
michael@0 713 {"zne", HB_TAG('Z','N','D',' ')}, /* Zande */
michael@0 714 {"zu", HB_TAG('Z','U','L',' ')}, /* Zulu */
michael@0 715 {"zum", HB_TAG('L','R','C',' ')} /* Kumzari */
michael@0 716
michael@0 717 /* The corresponding languages IDs for the following IDs are unclear,
michael@0 718 * overlap, or are architecturally weird. Needs more research. */
michael@0 719
michael@0 720 /*{"ahg/awn/xan?", HB_TAG('A','G','W',' ')},*/ /* Agaw */
michael@0 721 /*{"gsw?/gsw-FR?", HB_TAG('A','L','S',' ')},*/ /* Alsatian */
michael@0 722 /*{"krc", HB_TAG('B','A','L',' ')},*/ /* Balkar */
michael@0 723 /*{"??", HB_TAG('B','C','R',' ')},*/ /* Bible Cree */
michael@0 724 /*{"zh?", HB_TAG('C','H','N',' ')},*/ /* Chinese (seen in Microsoft fonts) */
michael@0 725 /*{"acf/gcf?", HB_TAG('F','A','N',' ')},*/ /* French Antillean */
michael@0 726 /*{"enf?/yrk?", HB_TAG('F','N','E',' ')},*/ /* Forest Nenets */
michael@0 727 /*{"fuf?", HB_TAG('F','T','A',' ')},*/ /* Futa */
michael@0 728 /*{"ar-Syrc?", HB_TAG('G','A','R',' ')},*/ /* Garshuni */
michael@0 729 /*{"cfm/rnl?", HB_TAG('H','A','L',' ')},*/ /* Halam */
michael@0 730 /*{"fonipa", HB_TAG('I','P','P','H')},*/ /* Phonetic transcription—IPA conventions */
michael@0 731 /*{"ga-Latg?/Latg?", HB_TAG('I','R','T',' ')},*/ /* Irish Traditional */
michael@0 732 /*{"krc", HB_TAG('K','A','R',' ')},*/ /* Karachay */
michael@0 733 /*{"alw?/ktb?", HB_TAG('K','E','B',' ')},*/ /* Kebena */
michael@0 734 /*{"Geok", HB_TAG('K','G','E',' ')},*/ /* Khutsuri Georgian */
michael@0 735 /*{"kca", HB_TAG('K','H','K',' ')},*/ /* Khanty-Kazim */
michael@0 736 /*{"kca", HB_TAG('K','H','S',' ')},*/ /* Khanty-Shurishkar */
michael@0 737 /*{"kca", HB_TAG('K','H','V',' ')},*/ /* Khanty-Vakhi */
michael@0 738 /*{"guz?/kqs?/kss?", HB_TAG('K','I','S',' ')},*/ /* Kisii */
michael@0 739 /*{"kfa/kfi?/kpb?/xua?/xuj?", HB_TAG('K','O','D',' ')},*/ /* Kodagu */
michael@0 740 /*{"okm?/oko?", HB_TAG('K','O','H',' ')},*/ /* Korean Old Hangul */
michael@0 741 /*{"kon?/ktu?/...", HB_TAG('K','O','N',' ')},*/ /* Kikongo */
michael@0 742 /*{"kfx?", HB_TAG('K','U','L',' ')},*/ /* Kulvi */
michael@0 743 /*{"??", HB_TAG('L','A','H',' ')},*/ /* Lahuli */
michael@0 744 /*{"??", HB_TAG('L','C','R',' ')},*/ /* L-Cree */
michael@0 745 /*{"??", HB_TAG('M','A','L',' ')},*/ /* Malayalam Traditional */
michael@0 746 /*{"mnk?/mlq?/...", HB_TAG('M','L','N',' ')},*/ /* Malinke */
michael@0 747 /*{"??", HB_TAG('N','C','R',' ')},*/ /* N-Cree */
michael@0 748 /*{"??", HB_TAG('N','H','C',' ')},*/ /* Norway House Cree */
michael@0 749 /*{"jpa?/sam?", HB_TAG('P','A','A',' ')},*/ /* Palestinian Aramaic */
michael@0 750 /*{"polyton", HB_TAG('P','G','R',' ')},*/ /* Polytonic Greek */
michael@0 751 /*{"??", HB_TAG('Q','I','N',' ')},*/ /* Asho Chin */
michael@0 752 /*{"??", HB_TAG('R','C','R',' ')},*/ /* R-Cree */
michael@0 753 /*{"chp?", HB_TAG('S','A','Y',' ')},*/ /* Sayisi */
michael@0 754 /*{"xan?", HB_TAG('S','E','K',' ')},*/ /* Sekota */
michael@0 755 /*{"ngo?", HB_TAG('S','X','T',' ')},*/ /* Sutu */
michael@0 756 /*{"??", HB_TAG('T','C','R',' ')},*/ /* TH-Cree */
michael@0 757 /*{"tnz?/tog?/toi?", HB_TAG('T','N','G',' ')},*/ /* Tonga */
michael@0 758 /*{"enh?/yrk?", HB_TAG('T','N','E',' ')},*/ /* Tundra Nenets */
michael@0 759 /*{"??", HB_TAG('W','C','R',' ')},*/ /* West-Cree */
michael@0 760 /*{"cre?", HB_TAG('Y','C','R',' ')},*/ /* Y-Cree */
michael@0 761 /*{"??", HB_TAG('Y','I','C',' ')},*/ /* Yi Classic */
michael@0 762 /*{"ii?/Yiii?", HB_TAG('Y','I','M',' ')},*/ /* Yi Modern */
michael@0 763 /*{"??", HB_TAG('Z','H','P',' ')},*/ /* Chinese Phonetic */
michael@0 764 };
michael@0 765
michael@0 766 static const LangTag ot_languages_zh[] = {
michael@0 767 {"zh-cn", HB_TAG('Z','H','S',' ')}, /* Chinese (China) */
michael@0 768 {"zh-hk", HB_TAG('Z','H','H',' ')}, /* Chinese (Hong Kong) */
michael@0 769 {"zh-mo", HB_TAG('Z','H','T',' ')}, /* Chinese (Macao) */
michael@0 770 {"zh-sg", HB_TAG('Z','H','S',' ')}, /* Chinese (Singapore) */
michael@0 771 {"zh-tw", HB_TAG('Z','H','T',' ')} /* Chinese (Taiwan) */
michael@0 772 };
michael@0 773
michael@0 774 static int
michael@0 775 lang_compare_first_component (const char *a,
michael@0 776 const char *b)
michael@0 777 {
michael@0 778 unsigned int da, db;
michael@0 779 const char *p;
michael@0 780
michael@0 781 p = strchr (a, '-');
michael@0 782 da = p ? (unsigned int) (p - a) : strlen (a);
michael@0 783
michael@0 784 p = strchr (b, '-');
michael@0 785 db = p ? (unsigned int) (p - b) : strlen (b);
michael@0 786
michael@0 787 return strncmp (a, b, MAX (da, db));
michael@0 788 }
michael@0 789
michael@0 790 static hb_bool_t
michael@0 791 lang_matches (const char *lang_str, const char *spec)
michael@0 792 {
michael@0 793 unsigned int len = strlen (spec);
michael@0 794
michael@0 795 return strncmp (lang_str, spec, len) == 0 &&
michael@0 796 (lang_str[len] == '\0' || lang_str[len] == '-');
michael@0 797 }
michael@0 798
michael@0 799 hb_tag_t
michael@0 800 hb_ot_tag_from_language (hb_language_t language)
michael@0 801 {
michael@0 802 const char *lang_str, *s;
michael@0 803 const LangTag *lang_tag;
michael@0 804
michael@0 805 if (language == HB_LANGUAGE_INVALID)
michael@0 806 return HB_OT_TAG_DEFAULT_LANGUAGE;
michael@0 807
michael@0 808 lang_str = hb_language_to_string (language);
michael@0 809
michael@0 810 s = strstr (lang_str, "x-hbot");
michael@0 811 if (s) {
michael@0 812 char tag[4];
michael@0 813 int i;
michael@0 814 s += 6;
michael@0 815 for (i = 0; i < 4 && ISALPHA (s[i]); i++)
michael@0 816 tag[i] = TOUPPER (s[i]);
michael@0 817 if (i) {
michael@0 818 for (; i < 4; i++)
michael@0 819 tag[i] = ' ';
michael@0 820 return HB_TAG_CHAR4 (tag);
michael@0 821 }
michael@0 822 }
michael@0 823
michael@0 824 /* Find a language matching in the first component */
michael@0 825 lang_tag = (LangTag *) bsearch (lang_str, ot_languages,
michael@0 826 ARRAY_LENGTH (ot_languages), sizeof (LangTag),
michael@0 827 (hb_compare_func_t) lang_compare_first_component);
michael@0 828 if (lang_tag)
michael@0 829 return lang_tag->tag;
michael@0 830
michael@0 831 /* Otherwise, check the Chinese ones */
michael@0 832 if (0 == lang_compare_first_component (lang_str, "zh"))
michael@0 833 {
michael@0 834 unsigned int i;
michael@0 835
michael@0 836 for (i = 0; i < ARRAY_LENGTH (ot_languages_zh); i++)
michael@0 837 {
michael@0 838 lang_tag = &ot_languages_zh[i];
michael@0 839 if (lang_matches (lang_tag->language, lang_str))
michael@0 840 return lang_tag->tag;
michael@0 841 }
michael@0 842
michael@0 843 /* Otherwise just return 'ZHS ' */
michael@0 844 return HB_TAG('Z','H','S',' ');
michael@0 845 }
michael@0 846
michael@0 847 s = strchr (lang_str, '-');
michael@0 848 if (!s)
michael@0 849 s = lang_str + strlen (lang_str);
michael@0 850 if (s - lang_str == 3) {
michael@0 851 /* Assume it's ISO-639-3 and upper-case and use it. */
michael@0 852 return hb_tag_from_string (lang_str, s - lang_str) & ~0x20202000;
michael@0 853 }
michael@0 854
michael@0 855 return HB_OT_TAG_DEFAULT_LANGUAGE;
michael@0 856 }
michael@0 857
michael@0 858 hb_language_t
michael@0 859 hb_ot_tag_to_language (hb_tag_t tag)
michael@0 860 {
michael@0 861 unsigned int i;
michael@0 862
michael@0 863 if (tag == HB_OT_TAG_DEFAULT_LANGUAGE)
michael@0 864 return NULL;
michael@0 865
michael@0 866 for (i = 0; i < ARRAY_LENGTH (ot_languages); i++)
michael@0 867 if (ot_languages[i].tag == tag)
michael@0 868 return hb_language_from_string (ot_languages[i].language, -1);
michael@0 869
michael@0 870 /* If tag starts with ZH, it's Chinese */
michael@0 871 if ((tag & 0xFFFF0000) == 0x5A480000) {
michael@0 872 switch (tag) {
michael@0 873 case HB_TAG('Z','H','H',' '): return hb_language_from_string ("zh-hk", -1); /* Hong Kong */
michael@0 874 default: {
michael@0 875 /* Encode the tag... */
michael@0 876 unsigned char buf[14] = "zh-x-hbot";
michael@0 877 buf[9] = tag >> 24;
michael@0 878 buf[10] = (tag >> 16) & 0xFF;
michael@0 879 buf[11] = (tag >> 8) & 0xFF;
michael@0 880 buf[12] = tag & 0xFF;
michael@0 881 if (buf[12] == 0x20)
michael@0 882 buf[12] = '\0';
michael@0 883 buf[13] = '\0';
michael@0 884 return hb_language_from_string ((char *) buf, -1);
michael@0 885 }
michael@0 886 }
michael@0 887 }
michael@0 888
michael@0 889 /* Else return a custom language in the form of "x-hbotABCD" */
michael@0 890 {
michael@0 891 unsigned char buf[11] = "x-hbot";
michael@0 892 buf[6] = tag >> 24;
michael@0 893 buf[7] = (tag >> 16) & 0xFF;
michael@0 894 buf[8] = (tag >> 8) & 0xFF;
michael@0 895 buf[9] = tag & 0xFF;
michael@0 896 if (buf[9] == 0x20)
michael@0 897 buf[9] = '\0';
michael@0 898 buf[10] = '\0';
michael@0 899 return hb_language_from_string ((char *) buf, -1);
michael@0 900 }
michael@0 901 }
michael@0 902
michael@0 903

mercurial