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