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