1 // Copyright 2012 Google Inc. All Rights Reserved. 2 3 package com.google.typography.font.sfntly.table.opentype; 4 5 import com.google.typography.font.sfntly.Tag; 6 7 import java.util.Arrays; 8 import java.util.List; 9 10 /** 11 * @author dougfelt@google.com (Doug Felt) 12 */ 13 enum LanguageTag { 14 ABA("Abaza", "abq"), 15 ABK("Abkhazian", "abk"), 16 ADY("Adyghe", "ady"), 17 AFK("Afrikaans", "afr"), 18 AFR("Afar", "aar"), 19 AGW("Agaw", "ahg"), 20 ALS("Alsatian", "gsw"), 21 ALT("Altai", "atv,alt"), 22 AMH("Amharic", "amh"), 23 APPH("Phonetic transcription—Americanist conventions", ""), 24 ARA("Arabic", "ara"), 25 ARI("Aari", "aiw"), 26 ARK("Arakanese", "mhv,rmz,rki"), 27 ASM("Assamese", "asm"), 28 ATH("Athapaskan", 29 "apk,apj,apl,apm,apw,nav,bea,sek,bcr,caf,crx,clc,gwi,haa,chp,dgr,scs,xsl,srs,ing,hoi,koy,hup,ktw,mvb,wlk,coq,ctc,gce,tol,tuu,kkz,tgx,tht,aht,tfn,taa,tau,tcb,kuu,tce,ttm,txc"), 30 AVR("Avar", "ava"), 31 AWA("Awadhi", "awa"), 32 AYM("Aymara", "aym"), 33 AZE("Azeri", "aze"), 34 BAD("Badaga", "bfq"), 35 BAG("Baghelkhandi", "bfy"), 36 BAL("Balkar", "krc"), 37 BAU("Baule", "bci"), 38 BBR("Berber", ""), 39 BCH("Bench", "bcq"), 40 BCR("Bible Cree", ""), 41 BEL("Belarussian", "bel"), 42 BEM("Bemba", "bem"), 43 BEN("Bengali", "ben"), 44 BGR("Bulgarian", "bul"), 45 BHI("Bhili", "bhi,bhb"), 46 BHO("Bhojpuri", "bho"), 47 BIK("Bikol", "bik"), 48 BIL("Bilen", "byn"), 49 BKF("Blackfoot", "bla"), 50 BLI("Balochi", "bal"), 51 BLN("Balante", "bjt,ble"), 52 BLT("Balti", "bft"), 53 BMB("Bambara", "bam"), 54 BML("Bamileke", ""), 55 BOS("Bosnian", "bos"), 56 BRE("Breton", "bre"), 57 BRH("Brahui", "brh"), 58 BRI("Braj Bhasha", "bra"), 59 BRM("Burmese", "mya"), 60 BSH("Bashkir", "bak"), 61 BTI("Beti", "btb"), 62 CAT("Catalan", "cat"), 63 CEB("Cebuano", "ceb"), 64 CHE("Chechen", "che"), 65 CHG("Chaha Gurage", "sgw"), 66 CHH("Chattisgarhi", "hne"), 67 CHI("Chichewa", "nya"), 68 CHK("Chukchi", "ckt"), 69 CHN("Chinese -- as seen in win7 kaiu.ttf", "zho"), 70 CHP("Chipewyan", "chp"), 71 CHR("Cherokee", "chr"), 72 CHU("Chuvash", "chv"), 73 CMR("Comorian", "swb,wlc,wni,zdj"), 74 COP("Coptic", "cop"), 75 COS("Corsican", "cos"), 76 CRE("Cree", "cre"), 77 CRR("Carrier", "crx,caf"), 78 CRT("Crimean Tatar", "crh"), 79 CSL("Church Slavonic", "chu"), 80 CSY("Czech", "ces"), 81 DAN("Danish", "dan"), 82 DAR("Dargwa", "dar"), 83 DCR("Woods Cree", "cwd"), 84 DEU("German", "deu"), 85 DFLT("default", ""), 86 DGR("Dogri", "doi"), 87 DHV("Dhivehi", "div"), // deprecated 88 DIV("Dhivehi", "div"), 89 DJR("Djerma", "dje"), 90 DNG("Dangme", "ada"), 91 DNK("Dinka", "din"), 92 DRI("Dari", "prs"), 93 DUN("Dungan", "dng"), 94 DZN("Dzongkha", "dzo"), 95 EBI("Ebira", "igb"), 96 ECR("Eastern Cree", "crj,crl"), 97 EDO("Edo", "bin"), 98 EFI("Efik", "efi"), 99 ELL("Greek", "ell"), 100 ENG("English", "eng"), 101 ERZ("Erzya", "myv"), 102 ESP("Spanish", "spa"), 103 ETI("Estonian", "est"), 104 EUQ("Basque", "eus"), 105 EVK("Evenki", "evn"), 106 EVN("Even", "eve"), 107 EWE("Ewe", "ewe"), 108 FAN("French Antillean", "acf"), 109 FAR("Farsi", "fas"), 110 FIN("Finnish", "fin"), 111 FJI("Fijian", "fij"), 112 FLE("Flemish", "vls"), 113 FNE("Forest Nenets", "enf"), 114 FON("Fon", "fon"), 115 FOS("Faroese", "fao"), 116 FRA("French", "fra"), 117 FRI("Frisian", "fry"), 118 FRL("Friulian", "fur"), 119 FTA("Futa", "fuf"), 120 FUL("Fulani", "ful"), 121 GAD("Ga", "gaa"), 122 GAE("Gaelic", "gla"), 123 GAG("Gagauz", "gag"), 124 GAL("Galician", "glg"), 125 GAR("Garshuni", ""), 126 GAW("Garhwali", "gbm"), 127 GEZ("Ge'ez", "gez"), 128 GIL("Gilyak", "niv"), 129 GMZ("Gumuz", "guk"), 130 GON("Gondi", "gon"), 131 GRN("Greenlandic", "kal"), 132 GRO("Garo", "grt"), 133 GUA("Guarani", "grn"), 134 GUJ("Gujarati", "guj"), 135 HAI("Haitian", "hat"), 136 HAL("Halam", "flm"), 137 HAR("Harauti", "hoj"), 138 HAU("Hausa", "hau"), 139 HAW("Hawaiin", "haw"), 140 HBN("Hammer-Banna", "amf"), 141 HIL("Hiligaynon", "hil"), 142 HIN("Hindi", "hin"), 143 Mari("High", "HMA mrj"), 144 HND("Hindko", "hno,hnd"), 145 HO("Ho", "hoc"), 146 HRI("Harari", "har"), 147 HRV("Croatian", "hrv"), 148 HUN("Hungarian", "hun"), 149 HYE("Armenian", "hye"), 150 IBO("Igbo", "ibo"), 151 IJO("Ijo", "ijc"), 152 ILO("Ilokano", "ilo"), 153 IND("Indonesian", "ind"), 154 ING("Ingush", "inh"), 155 INU("Inuktitut", "iku"), 156 IPPH("Phonetic transcription—IPA conventions", ""), 157 IRI("Irish", "gle"), 158 IRT("Irish Traditional", "gle"), 159 ISL("Icelandic", "isl"), 160 ISM("Inari Sami", "smn"), 161 ITA("Italian", "ita"), 162 IWR("Hebrew", "heb"), 163 JAV("Javanese", "jav"), 164 JII("Yiddish", "yid"), 165 JAN("Japanese", "jpn"), 166 JUD("Judezmo", "lad"), 167 JUL("Jula", "dyu"), 168 KAB("Kabardian", "kbd"), 169 KAC("Kachchi", "kfr"), 170 KAL("Kalenjin", "kln"), 171 KAN("Kannada", "kan"), 172 KAR("Karachay", "krc"), 173 KAT("Georgian", "kat"), 174 KAZ("Kazakh", "kaz"), 175 KEB("Kebena", "ktb"), 176 KGE("Khutsuri Georgian", "kat"), 177 KHA("Khakass", "kjh"), 178 KHK("Khanty-Kazim", "kca"), 179 KHM("Khmer", "khm"), 180 KHN("Khun(?)", "kkh"), 181 KHS("Khanty-Shurishkar", "kca"), 182 KHV("Khanty-Vakhi", "kca"), 183 KHW("Khowar", "khw"), 184 KIK("Kikuyu", "kik"), 185 KIR("Kirghiz", "kir"), 186 KIS("Kisii", "kqs,kss"), 187 KKN("Kokni", "kex"), 188 KLM("Kalmyk", "xal"), 189 KMB("Kamba", "kam"), 190 KMN("Kumaoni", "kfy"), 191 KMO("Komo", "kmw"), 192 KMS("Komso", "kxc"), 193 KNR("Kanuri", "kau"), 194 KOD("Kodagu", "kfa"), 195 KOH("Korean Old Hangul", "okm"), 196 KOK("Konkani", "kok"), 197 KON("Kikongo", "ktu"), 198 KOP("Komi-Permyak", "koi"), 199 KOR("Korean", "kor"), 200 KOZ("Komi-Zyrian", "kpv"), 201 KPL("Kpelle", "kpe"), 202 KRI("Krio", "kri"), 203 KRK("Karakalpak", "kaa"), 204 KRL("Karelian", "krl"), 205 KRM("Karaim", "kdr"), 206 KRN("Karen", "kar"), 207 KRT("Koorete", "kqy"), 208 KSH("Kashmiri", "kas"), 209 KSI("Khasi", "kha"), 210 KSM("Kildin Sami", "sjd"), 211 KUI("Kui", "kxu"), 212 KUL("Kulvi", "kfx"), 213 KUM("Kumyk", "kum"), 214 KUR("Kurdish", "kur"), 215 KUU("Kurukh", "kru"), 216 KUY("Kuy", "kdt"), 217 KYK("Koryak", "kpy"), 218 LAD("Ladin", "lld"), 219 LAH("Lahuli", "bfu"), 220 LAK("Lak", "lbe"), 221 LAM("Lambani", "lmn"), 222 LAO("Lao", "lao"), 223 LAT("Latin", "lat"), 224 LAZ("Laz", "lzz"), 225 LCR("L-Cree", "crm"), 226 LDK("Ladakhi", "lbj"), 227 LEZ("Lezgi", "lez"), 228 LIN("Lingala", "lin"), 229 LMA("Low Mari", "mhr"), 230 LMB("Limbu", "lif"), 231 LMW("Lomwe", "ngl"), 232 LSB("Lower Sorbian", "dsb"), 233 LSM("Lule Sami", "smj"), 234 LTH("Lithuanian", "lit"), 235 LTZ("Luxembourgish", "ltz"), 236 LUB("Luba", "lua,lub"), 237 LUG("Luganda", "lug"), 238 LUH("Luhya", "luy"), 239 LUO("Luo", "luo"), 240 LVI("Latvian", "lav"), 241 MAJ("Majang", "mpe"), 242 MAK("Makua", "vmw"), 243 MAL("Malayalam Traditional", "mal"), 244 MAN("Mansi", "mns"), 245 MAP("Mapudungun", "arn"), 246 MAR("Marathi", "mar"), 247 MAW("Marwari", "mwr"), 248 MBN("Mbundu", "kmb"), 249 MCH("Manchu", "mnc"), 250 MCR("Moose Cree", "crm"), 251 MDE("Mende", "men"), 252 MEN("Me'en", "mym"), 253 MIZ("Mizo", "lus"), 254 MKD("Macedonian", "mkd"), 255 MLE("Male", "mdy"), 256 MLG("Malagasy", "mlg"), 257 MLN("Malinke", "mlq"), 258 MLR("Malayalam Reformed", "mal"), 259 MLY("Malay", "msa"), 260 MND("Mandinka", "mnk"), 261 MNG("Mongolian", "mon"), 262 MNI("Manipuri", "mni"), 263 MNK("Maninka", "man"), 264 MNX("Manx Gaelic", "glv"), 265 MOH("Mohawk", "moh"), 266 MOK("Moksha", "mdf"), 267 MOL("Moldavian", "mol"), 268 MON("Mon", "mnw"), 269 MOR("Moroccan", ""), 270 MRI("Maori", "mri"), 271 MTH("Maithili", "mai"), 272 MTS("Maltese", "mlt"), 273 MUN("Mundari", "unr"), 274 NAG("Naga-Assamese", "nag"), 275 NAN("Nanai", "gld"), 276 NAS("Naskapi", "nsk"), 277 NCR("N-Cree", "csw"), 278 NDB("Ndebele", "nbl,nde"), 279 NDG("Ndonga", "ndo"), 280 NEP("Nepali", "nep"), 281 NEW("Newari", "new"), 282 NGR("Nagari", ""), 283 NHC("Norway House Cree", "csw"), 284 NIS("Nisi", "dap"), 285 NIU("Niuean", "niu"), 286 NKL("Nkole", "nyn"), 287 NKO("N'Ko", "nqo"), 288 NLD("Dutch", "nld"), 289 NOG("Nogai", "nog"), 290 NOR("Norwegian", "nob"), 291 NSM("Northern Sami", "sme"), 292 NTA("Northern Tai", "nod"), 293 NTO("Esperanto", "epo"), 294 NYN("Nynorsk", "nno"), 295 OCI("Occitan", "oci"), 296 OCR("Oji-Cree", "ojs"), 297 OJB("Ojibway", "oji"), 298 ORI("Odia (formerly Oriya)", "ori"), 299 ORO("Oromo", "orm"), 300 OSS("Ossetian", "oss"), 301 PAA("Palestinian Aramaic", "sam"), 302 PAL("Pali", "pli"), 303 PAN("Punjabi", "pan"), 304 PAP("Palpa", "plp"), 305 PAS("Pashto", "pus"), 306 PGR("Polytonic Greek", "ell"), 307 PIL("Filipino", "fil"), 308 PLG("Palaung", "pce,rbb,pll"), 309 PLK("Polish", "pol"), 310 PRO("Provencal", "pro"), 311 PTG("Portuguese", "por"), 312 QIN("Chin", 313 "bgr,cnh,cnw,czt,sez,tcp,csy,ctd,flm,pck,tcz,zom,cmr,dao,hlt,cka,cnk,mrh,mwg,cbl,cnb,csh"), 314 RAJ("Rajasthani", "raj"), 315 RCR("R-Cree", "atj"), 316 RBU("Russian Buriat", "bxr"), 317 RIA("Riang", "ria"), 318 RMS("Rhaeto-Romanic", "roh"), 319 ROM("Romanian", "ron"), 320 ROY("Romany", "rom"), 321 RSY("Rusyn", "rue"), 322 RUA("Ruanda", "kin"), 323 RUS("Russian", "rus"), 324 SAD("Sadri", "sck"), 325 SAN("Sanskrit", "san"), 326 SAT("Santali", "sat"), 327 SAY("Sayisi", "chp"), 328 SEK("Sekota", "xan"), 329 SEL("Selkup", "sel"), 330 SGO("Sango", "sag"), 331 SHN("Shan", "shn"), 332 SIB("Sibe", "sjo"), 333 SID("Sidamo", "sid"), 334 SIG("Silte Gurage", "xst"), 335 SKS("Skolt Sami", "sms"), 336 SKY("Slovak", "slk"), 337 SLA("Slavey", "scs"), 338 SLV("Slovenian", "slv"), 339 SML("Somali", "som"), 340 SMO("Samoan", "smo"), 341 SNA("Sena", "she"), 342 SND("Sindhi", "snd"), 343 SNH("Sinhalese", "sin"), 344 SNK("Soninke", "snk"), 345 SOG("Sodo Gurage", "gru"), 346 SOT("Sotho", "nso,sot"), 347 SQI("Albanian", "sqi"), 348 SRB("Serbian", "srp"), 349 SRK("Saraiki", "skr"), 350 SRR("Serer", "srr"), 351 SSL("South Slavey", "xsl"), 352 SSM("Southern Sami", "sma"), 353 SUR("Suri", "suq"), 354 SVA("Svan", "sva"), 355 SVE("Swedish", "swe"), 356 SWA("Swadaya Aramaic", "aii"), 357 SWK("Swahili", "swa"), 358 SWZ("Swazi", "ssw"), 359 SXT("Sutu", "ngo"), 360 SYR("Syriac", "syr"), 361 TAB("Tabasaran", "tab"), 362 TAJ("Tajiki", "tgk"), 363 TAM("Tamil", "tam"), 364 TAT("Tatar", "tat"), 365 TCR("TH-Cree", "cwd"), 366 TEL("Telugu", "tel"), 367 TGN("Tongan", "ton"), 368 TGR("Tigre", "tig"), 369 TGY("Tigrinya", "tir"), 370 THA("Thai", "tha"), 371 THT("Tahitian", "tah"), 372 TIB("Tibetan", "bod"), 373 TKM("Turkmen", "tuk"), 374 TMN("Temne", "tem"), 375 TNA("Tswana", "tsn"), 376 TNE("Tundra Nenets", "enh"), 377 TNG("Tonga", "toi"), 378 TOD("Todo", "xal"), 379 TRK("Turkish", "tur"), 380 TSG("Tsonga", "tso"), 381 TUA("Turoyo Aramaic", "tru"), 382 TUL("Tulu", "tcy"), 383 TUV("Tuvin", "tyv"), 384 TWI("Twi", "aka"), 385 UDM("Udmurt", "udm"), 386 UKR("Ukrainian", "ukr"), 387 URD("Urdu", "urd"), 388 USB("Upper Sorbian", "hsb"), 389 UYG("Uyghur", "uig"), 390 UZB("Uzbek", "uzb"), 391 VEN("Venda", "ven"), 392 VIT("Vietnamese", "vie"), 393 WA("Wa", "wbm"), 394 WAG("Wagdi", "wbr"), 395 WCR("West-Cree", "crk"), 396 WEL("Welsh", "cym"), 397 WLF("Wolof", "wol"), 398 XBD("Tai Lue", "khb"), 399 XHS("Xhosa", "xho"), 400 YAK("Sakha", "sah"), 401 YBA("Yoruba", "yor"), 402 YCR("Y-Cree", ""), 403 YIC("Yi Classic", ""), 404 YIM("Yi Modern", "iii"), 405 ZHH("Chinese, Hong Kong SAR", "zho"), 406 ZHP("Chinese Phonetic", "zho"), 407 ZHS("Chinese Simplified", "zho"), 408 ZHT("Chinese Traditional", "zho"), 409 ZND("Zande", "zne"), 410 ZUL("Zulu", "zul"), 411 de("German found in FreeSerif.ttf", "deu"), 412 nl("Dutch found in FreeSansBoldOblique.ttf", "nld"), 413 tmh("Tamashek found in ebrimabd.ttf", "tmh"); 414 LanguageTag(String name, String iso3List)415 private LanguageTag(String name, String iso3List) { 416 String tag = name(); 417 while (tag.length() < 4) { 418 tag += ' '; 419 } 420 this.tag = Tag.intValue(tag); 421 this.name = name; 422 this.iso3List = iso3List; 423 } 424 tag()425 public int tag() { 426 return tag; 427 } 428 longName()429 public String longName() { 430 return name; 431 } 432 isDeprecated()433 public boolean isDeprecated() { 434 return this == DHV; 435 } 436 iso3List()437 public List<String> iso3List() { 438 return Arrays.asList(iso3List.split(",")); 439 } 440 fromTag(int tag)441 static LanguageTag fromTag(int tag) { 442 for (LanguageTag script : LanguageTag.values()) { 443 if (script.tag == tag) { 444 return script; 445 } 446 } 447 throw new IllegalArgumentException(Tag.stringValue(tag)); 448 } 449 450 private final int tag; 451 private final String name; 452 private final String iso3List; 453 } 454