1 /* 2 * Copyright 2012 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkOTTable_name_DEFINED 9 #define SkOTTable_name_DEFINED 10 11 #include "SkEndian.h" 12 #include "SkOTTableTypes.h" 13 #include "SkString.h" 14 #include "SkTypedEnum.h" 15 16 #pragma pack(push, 1) 17 18 struct SkOTTableName { 19 static const SK_OT_CHAR TAG0 = 'n'; 20 static const SK_OT_CHAR TAG1 = 'a'; 21 static const SK_OT_CHAR TAG2 = 'm'; 22 static const SK_OT_CHAR TAG3 = 'e'; 23 static const SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableName>::value; 24 25 SK_OT_USHORT format; 26 static const SK_OT_USHORT format_0 = SkTEndian_SwapBE16(0); 27 /** Format 1 was added in OpenType 1.6 (April 2009). */ 28 static const SK_OT_USHORT format_1 = SkTEndian_SwapBE16(1); 29 30 /** The number of name records which follow. */ 31 SK_OT_USHORT count; 32 33 /** Offset in SK_OT_BYTEs to start of string storage area (from start of table). */ 34 SK_OT_USHORT stringOffset; 35 36 struct Record { 37 /** The platform ID specifies how to interpret the encoding and language ID. */ 38 struct PlatformID { 39 SK_TYPED_ENUM(Value, SK_OT_USHORT, 40 ((Unicode, SkTEndian_SwapBE16(0))) 41 ((Macintosh, SkTEndian_SwapBE16(1))) 42 ((ISO, SkTEndian_SwapBE16(2))) // Deprecated, use Unicode instead. 43 ((Windows, SkTEndian_SwapBE16(3))) 44 ((Custom, SkTEndian_SwapBE16(4))) 45 SK_SEQ_END, 46 (value)SK_SEQ_END) 47 } platformID; 48 49 union EncodingID { 50 SK_OT_USHORT custom; 51 52 /** Always UTF-16BE. */ 53 struct Unicode { 54 SK_TYPED_ENUM(Value, SK_OT_USHORT, 55 ((Unicode10, SkTEndian_SwapBE16(0))) 56 ((Unicode11, SkTEndian_SwapBE16(1))) 57 ((ISO10646, SkTEndian_SwapBE16(2))) //deprecated, use Unicode11 58 ((Unicode20BMP, SkTEndian_SwapBE16(3))) 59 ((Unicode20, SkTEndian_SwapBE16(4))) 60 ((UnicodeVariationSequences, SkTEndian_SwapBE16(5))) 61 ((UnicodeFull, SkTEndian_SwapBE16(6))) 62 SK_SEQ_END, 63 (value)SK_SEQ_END) 64 } unicode; 65 66 /** These are Mac encodings, see http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/ 67 * for their mappings to unicode. 68 * Name table strings using PlatformID::Macintosh must use Roman. 69 */ 70 struct Macintosh { 71 SK_TYPED_ENUM(Value, SK_OT_USHORT, 72 ((Roman, SkTEndian_SwapBE16(0))) 73 ((Japanese, SkTEndian_SwapBE16(1))) 74 ((ChineseTraditional, SkTEndian_SwapBE16(2))) 75 ((Korean, SkTEndian_SwapBE16(3))) 76 ((Arabic, SkTEndian_SwapBE16(4))) 77 ((Hebrew, SkTEndian_SwapBE16(5))) 78 ((Greek, SkTEndian_SwapBE16(6))) 79 ((Russian, SkTEndian_SwapBE16(7))) 80 ((RSymbol, SkTEndian_SwapBE16(8))) 81 ((Devanagari, SkTEndian_SwapBE16(9))) 82 ((Gurmukhi, SkTEndian_SwapBE16(10))) 83 ((Gujarati, SkTEndian_SwapBE16(11))) 84 ((Oriya, SkTEndian_SwapBE16(12))) 85 ((Bengali, SkTEndian_SwapBE16(13))) 86 ((Tamil, SkTEndian_SwapBE16(14))) 87 ((Telugu, SkTEndian_SwapBE16(15))) 88 ((Kannada, SkTEndian_SwapBE16(16))) 89 ((Malayalam, SkTEndian_SwapBE16(17))) 90 ((Sinhalese, SkTEndian_SwapBE16(18))) 91 ((Burmese, SkTEndian_SwapBE16(19))) 92 ((Khmer, SkTEndian_SwapBE16(20))) 93 ((Thai, SkTEndian_SwapBE16(21))) 94 ((Laotian, SkTEndian_SwapBE16(22))) 95 ((Georgian, SkTEndian_SwapBE16(23))) 96 ((Armenian, SkTEndian_SwapBE16(24))) 97 ((ChineseSimplified, SkTEndian_SwapBE16(25))) 98 ((Tibetan, SkTEndian_SwapBE16(26))) 99 ((Mongolian, SkTEndian_SwapBE16(27))) 100 ((Geez, SkTEndian_SwapBE16(28))) 101 ((Slavic, SkTEndian_SwapBE16(29))) 102 ((Vietnamese, SkTEndian_SwapBE16(30))) 103 ((Sindhi, SkTEndian_SwapBE16(31))) 104 ((Uninterpreted, SkTEndian_SwapBE16(32))) 105 SK_SEQ_END, 106 (value)SK_SEQ_END) 107 } macintosh; 108 109 /** Deprecated, use Unicode instead. */ 110 struct ISO { 111 SK_TYPED_ENUM(Value, SK_OT_USHORT, 112 ((ASCII7, SkTEndian_SwapBE16(0))) 113 ((ISO10646, SkTEndian_SwapBE16(1))) 114 ((ISO88591, SkTEndian_SwapBE16(2))) 115 SK_SEQ_END, 116 (value)SK_SEQ_END) 117 } iso; 118 119 /** Name table strings using PlatformID::Windows must use Symbol, UnicodeBMPUCS2, or 120 * UnicodeUCS4. Symbol and UnicodeBMPUCS2 are both UCS2-BE, UnicodeUCS4 is actually 121 * UTF-16BE. 122 */ 123 struct Windows { 124 SK_TYPED_ENUM(Value, SK_OT_USHORT, 125 ((Symbol, SkTEndian_SwapBE16(0))) // UCS2-BE, but don't use this font to display it's own name. 126 ((UnicodeBMPUCS2, SkTEndian_SwapBE16(1))) // UCS2-BE, Windows default 127 ((ShiftJIS, SkTEndian_SwapBE16(2))) 128 ((PRC, SkTEndian_SwapBE16(3))) 129 ((Big5, SkTEndian_SwapBE16(4))) 130 ((Wansung, SkTEndian_SwapBE16(5))) 131 ((Johab, SkTEndian_SwapBE16(6))) 132 ((UnicodeUCS4, SkTEndian_SwapBE16(10))) // UTF-16BE. It means UCS4 in charmaps. 133 SK_SEQ_END, 134 (value)SK_SEQ_END) 135 } windows; 136 } encodingID; 137 138 /** LanguageIDs <= 0x7FFF are predefined. 139 * LanguageIDs > 0x7FFF are indexes into the langTagRecord array 140 * (in format 1 name tables, see SkOTTableName::format). 141 */ 142 union LanguageID { 143 /** A value greater than 0x7FFF. 144 * languageTagID - 0x8000 is an index into the langTagRecord array. 145 */ 146 SK_OT_USHORT languageTagID; 147 148 /** These are known as Language Designators. 149 * Apple now uses BCP 47 (post OSX10.4), so there will be no new entries. 150 */ 151 struct Macintosh { 152 SK_TYPED_ENUM(Value, SK_OT_USHORT, 153 ((English, SkTEndian_SwapBE16(0))) 154 ((French, SkTEndian_SwapBE16(1))) 155 ((German, SkTEndian_SwapBE16(2))) 156 ((Italian, SkTEndian_SwapBE16(3))) 157 ((Dutch, SkTEndian_SwapBE16(4))) 158 ((Swedish, SkTEndian_SwapBE16(5))) 159 ((Spanish, SkTEndian_SwapBE16(6))) 160 ((Danish, SkTEndian_SwapBE16(7))) 161 ((Portuguese, SkTEndian_SwapBE16(8))) 162 ((Norwegian, SkTEndian_SwapBE16(9))) 163 ((Hebrew, SkTEndian_SwapBE16(10))) 164 ((Japanese, SkTEndian_SwapBE16(11))) 165 ((Arabic, SkTEndian_SwapBE16(12))) 166 ((Finnish, SkTEndian_SwapBE16(13))) 167 ((Greek, SkTEndian_SwapBE16(14))) 168 ((Icelandic, SkTEndian_SwapBE16(15))) 169 ((Maltese, SkTEndian_SwapBE16(16))) 170 ((Turkish, SkTEndian_SwapBE16(17))) 171 ((Croatian, SkTEndian_SwapBE16(18))) 172 ((ChineseTraditional, SkTEndian_SwapBE16(19))) 173 ((Urdu, SkTEndian_SwapBE16(20))) 174 ((Hindi, SkTEndian_SwapBE16(21))) 175 ((Thai, SkTEndian_SwapBE16(22))) 176 ((Korean, SkTEndian_SwapBE16(23))) 177 ((Lithuanian, SkTEndian_SwapBE16(24))) 178 ((Polish, SkTEndian_SwapBE16(25))) 179 ((Hungarian, SkTEndian_SwapBE16(26))) 180 ((Estonian, SkTEndian_SwapBE16(27))) 181 ((Latvian, SkTEndian_SwapBE16(28))) 182 ((Sami, SkTEndian_SwapBE16(29))) 183 ((Faroese, SkTEndian_SwapBE16(30))) 184 ((Farsi_Persian, SkTEndian_SwapBE16(31))) 185 ((Russian, SkTEndian_SwapBE16(32))) 186 ((ChineseSimplified, SkTEndian_SwapBE16(33))) 187 ((Flemish, SkTEndian_SwapBE16(34))) 188 ((IrishGaelic, SkTEndian_SwapBE16(35))) 189 ((Albanian, SkTEndian_SwapBE16(36))) 190 ((Romanian, SkTEndian_SwapBE16(37))) 191 ((Czech, SkTEndian_SwapBE16(38))) 192 ((Slovak, SkTEndian_SwapBE16(39))) 193 ((Slovenian, SkTEndian_SwapBE16(40))) 194 ((Yiddish, SkTEndian_SwapBE16(41))) 195 ((Serbian, SkTEndian_SwapBE16(42))) 196 ((Macedonian, SkTEndian_SwapBE16(43))) 197 ((Bulgarian, SkTEndian_SwapBE16(44))) 198 ((Ukrainian, SkTEndian_SwapBE16(45))) 199 ((Byelorussian, SkTEndian_SwapBE16(46))) 200 ((Uzbek, SkTEndian_SwapBE16(47))) 201 ((Kazakh, SkTEndian_SwapBE16(48))) 202 ((AzerbaijaniCyrillic, SkTEndian_SwapBE16(49))) 203 ((AzerbaijaniArabic, SkTEndian_SwapBE16(50))) 204 ((Armenian, SkTEndian_SwapBE16(51))) 205 ((Georgian, SkTEndian_SwapBE16(52))) 206 ((Moldavian, SkTEndian_SwapBE16(53))) 207 ((Kirghiz, SkTEndian_SwapBE16(54))) 208 ((Tajiki, SkTEndian_SwapBE16(55))) 209 ((Turkmen, SkTEndian_SwapBE16(56))) 210 ((MongolianTraditional, SkTEndian_SwapBE16(57))) 211 ((MongolianCyrillic, SkTEndian_SwapBE16(58))) 212 ((Pashto, SkTEndian_SwapBE16(59))) 213 ((Kurdish, SkTEndian_SwapBE16(60))) 214 ((Kashmiri, SkTEndian_SwapBE16(61))) 215 ((Sindhi, SkTEndian_SwapBE16(62))) 216 ((Tibetan, SkTEndian_SwapBE16(63))) 217 ((Nepali, SkTEndian_SwapBE16(64))) 218 ((Sanskrit, SkTEndian_SwapBE16(65))) 219 ((Marathi, SkTEndian_SwapBE16(66))) 220 ((Bengali, SkTEndian_SwapBE16(67))) 221 ((Assamese, SkTEndian_SwapBE16(68))) 222 ((Gujarati, SkTEndian_SwapBE16(69))) 223 ((Punjabi, SkTEndian_SwapBE16(70))) 224 ((Oriya, SkTEndian_SwapBE16(71))) 225 ((Malayalam, SkTEndian_SwapBE16(72))) 226 ((Kannada, SkTEndian_SwapBE16(73))) 227 ((Tamil, SkTEndian_SwapBE16(74))) 228 ((Telugu, SkTEndian_SwapBE16(75))) 229 ((Sinhalese, SkTEndian_SwapBE16(76))) 230 ((Burmese, SkTEndian_SwapBE16(77))) 231 ((Khmer, SkTEndian_SwapBE16(78))) 232 ((Lao, SkTEndian_SwapBE16(79))) 233 ((Vietnamese, SkTEndian_SwapBE16(80))) 234 ((Indonesian, SkTEndian_SwapBE16(81))) 235 ((Tagalong, SkTEndian_SwapBE16(82))) 236 ((MalayRoman, SkTEndian_SwapBE16(83))) 237 ((MalayArabic, SkTEndian_SwapBE16(84))) 238 ((Amharic, SkTEndian_SwapBE16(85))) 239 ((Tigrinya, SkTEndian_SwapBE16(86))) 240 ((Galla, SkTEndian_SwapBE16(87))) 241 ((Somali, SkTEndian_SwapBE16(88))) 242 ((Swahili, SkTEndian_SwapBE16(89))) 243 ((Kinyarwanda_Ruanda, SkTEndian_SwapBE16(90))) 244 ((Rundi, SkTEndian_SwapBE16(91))) 245 ((Nyanja_Chewa, SkTEndian_SwapBE16(92))) 246 ((Malagasy, SkTEndian_SwapBE16(93))) 247 ((Esperanto, SkTEndian_SwapBE16(94))) 248 ((Welsh, SkTEndian_SwapBE16(128))) 249 ((Basque, SkTEndian_SwapBE16(129))) 250 ((Catalan, SkTEndian_SwapBE16(130))) 251 ((Latin, SkTEndian_SwapBE16(131))) 252 ((Quenchua, SkTEndian_SwapBE16(132))) 253 ((Guarani, SkTEndian_SwapBE16(133))) 254 ((Aymara, SkTEndian_SwapBE16(134))) 255 ((Tatar, SkTEndian_SwapBE16(135))) 256 ((Uighur, SkTEndian_SwapBE16(136))) 257 ((Dzongkha, SkTEndian_SwapBE16(137))) 258 ((JavaneseRoman, SkTEndian_SwapBE16(138))) 259 ((SundaneseRoman, SkTEndian_SwapBE16(139))) 260 ((Galician, SkTEndian_SwapBE16(140))) 261 ((Afrikaans, SkTEndian_SwapBE16(141))) 262 ((Breton, SkTEndian_SwapBE16(142))) 263 ((Inuktitut, SkTEndian_SwapBE16(143))) 264 ((ScottishGaelic, SkTEndian_SwapBE16(144))) 265 ((ManxGaelic, SkTEndian_SwapBE16(145))) 266 ((IrishGaelicWithLenition, SkTEndian_SwapBE16(146))) 267 ((Tongan, SkTEndian_SwapBE16(147))) 268 ((GreekPolytonic, SkTEndian_SwapBE16(148))) 269 ((Greenlandic, SkTEndian_SwapBE16(149))) 270 ((AzerbaijaniRoman, SkTEndian_SwapBE16(150))) 271 SK_SEQ_END, 272 (value)SK_SEQ_END) 273 } macintosh; 274 275 /** These are known as LCIDs. 276 * On Windows the current set can be had from EnumSystemLocalesEx and LocaleNameToLCID. 277 */ 278 struct Windows { 279 SK_TYPED_ENUM(Value, SK_OT_USHORT, 280 ((Afrikaans_SouthAfrica, SkTEndian_SwapBE16(0x0436))) 281 ((Albanian_Albania, SkTEndian_SwapBE16(0x041C))) 282 ((Alsatian_France, SkTEndian_SwapBE16(0x0484))) 283 ((Amharic_Ethiopia, SkTEndian_SwapBE16(0x045E))) 284 ((Arabic_Algeria, SkTEndian_SwapBE16(0x1401))) 285 ((Arabic_Bahrain, SkTEndian_SwapBE16(0x3C01))) 286 ((Arabic_Egypt, SkTEndian_SwapBE16(0x0C01))) 287 ((Arabic_Iraq, SkTEndian_SwapBE16(0x0801))) 288 ((Arabic_Jordan, SkTEndian_SwapBE16(0x2C01))) 289 ((Arabic_Kuwait, SkTEndian_SwapBE16(0x3401))) 290 ((Arabic_Lebanon, SkTEndian_SwapBE16(0x3001))) 291 ((Arabic_Libya, SkTEndian_SwapBE16(0x1001))) 292 ((Arabic_Morocco, SkTEndian_SwapBE16(0x1801))) 293 ((Arabic_Oman, SkTEndian_SwapBE16(0x2001))) 294 ((Arabic_Qatar, SkTEndian_SwapBE16(0x4001))) 295 ((Arabic_SaudiArabia, SkTEndian_SwapBE16(0x0401))) 296 ((Arabic_Syria, SkTEndian_SwapBE16(0x2801))) 297 ((Arabic_Tunisia, SkTEndian_SwapBE16(0x1C01))) 298 ((Arabic_UAE, SkTEndian_SwapBE16(0x3801))) 299 ((Arabic_Yemen, SkTEndian_SwapBE16(0x2401))) 300 ((Armenian_Armenia, SkTEndian_SwapBE16(0x042B))) 301 ((Assamese_India, SkTEndian_SwapBE16(0x044D))) 302 ((AzeriCyrillic_Azerbaijan, SkTEndian_SwapBE16(0x082C))) 303 ((AzeriLatin_Azerbaijan, SkTEndian_SwapBE16(0x042C))) 304 ((Bashkir_Russia, SkTEndian_SwapBE16(0x046D))) 305 ((Basque_Basque, SkTEndian_SwapBE16(0x042D))) 306 ((Belarusian_Belarus, SkTEndian_SwapBE16(0x0423))) 307 ((Bengali_Bangladesh, SkTEndian_SwapBE16(0x0845))) 308 ((Bengali_India, SkTEndian_SwapBE16(0x0445))) 309 ((BosnianCyrillic_BosniaAndHerzegovina, SkTEndian_SwapBE16(0x201A))) 310 ((BosnianLatin_BosniaAndHerzegovina, SkTEndian_SwapBE16(0x141A))) 311 ((Breton_France, SkTEndian_SwapBE16(0x047E))) 312 ((Bulgarian_Bulgaria, SkTEndian_SwapBE16(0x0402))) 313 ((Catalan_Catalan, SkTEndian_SwapBE16(0x0403))) 314 ((Chinese_HongKongSAR, SkTEndian_SwapBE16(0x0C04))) 315 ((Chinese_MacaoSAR, SkTEndian_SwapBE16(0x1404))) 316 ((Chinese_PeoplesRepublicOfChina, SkTEndian_SwapBE16(0x0804))) 317 ((Chinese_Singapore, SkTEndian_SwapBE16(0x1004))) 318 ((Chinese_Taiwan, SkTEndian_SwapBE16(0x0404))) 319 ((Corsican_France, SkTEndian_SwapBE16(0x0483))) 320 ((Croatian_Croatia, SkTEndian_SwapBE16(0x041A))) 321 ((CroatianLatin_BosniaAndHerzegovina, SkTEndian_SwapBE16(0x101A))) 322 ((Czech_CzechRepublic, SkTEndian_SwapBE16(0x0405))) 323 ((Danish_Denmark, SkTEndian_SwapBE16(0x0406))) 324 ((Dari_Afghanistan, SkTEndian_SwapBE16(0x048C))) 325 ((Divehi_Maldives, SkTEndian_SwapBE16(0x0465))) 326 ((Dutch_Belgium, SkTEndian_SwapBE16(0x0813))) 327 ((Dutch_Netherlands, SkTEndian_SwapBE16(0x0413))) 328 ((English_Australia, SkTEndian_SwapBE16(0x0C09))) 329 ((English_Belize, SkTEndian_SwapBE16(0x2809))) 330 ((English_Canada, SkTEndian_SwapBE16(0x1009))) 331 ((English_Caribbean, SkTEndian_SwapBE16(0x2409))) 332 ((English_India, SkTEndian_SwapBE16(0x4009))) 333 ((English_Ireland, SkTEndian_SwapBE16(0x1809))) 334 ((English_Jamaica, SkTEndian_SwapBE16(0x2009))) 335 ((English_Malaysia, SkTEndian_SwapBE16(0x4409))) 336 ((English_NewZealand, SkTEndian_SwapBE16(0x1409))) 337 ((English_RepublicOfThePhilippines, SkTEndian_SwapBE16(0x3409))) 338 ((English_Singapore, SkTEndian_SwapBE16(0x4809))) 339 ((English_SouthAfrica, SkTEndian_SwapBE16(0x1C09))) 340 ((English_TrinidadAndTobago, SkTEndian_SwapBE16(0x2C09))) 341 ((English_UnitedKingdom, SkTEndian_SwapBE16(0x0809))) 342 ((English_UnitedStates, SkTEndian_SwapBE16(0x0409))) 343 ((English_Zimbabwe, SkTEndian_SwapBE16(0x3009))) 344 ((Estonian_Estonia, SkTEndian_SwapBE16(0x0425))) 345 ((Faroese_FaroeIslands, SkTEndian_SwapBE16(0x0438))) 346 ((Filipino_Philippines, SkTEndian_SwapBE16(0x0464))) 347 ((Finnish_Finland, SkTEndian_SwapBE16(0x040B))) 348 ((French_Belgium, SkTEndian_SwapBE16(0x080C))) 349 ((French_Canada, SkTEndian_SwapBE16(0x0C0C))) 350 ((French_France, SkTEndian_SwapBE16(0x040C))) 351 ((French_Luxembourg, SkTEndian_SwapBE16(0x140c))) 352 ((French_PrincipalityOfMonoco, SkTEndian_SwapBE16(0x180C))) 353 ((French_Switzerland, SkTEndian_SwapBE16(0x100C))) 354 ((Frisian_Netherlands, SkTEndian_SwapBE16(0x0462))) 355 ((Galician_Galician, SkTEndian_SwapBE16(0x0456))) 356 ((Georgian_Georgia, SkTEndian_SwapBE16(0x0437))) 357 ((German_Austria, SkTEndian_SwapBE16(0x0C07))) 358 ((German_Germany, SkTEndian_SwapBE16(0x0407))) 359 ((German_Liechtenstein, SkTEndian_SwapBE16(0x1407))) 360 ((German_Luxembourg, SkTEndian_SwapBE16(0x1007))) 361 ((German_Switzerland, SkTEndian_SwapBE16(0x0807))) 362 ((Greek_Greece, SkTEndian_SwapBE16(0x0408))) 363 ((Greenlandic_Greenland, SkTEndian_SwapBE16(0x046F))) 364 ((Gujarati_India, SkTEndian_SwapBE16(0x0447))) 365 ((HausaLatin_Nigeria, SkTEndian_SwapBE16(0x0468))) 366 ((Hebrew_Israel, SkTEndian_SwapBE16(0x040D))) 367 ((Hindi_India, SkTEndian_SwapBE16(0x0439))) 368 ((Hungarian_Hungary, SkTEndian_SwapBE16(0x040E))) 369 ((Icelandic_Iceland, SkTEndian_SwapBE16(0x040F))) 370 ((Igbo_Nigeria, SkTEndian_SwapBE16(0x0470))) 371 ((Indonesian_Indonesia, SkTEndian_SwapBE16(0x0421))) 372 ((Inuktitut_Canada, SkTEndian_SwapBE16(0x045D))) 373 ((InuktitutLatin_Canada, SkTEndian_SwapBE16(0x085D))) 374 ((Irish_Ireland, SkTEndian_SwapBE16(0x083C))) 375 ((isiXhosa_SouthAfrica, SkTEndian_SwapBE16(0x0434))) 376 ((isiZulu_SouthAfrica, SkTEndian_SwapBE16(0x0435))) 377 ((Italian_Italy, SkTEndian_SwapBE16(0x0410))) 378 ((Italian_Switzerland, SkTEndian_SwapBE16(0x0810))) 379 ((Japanese_Japan, SkTEndian_SwapBE16(0x0411))) 380 ((Kannada_India, SkTEndian_SwapBE16(0x044B))) 381 ((Kazakh_Kazakhstan, SkTEndian_SwapBE16(0x043F))) 382 ((Khmer_Cambodia, SkTEndian_SwapBE16(0x0453))) 383 ((Kiche_Guatemala, SkTEndian_SwapBE16(0x0486))) 384 ((Kinyarwanda_Rwanda, SkTEndian_SwapBE16(0x0487))) 385 ((Kiswahili_Kenya, SkTEndian_SwapBE16(0x0441))) 386 ((Konkani_India, SkTEndian_SwapBE16(0x0457))) 387 ((Korean_Korea, SkTEndian_SwapBE16(0x0412))) 388 ((Kyrgyz_Kyrgyzstan, SkTEndian_SwapBE16(0x0440))) 389 ((Lao_LaoPDR, SkTEndian_SwapBE16(0x0454))) 390 ((Latvian_Latvia, SkTEndian_SwapBE16(0x0426))) 391 ((Lithuanian_Lithuania, SkTEndian_SwapBE16(0x0427))) 392 ((LowerSorbian_Germany, SkTEndian_SwapBE16(0x082E))) 393 ((Luxembourgish_Luxembourg, SkTEndian_SwapBE16(0x046E))) 394 ((MacedonianFYROM_FormerYugoslavRepublicOfMacedonia, SkTEndian_SwapBE16(0x042F))) 395 ((Malay_BruneiDarussalam, SkTEndian_SwapBE16(0x083E))) 396 ((Malay_Malaysia, SkTEndian_SwapBE16(0x043E))) 397 ((Malayalam_India, SkTEndian_SwapBE16(0x044C))) 398 ((Maltese_Malta, SkTEndian_SwapBE16(0x043A))) 399 ((Maori_NewZealand, SkTEndian_SwapBE16(0x0481))) 400 ((Mapudungun_Chile, SkTEndian_SwapBE16(0x047A))) 401 ((Marathi_India, SkTEndian_SwapBE16(0x044E))) 402 ((Mohawk_Mohawk, SkTEndian_SwapBE16(0x047C))) 403 ((MongolianCyrillic_Mongolia, SkTEndian_SwapBE16(0x0450))) 404 ((MongolianTraditional_PeoplesRepublicOfChina, SkTEndian_SwapBE16(0x0850))) 405 ((Nepali_Nepal, SkTEndian_SwapBE16(0x0461))) 406 ((NorwegianBokmal_Norway, SkTEndian_SwapBE16(0x0414))) 407 ((NorwegianNynorsk_Norway, SkTEndian_SwapBE16(0x0814))) 408 ((Occitan_France, SkTEndian_SwapBE16(0x0482))) 409 ((Odia_India, SkTEndian_SwapBE16(0x0448))) 410 ((Pashto_Afghanistan, SkTEndian_SwapBE16(0x0463))) 411 ((Polish_Poland, SkTEndian_SwapBE16(0x0415))) 412 ((Portuguese_Brazil, SkTEndian_SwapBE16(0x0416))) 413 ((Portuguese_Portugal, SkTEndian_SwapBE16(0x0816))) 414 ((Punjabi_India, SkTEndian_SwapBE16(0x0446))) 415 ((Quechua_Bolivia, SkTEndian_SwapBE16(0x046B))) 416 ((Quechua_Ecuador, SkTEndian_SwapBE16(0x086B))) 417 ((Quechua_Peru, SkTEndian_SwapBE16(0x0C6B))) 418 ((Romanian_Romania, SkTEndian_SwapBE16(0x0418))) 419 ((Romansh_Switzerland, SkTEndian_SwapBE16(0x0417))) 420 ((Russian_Russia, SkTEndian_SwapBE16(0x0419))) 421 ((SamiInari_Finland, SkTEndian_SwapBE16(0x243B))) 422 ((SamiLule_Norway, SkTEndian_SwapBE16(0x103B))) 423 ((SamiLule_Sweden, SkTEndian_SwapBE16(0x143B))) 424 ((SamiNorthern_Finland, SkTEndian_SwapBE16(0x0C3B))) 425 ((SamiNorthern_Norway, SkTEndian_SwapBE16(0x043B))) 426 ((SamiNorthern_Sweden, SkTEndian_SwapBE16(0x083B))) 427 ((SamiSkolt_Finland, SkTEndian_SwapBE16(0x203B))) 428 ((SamiSouthern_Norway, SkTEndian_SwapBE16(0x183B))) 429 ((SamiSouthern_Sweden, SkTEndian_SwapBE16(0x1C3B))) 430 ((Sanskrit_India, SkTEndian_SwapBE16(0x044F))) 431 ((SerbianCyrillic_BosniaAndHerzegovina, SkTEndian_SwapBE16(0x1C1A))) 432 ((SerbianCyrillic_Serbia, SkTEndian_SwapBE16(0x0C1A))) 433 ((SerbianLatin_BosniaAndHerzegovina, SkTEndian_SwapBE16(0x181A))) 434 ((SerbianLatin_Serbia, SkTEndian_SwapBE16(0x081A))) 435 ((SesothoSaLeboa_SouthAfrica, SkTEndian_SwapBE16(0x046C))) 436 ((Setswana_SouthAfrica, SkTEndian_SwapBE16(0x0432))) 437 ((Sinhala_SriLanka, SkTEndian_SwapBE16(0x045B))) 438 ((Slovak_Slovakia, SkTEndian_SwapBE16(0x041B))) 439 ((Slovenian_Slovenia, SkTEndian_SwapBE16(0x0424))) 440 ((Spanish_Argentina, SkTEndian_SwapBE16(0x2C0A))) 441 ((Spanish_Bolivia, SkTEndian_SwapBE16(0x400A))) 442 ((Spanish_Chile, SkTEndian_SwapBE16(0x340A))) 443 ((Spanish_Colombia, SkTEndian_SwapBE16(0x240A))) 444 ((Spanish_CostaRica, SkTEndian_SwapBE16(0x140A))) 445 ((Spanish_DominicanRepublic, SkTEndian_SwapBE16(0x1C0A))) 446 ((Spanish_Ecuador, SkTEndian_SwapBE16(0x300A))) 447 ((Spanish_ElSalvador, SkTEndian_SwapBE16(0x440A))) 448 ((Spanish_Guatemala, SkTEndian_SwapBE16(0x100A))) 449 ((Spanish_Honduras, SkTEndian_SwapBE16(0x480A))) 450 ((Spanish_Mexico, SkTEndian_SwapBE16(0x080A))) 451 ((Spanish_Nicaragua, SkTEndian_SwapBE16(0x4C0A))) 452 ((Spanish_Panama, SkTEndian_SwapBE16(0x180A))) 453 ((Spanish_Paraguay, SkTEndian_SwapBE16(0x3C0A))) 454 ((Spanish_Peru, SkTEndian_SwapBE16(0x280A))) 455 ((Spanish_PuertoRico, SkTEndian_SwapBE16(0x500A))) 456 ((SpanishModernSort_Spain, SkTEndian_SwapBE16(0x0C0A))) 457 ((SpanishTraditionalSort_Spain, SkTEndian_SwapBE16(0x040A))) 458 ((Spanish_UnitedStates, SkTEndian_SwapBE16(0x540A))) 459 ((Spanish_Uruguay, SkTEndian_SwapBE16(0x380A))) 460 ((Spanish_Venezuela, SkTEndian_SwapBE16(0x200A))) 461 ((Sweden_Finland, SkTEndian_SwapBE16(0x081D))) 462 ((Swedish_Sweden, SkTEndian_SwapBE16(0x041D))) 463 ((Syriac_Syria, SkTEndian_SwapBE16(0x045A))) 464 ((TajikCyrillic_Tajikistan, SkTEndian_SwapBE16(0x0428))) 465 ((TamazightLatin_Algeria, SkTEndian_SwapBE16(0x085F))) 466 ((Tamil_India, SkTEndian_SwapBE16(0x0449))) 467 ((Tatar_Russia, SkTEndian_SwapBE16(0x0444))) 468 ((Telugu_India, SkTEndian_SwapBE16(0x044A))) 469 ((Thai_Thailand, SkTEndian_SwapBE16(0x041E))) 470 ((Tibetan_PRC, SkTEndian_SwapBE16(0x0451))) 471 ((Turkish_Turkey, SkTEndian_SwapBE16(0x041F))) 472 ((Turkmen_Turkmenistan, SkTEndian_SwapBE16(0x0442))) 473 ((Uighur_PRC, SkTEndian_SwapBE16(0x0480))) 474 ((Ukrainian_Ukraine, SkTEndian_SwapBE16(0x0422))) 475 ((UpperSorbian_Germany, SkTEndian_SwapBE16(0x042E))) 476 ((Urdu_IslamicRepublicOfPakistan, SkTEndian_SwapBE16(0x0420))) 477 ((UzbekCyrillic_Uzbekistan, SkTEndian_SwapBE16(0x0843))) 478 ((UzbekLatin_Uzbekistan, SkTEndian_SwapBE16(0x0443))) 479 ((Vietnamese_Vietnam, SkTEndian_SwapBE16(0x042A))) 480 ((Welsh_UnitedKingdom, SkTEndian_SwapBE16(0x0452))) 481 ((Wolof_Senegal, SkTEndian_SwapBE16(0x0488))) 482 ((Yakut_Russia, SkTEndian_SwapBE16(0x0485))) 483 ((Yi_PRC, SkTEndian_SwapBE16(0x0478))) 484 ((Yoruba_Nigeria, SkTEndian_SwapBE16(0x046A))) 485 SK_SEQ_END, 486 (value)SK_SEQ_END) 487 } windows; 488 } languageID; 489 490 /** NameIDs <= 0xFF are predefined. Those > 0xFF are font specific. */ 491 union NameID { 492 /** A font specific name id which should be greater than 0xFF. */ 493 SK_OT_USHORT fontSpecific; 494 struct Predefined { 495 SK_TYPED_ENUM(Value, SK_OT_USHORT, 496 ((CopyrightNotice, SkTEndian_SwapBE16(0))) 497 ((FontFamilyName, SkTEndian_SwapBE16(1))) 498 ((FontSubfamilyName, SkTEndian_SwapBE16(2))) 499 ((UniqueFontIdentifier, SkTEndian_SwapBE16(3))) 500 ((FullFontName, SkTEndian_SwapBE16(4))) 501 ((VersionString, SkTEndian_SwapBE16(5))) //Version <number>.<number> 502 ((PostscriptName, SkTEndian_SwapBE16(6))) //See spec for constraints. 503 ((Trademark, SkTEndian_SwapBE16(7))) 504 ((ManufacturerName, SkTEndian_SwapBE16(8))) 505 ((Designer, SkTEndian_SwapBE16(9))) 506 ((Description, SkTEndian_SwapBE16(10))) 507 ((URLVendor, SkTEndian_SwapBE16(11))) 508 ((URLDesigner, SkTEndian_SwapBE16(12))) 509 ((LicenseDescription, SkTEndian_SwapBE16(13))) 510 ((LicenseInfoURL, SkTEndian_SwapBE16(14))) 511 ((PreferredFamily, SkTEndian_SwapBE16(16))) 512 ((PreferredSubfamily, SkTEndian_SwapBE16(17))) 513 ((CompatibleFullName, SkTEndian_SwapBE16(18))) 514 ((SampleText, SkTEndian_SwapBE16(19))) 515 ((PostscriptCIDFindfontName, SkTEndian_SwapBE16(20))) 516 ((WWSFamilyName, SkTEndian_SwapBE16(21))) 517 ((WWSSubfamilyName, SkTEndian_SwapBE16(22))) 518 SK_SEQ_END, 519 (value)SK_SEQ_END) 520 } predefined; 521 } nameID; 522 523 /** The length of the string in SK_OT_BYTEs. */ 524 SK_OT_USHORT length; 525 526 /** Offset in SK_OT_BYTEs from start of string storage area 527 * (see SkOTTableName::stringOffset). 528 */ 529 SK_OT_USHORT offset; 530 }; //nameRecord[count]; 531 532 struct Format1Ext { 533 /** The number of languageTagRecords which follow. */ 534 SK_OT_USHORT langTagCount; 535 536 /** The encoding of a langTagRecord string is always UTF-16BE. 537 * The content should follow IETF specification BCP 47. 538 */ 539 struct LangTagRecord { 540 /** The length of the string in SK_OT_BYTEs. */ 541 SK_OT_USHORT length; 542 543 /** Offset in SK_OT_BYTEs from start of string storage area 544 * (see SkOTTableName::stringOffset). 545 */ 546 SK_OT_USHORT offset; 547 }; //langTagRecord[langTagCount] 548 }; //format1ext (if format == format_1) 549 550 class Iterator { 551 public: IteratorSkOTTableName552 Iterator(const SkOTTableName& name) : fName(name), fIndex(0), fType(-1) { } IteratorSkOTTableName553 Iterator(const SkOTTableName& name, SkOTTableName::Record::NameID::Predefined::Value type) 554 : fName(name), fIndex(0), fType(type) 555 { } 556 resetSkOTTableName557 void reset(SkOTTableName::Record::NameID::Predefined::Value type) { 558 fIndex = 0; 559 fType = type; 560 } 561 562 struct Record { 563 SkString name; 564 SkString language; 565 SK_OT_USHORT type; 566 }; 567 bool next(Record&); 568 569 private: 570 const SkOTTableName& fName; 571 size_t fIndex; 572 int fType; 573 }; 574 }; 575 576 #pragma pack(pop) 577 578 579 static_assert(sizeof(SkOTTableName) == 6, "sizeof_SkOTTableName_not_6"); 580 static_assert(sizeof(SkOTTableName::Format1Ext) == 2, "sizeof_SkOTTableNameF1_not_2"); 581 static_assert(sizeof(SkOTTableName::Format1Ext::LangTagRecord) == 4, "sizeof_SkOTTableNameLangTagRecord_not_4"); 582 static_assert(sizeof(SkOTTableName::Record) == 12, "sizeof_SkOTTableNameRecord_not_12"); 583 584 #endif 585