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_OS_2_V1_DEFINED 9 #define SkOTTable_OS_2_V1_DEFINED 10 11 #include "SkEndian.h" 12 #include "SkIBMFamilyClass.h" 13 #include "SkOTTableTypes.h" 14 #include "SkPanose.h" 15 #include "SkTypedEnum.h" 16 17 #pragma pack(push, 1) 18 19 struct SkOTTableOS2_V1 { 20 SK_OT_USHORT version; 21 static const SK_OT_USHORT VERSION = SkTEndian_SwapBE16(1); 22 23 SK_OT_SHORT xAvgCharWidth; 24 struct WeightClass { 25 SK_TYPED_ENUM(Value, SK_OT_USHORT, 26 ((Thin, SkTEndian_SwapBE16(100))) 27 ((ExtraLight, SkTEndian_SwapBE16(200))) 28 ((Light, SkTEndian_SwapBE16(300))) 29 ((Normal, SkTEndian_SwapBE16(400))) 30 ((Medium, SkTEndian_SwapBE16(500))) 31 ((SemiBold, SkTEndian_SwapBE16(600))) 32 ((Bold, SkTEndian_SwapBE16(700))) 33 ((ExtraBold, SkTEndian_SwapBE16(800))) 34 ((Black, SkTEndian_SwapBE16(900))) 35 SK_SEQ_END, 36 SK_SEQ_END) 37 SK_OT_USHORT value; 38 } usWeightClass; 39 struct WidthClass { 40 SK_TYPED_ENUM(Value, SK_OT_USHORT, 41 ((UltraCondensed, SkTEndian_SwapBE16(1))) 42 ((ExtraCondensed, SkTEndian_SwapBE16(2))) 43 ((Condensed, SkTEndian_SwapBE16(3))) 44 ((SemiCondensed, SkTEndian_SwapBE16(4))) 45 ((Medium, SkTEndian_SwapBE16(5))) 46 ((SemiExpanded, SkTEndian_SwapBE16(6))) 47 ((Expanded, SkTEndian_SwapBE16(7))) 48 ((ExtraExpanded, SkTEndian_SwapBE16(8))) 49 ((UltraExpanded, SkTEndian_SwapBE16(9))) 50 SK_SEQ_END, 51 (value)SK_SEQ_END) 52 } usWidthClass; 53 union Type { 54 struct Field { 55 //8-15 56 SK_OT_BYTE_BITFIELD( 57 Reserved08, 58 Reserved09, 59 Reserved10, 60 Reserved11, 61 Reserved12, 62 Reserved13, 63 Reserved14, 64 Reserved15) 65 //0-7 66 SK_OT_BYTE_BITFIELD( 67 Reserved00, 68 Restricted, 69 PreviewPrint, 70 Editable, 71 Reserved04, 72 Reserved05, 73 Reserved06, 74 Reserved07) 75 } field; 76 struct Raw { 77 static const SK_OT_USHORT Installable = 0; 78 static const SK_OT_USHORT RestrictedMask = SkOTSetUSHORTBit<1>::value; 79 static const SK_OT_USHORT PreviewPrintMask = SkOTSetUSHORTBit<2>::value; 80 static const SK_OT_USHORT EditableMask = SkOTSetUSHORTBit<3>::value; 81 SK_OT_USHORT value; 82 } raw; 83 } fsType; 84 SK_OT_SHORT ySubscriptXSize; 85 SK_OT_SHORT ySubscriptYSize; 86 SK_OT_SHORT ySubscriptXOffset; 87 SK_OT_SHORT ySubscriptYOffset; 88 SK_OT_SHORT ySuperscriptXSize; 89 SK_OT_SHORT ySuperscriptYSize; 90 SK_OT_SHORT ySuperscriptXOffset; 91 SK_OT_SHORT ySuperscriptYOffset; 92 SK_OT_SHORT yStrikeoutSize; 93 SK_OT_SHORT yStrikeoutPosition; 94 SkIBMFamilyClass sFamilyClass; 95 SkPanose panose; 96 union UnicodeRange { 97 struct Field { 98 //l0 24-31 99 SK_OT_BYTE_BITFIELD( 100 Thai, 101 Lao, 102 BasicGeorgian, 103 GeorgianExtended, 104 HangulJamo, 105 LatinExtendedAdditional, 106 GreekExtended, 107 GeneralPunctuation) 108 //l0 16-23 109 SK_OT_BYTE_BITFIELD( 110 Bengali, 111 Gurmukhi, 112 Gujarati, 113 Oriya, 114 Tamil, 115 Telugu, 116 Kannada, 117 Malayalam) 118 //l0 8-15 119 SK_OT_BYTE_BITFIELD( 120 GreekSymbolsAndCoptic, 121 Cyrillic, 122 Armenian, 123 BasicHebrew, 124 HebrewExtendedAB, 125 BasicArabic, 126 ArabicExtended, 127 Devanagari) 128 //l0 0-7 129 SK_OT_BYTE_BITFIELD( 130 BasicLatin, 131 Latin1Supplement, 132 LatinExtendedA, 133 LatinExtendedB, 134 IPAExtensions, 135 SpacingModifierLetters, 136 CombiningDiacriticalMarks, 137 BasicGreek) 138 139 //l1 24-31 140 SK_OT_BYTE_BITFIELD( 141 Hangul, 142 Reserved057, 143 Reserved058, 144 CJKUnifiedIdeographs, 145 PrivateUseArea, 146 CJKCompatibilityIdeographs, 147 AlphabeticPresentationForms, 148 ArabicPresentationFormsA) 149 //l1 16-23 150 SK_OT_BYTE_BITFIELD( 151 CJKSymbolsAndPunctuation, 152 Hiragana, 153 Katakana, 154 Bopomofo, 155 HangulCompatibilityJamo, 156 CJKMiscellaneous, 157 EnclosedCJKLettersAndMonths, 158 CJKCompatibility) 159 //l1 8-15 160 SK_OT_BYTE_BITFIELD( 161 ControlPictures, 162 OpticalCharacterRecognition, 163 EnclosedAlphanumerics, 164 BoxDrawing, 165 BlockElements, 166 GeometricShapes, 167 MiscellaneousSymbols, 168 Dingbats) 169 //l1 0-7 170 SK_OT_BYTE_BITFIELD( 171 SuperscriptsAndSubscripts, 172 CurrencySymbols, 173 CombiningDiacriticalMarksForSymbols, 174 LetterlikeSymbols, 175 NumberForms, 176 Arrows, 177 MathematicalOperators, 178 MiscellaneousTechnical) 179 180 //l2 24-31 181 SK_OT_BYTE_BITFIELD( 182 Reserved088, 183 Reserved089, 184 Reserved090, 185 Reserved091, 186 Reserved092, 187 Reserved093, 188 Reserved094, 189 Reserved095) 190 //l2 16-23 191 SK_OT_BYTE_BITFIELD( 192 Reserved080, 193 Reserved081, 194 Reserved082, 195 Reserved083, 196 Reserved084, 197 Reserved085, 198 Reserved086, 199 Reserved087) 200 //l2 8-15 201 SK_OT_BYTE_BITFIELD( 202 Reserved072, 203 Reserved073, 204 Reserved074, 205 Reserved075, 206 Reserved076, 207 Reserved077, 208 Reserved078, 209 Reserved079) 210 //l2 0-7 211 SK_OT_BYTE_BITFIELD( 212 CombiningHalfMarks, 213 CJKCompatibilityForms, 214 SmallFormVariants, 215 ArabicPresentationFormsB, 216 HalfwidthAndFullwidthForms, 217 Specials, 218 Reserved70, 219 Reserved71) 220 221 //l3 24-31 222 SK_OT_BYTE_BITFIELD( 223 Reserved120, 224 Reserved121, 225 Reserved122, 226 Reserved123, 227 Reserved124, 228 Reserved125, 229 Reserved126, 230 Reserved127) 231 //l3 16-23 232 SK_OT_BYTE_BITFIELD( 233 Reserved112, 234 Reserved113, 235 Reserved114, 236 Reserved115, 237 Reserved116, 238 Reserved117, 239 Reserved118, 240 Reserved119) 241 //l3 8-15 242 SK_OT_BYTE_BITFIELD( 243 Reserved104, 244 Reserved105, 245 Reserved106, 246 Reserved107, 247 Reserved108, 248 Reserved109, 249 Reserved110, 250 Reserved111) 251 //l3 0-7 252 SK_OT_BYTE_BITFIELD( 253 Reserved096, 254 Reserved097, 255 Reserved098, 256 Reserved099, 257 Reserved100, 258 Reserved101, 259 Reserved102, 260 Reserved103) 261 } field; 262 struct Raw { 263 struct l0 { 264 static const SK_OT_ULONG BasicLatinMask = SkOTSetULONGBit<0>::value; 265 static const SK_OT_ULONG Latin1SupplementMask = SkOTSetULONGBit<1>::value; 266 static const SK_OT_ULONG LatinExtendedAMask = SkOTSetULONGBit<2>::value; 267 static const SK_OT_ULONG LatinExtendedBMask = SkOTSetULONGBit<3>::value; 268 static const SK_OT_ULONG IPAExtensionsMask = SkOTSetULONGBit<4>::value; 269 static const SK_OT_ULONG SpacingModifierLettersMask = SkOTSetULONGBit<5>::value; 270 static const SK_OT_ULONG CombiningDiacriticalMarksMask = SkOTSetULONGBit<6>::value; 271 static const SK_OT_ULONG BasicGreekMask = SkOTSetULONGBit<7>::value; 272 static const SK_OT_ULONG GreekSymbolsAndCCopticMask = SkOTSetULONGBit<8>::value; 273 static const SK_OT_ULONG CyrillicMask = SkOTSetULONGBit<9>::value; 274 static const SK_OT_ULONG ArmenianMask = SkOTSetULONGBit<10>::value; 275 static const SK_OT_ULONG BasicHebrewMask = SkOTSetULONGBit<11>::value; 276 static const SK_OT_ULONG HebrewExtendedABMask = SkOTSetULONGBit<12>::value; 277 static const SK_OT_ULONG BasicArabicMask = SkOTSetULONGBit<13>::value; 278 static const SK_OT_ULONG ArabicExtendedMask = SkOTSetULONGBit<14>::value; 279 static const SK_OT_ULONG DevanagariMask = SkOTSetULONGBit<15>::value; 280 static const SK_OT_ULONG BengaliMask = SkOTSetULONGBit<16>::value; 281 static const SK_OT_ULONG GurmukhiMask = SkOTSetULONGBit<17>::value; 282 static const SK_OT_ULONG GujaratiMask = SkOTSetULONGBit<18>::value; 283 static const SK_OT_ULONG OriyaMask = SkOTSetULONGBit<19>::value; 284 static const SK_OT_ULONG TamilMask = SkOTSetULONGBit<20>::value; 285 static const SK_OT_ULONG TeluguMask = SkOTSetULONGBit<21>::value; 286 static const SK_OT_ULONG KannadaMask = SkOTSetULONGBit<22>::value; 287 static const SK_OT_ULONG MalayalamMask = SkOTSetULONGBit<23>::value; 288 static const SK_OT_ULONG ThaiMask = SkOTSetULONGBit<24>::value; 289 static const SK_OT_ULONG LaoMask = SkOTSetULONGBit<25>::value; 290 static const SK_OT_ULONG BasicGeorgianMask = SkOTSetULONGBit<26>::value; 291 static const SK_OT_ULONG GeorgianExtendedMask = SkOTSetULONGBit<27>::value; 292 static const SK_OT_ULONG HangulJamoMask = SkOTSetULONGBit<28>::value; 293 static const SK_OT_ULONG LatinExtendedAdditionalMask = SkOTSetULONGBit<29>::value; 294 static const SK_OT_ULONG GreekExtendedMask = SkOTSetULONGBit<30>::value; 295 static const SK_OT_ULONG GeneralPunctuationMask = SkOTSetULONGBit<31>::value; 296 }; 297 struct l1 { 298 static const SK_OT_ULONG SuperscriptsAndSubscriptsMask = SkOTSetULONGBit<32 - 32>::value; 299 static const SK_OT_ULONG CurrencySymbolsMask = SkOTSetULONGBit<33 - 32>::value; 300 static const SK_OT_ULONG CombiningDiacriticalMarksForSymbolsMask = SkOTSetULONGBit<34 - 32>::value; 301 static const SK_OT_ULONG LetterlikeSymbolsMask = SkOTSetULONGBit<35 - 32>::value; 302 static const SK_OT_ULONG NumberFormsMask = SkOTSetULONGBit<36 - 32>::value; 303 static const SK_OT_ULONG ArrowsMask = SkOTSetULONGBit<37 - 32>::value; 304 static const SK_OT_ULONG MathematicalOperatorsMask = SkOTSetULONGBit<38 - 32>::value; 305 static const SK_OT_ULONG MiscellaneousTechnicalMask = SkOTSetULONGBit<39 - 32>::value; 306 static const SK_OT_ULONG ControlPicturesMask = SkOTSetULONGBit<40 - 32>::value; 307 static const SK_OT_ULONG OpticalCharacterRecognitionMask = SkOTSetULONGBit<41 - 32>::value; 308 static const SK_OT_ULONG EnclosedAlphanumericsMask = SkOTSetULONGBit<42 - 32>::value; 309 static const SK_OT_ULONG BoxDrawingMask = SkOTSetULONGBit<43 - 32>::value; 310 static const SK_OT_ULONG BlockElementsMask = SkOTSetULONGBit<44 - 32>::value; 311 static const SK_OT_ULONG GeometricShapesMask = SkOTSetULONGBit<45 - 32>::value; 312 static const SK_OT_ULONG MiscellaneousSymbolsMask = SkOTSetULONGBit<46 - 32>::value; 313 static const SK_OT_ULONG DingbatsMask = SkOTSetULONGBit<47 - 32>::value; 314 static const SK_OT_ULONG CJKSymbolsAndPunctuationMask = SkOTSetULONGBit<48 - 32>::value; 315 static const SK_OT_ULONG HiraganaMask = SkOTSetULONGBit<49 - 32>::value; 316 static const SK_OT_ULONG KatakanaMask = SkOTSetULONGBit<50 - 32>::value; 317 static const SK_OT_ULONG BopomofoMask = SkOTSetULONGBit<51 - 32>::value; 318 static const SK_OT_ULONG HangulCompatibilityJamoMask = SkOTSetULONGBit<52 - 32>::value; 319 static const SK_OT_ULONG CJKMiscellaneousMask = SkOTSetULONGBit<53 - 32>::value; 320 static const SK_OT_ULONG EnclosedCJKLettersAndMonthsMask = SkOTSetULONGBit<54 - 32>::value; 321 static const SK_OT_ULONG CJKCompatibilityMask = SkOTSetULONGBit<55 - 32>::value; 322 static const SK_OT_ULONG HangulMask = SkOTSetULONGBit<56 - 32>::value; 323 //Reserved 324 //Reserved 325 static const SK_OT_ULONG CJKUnifiedIdeographsMask = SkOTSetULONGBit<59 - 32>::value; 326 static const SK_OT_ULONG PrivateUseAreaMask = SkOTSetULONGBit<60 - 32>::value; 327 static const SK_OT_ULONG CJKCompatibilityIdeographsMask = SkOTSetULONGBit<61 - 32>::value; 328 static const SK_OT_ULONG AlphabeticPresentationFormsMask = SkOTSetULONGBit<62 - 32>::value; 329 static const SK_OT_ULONG ArabicPresentationFormsAMask = SkOTSetULONGBit<63 - 32>::value; 330 }; 331 struct l2 { 332 static const SK_OT_ULONG CombiningHalfMarksMask = SkOTSetULONGBit<64 - 64>::value; 333 static const SK_OT_ULONG CJKCompatibilityFormsMask = SkOTSetULONGBit<65 - 64>::value; 334 static const SK_OT_ULONG SmallFormVariantsMask = SkOTSetULONGBit<66 - 64>::value; 335 static const SK_OT_ULONG ArabicPresentationFormsBMask = SkOTSetULONGBit<67 - 64>::value; 336 static const SK_OT_ULONG HalfwidthAndFullwidthFormsMask = SkOTSetULONGBit<68 - 64>::value; 337 static const SK_OT_ULONG SpecialsMask = SkOTSetULONGBit<69 - 64>::value; 338 }; 339 SK_OT_ULONG value[4]; 340 } raw; 341 } ulUnicodeRange; 342 SK_OT_CHAR achVendID[4]; 343 union Selection { 344 struct Field { 345 //8-15 346 SK_OT_BYTE_BITFIELD( 347 Reserved08, 348 Reserved09, 349 Reserved10, 350 Reserved11, 351 Reserved12, 352 Reserved13, 353 Reserved14, 354 Reserved15) 355 //0-7 356 SK_OT_BYTE_BITFIELD( 357 Italic, 358 Underscore, 359 Negative, 360 Outlined, 361 Strikeout, 362 Bold, 363 Regular, 364 Reserved07) 365 } field; 366 struct Raw { 367 static const SK_OT_USHORT ItalicMask = SkOTSetUSHORTBit<0>::value; 368 static const SK_OT_USHORT UnderscoreMask = SkOTSetUSHORTBit<1>::value; 369 static const SK_OT_USHORT NegativeMask = SkOTSetUSHORTBit<2>::value; 370 static const SK_OT_USHORT OutlinedMask = SkOTSetUSHORTBit<3>::value; 371 static const SK_OT_USHORT StrikeoutMask = SkOTSetUSHORTBit<4>::value; 372 static const SK_OT_USHORT BoldMask = SkOTSetUSHORTBit<5>::value; 373 static const SK_OT_USHORT RegularMask = SkOTSetUSHORTBit<6>::value; 374 SK_OT_USHORT value; 375 } raw; 376 } fsSelection; 377 SK_OT_USHORT usFirstCharIndex; 378 SK_OT_USHORT usLastCharIndex; 379 //version0 380 SK_OT_SHORT sTypoAscender; 381 SK_OT_SHORT sTypoDescender; 382 SK_OT_SHORT sTypoLineGap; 383 SK_OT_USHORT usWinAscent; 384 SK_OT_USHORT usWinDescent; 385 //version1 386 union CodePageRange { 387 struct Field { 388 //l0 24-31 389 SK_OT_BYTE_BITFIELD( 390 Reserved24, 391 Reserved25, 392 Reserved26, 393 Reserved27, 394 Reserved28, 395 MacintoshCharacterSet, 396 OEMCharacterSet, 397 SymbolCharacterSet) 398 //l0 16-23 399 SK_OT_BYTE_BITFIELD( 400 Thai_874, 401 JISJapan_932, 402 ChineseSimplified_936, 403 KoreanWansung_949, 404 ChineseTraditional_950, 405 KoreanJohab_1361, 406 Reserved22, 407 Reserved23) 408 //l0 8-15 409 SK_OT_BYTE_BITFIELD( 410 Reserved08, 411 Reserved09, 412 Reserved10, 413 Reserved11, 414 Reserved12, 415 Reserved13, 416 Reserved14, 417 Reserved15) 418 //l0 0-7 419 SK_OT_BYTE_BITFIELD( 420 Latin1_1252, 421 Latin2EasternEurope_1250, 422 Cyrillic_1251, 423 Greek_1253, 424 Turkish_1254, 425 Hebrew_1255, 426 Arabic_1256, 427 WindowsBaltic_1257) 428 429 //l1 24-31 430 SK_OT_BYTE_BITFIELD( 431 IBMTurkish_857, 432 IBMCyrillic_855, 433 Latin2_852, 434 MSDOSBaltic_775, 435 Greek_737, 436 Arabic_708, 437 WELatin1_850, 438 US_437) 439 //l1 16-23 440 SK_OT_BYTE_BITFIELD( 441 IBMGreek_869, 442 MSDOSRussian_866, 443 MSDOSNordic_865, 444 Arabic_864, 445 MSDOSCanadianFrench_863, 446 Hebrew_862, 447 MSDOSIcelandic_861, 448 MSDOSPortuguese_860) 449 //l1 8-15 450 SK_OT_BYTE_BITFIELD( 451 Reserved40, 452 Reserved41, 453 Reserved42, 454 Reserved43, 455 Reserved44, 456 Reserved45, 457 Reserved46, 458 Reserved47) 459 //l1 0-7 460 SK_OT_BYTE_BITFIELD( 461 Reserved32, 462 Reserved33, 463 Reserved34, 464 Reserved35, 465 Reserved36, 466 Reserved37, 467 Reserved38, 468 Reserved39) 469 } field; 470 struct Raw { 471 struct l0 { 472 static const SK_OT_ULONG Latin1_1252Mask = SkOTSetULONGBit<0>::value; 473 static const SK_OT_ULONG Latin2EasternEurope_1250Mask = SkOTSetULONGBit<1>::value; 474 static const SK_OT_ULONG Cyrillic_1251Mask = SkOTSetULONGBit<2>::value; 475 static const SK_OT_ULONG Greek_1253Mask = SkOTSetULONGBit<3>::value; 476 static const SK_OT_ULONG Turkish_1254Mask = SkOTSetULONGBit<4>::value; 477 static const SK_OT_ULONG Hebrew_1255Mask = SkOTSetULONGBit<5>::value; 478 static const SK_OT_ULONG Arabic_1256Mask = SkOTSetULONGBit<6>::value; 479 static const SK_OT_ULONG WindowsBaltic_1257Mask = SkOTSetULONGBit<7>::value; 480 static const SK_OT_ULONG Thai_874Mask = SkOTSetULONGBit<16>::value; 481 static const SK_OT_ULONG JISJapan_932Mask = SkOTSetULONGBit<17>::value; 482 static const SK_OT_ULONG ChineseSimplified_936Mask = SkOTSetULONGBit<18>::value; 483 static const SK_OT_ULONG KoreanWansung_949Mask = SkOTSetULONGBit<19>::value; 484 static const SK_OT_ULONG ChineseTraditional_950Mask = SkOTSetULONGBit<20>::value; 485 static const SK_OT_ULONG KoreanJohab_1361Mask = SkOTSetULONGBit<21>::value; 486 static const SK_OT_ULONG MacintoshCharacterSetMask = SkOTSetULONGBit<29>::value; 487 static const SK_OT_ULONG OEMCharacterSetMask = SkOTSetULONGBit<30>::value; 488 static const SK_OT_ULONG SymbolCharacterSetMask = SkOTSetULONGBit<31>::value; 489 }; 490 struct l1 { 491 static const SK_OT_ULONG IBMGreek_869Mask = SkOTSetULONGBit<48 - 32>::value; 492 static const SK_OT_ULONG MSDOSRussian_866Mask = SkOTSetULONGBit<49 - 32>::value; 493 static const SK_OT_ULONG MSDOSNordic_865Mask = SkOTSetULONGBit<50 - 32>::value; 494 static const SK_OT_ULONG Arabic_864Mask = SkOTSetULONGBit<51 - 32>::value; 495 static const SK_OT_ULONG MSDOSCanadianFrench_863Mask = SkOTSetULONGBit<52 - 32>::value; 496 static const SK_OT_ULONG Hebrew_862Mask = SkOTSetULONGBit<53 - 32>::value; 497 static const SK_OT_ULONG MSDOSIcelandic_861Mask = SkOTSetULONGBit<54 - 32>::value; 498 static const SK_OT_ULONG MSDOSPortuguese_860Mask = SkOTSetULONGBit<55 - 32>::value; 499 static const SK_OT_ULONG IBMTurkish_857Mask = SkOTSetULONGBit<56 - 32>::value; 500 static const SK_OT_ULONG IBMCyrillic_855Mask = SkOTSetULONGBit<57 - 32>::value; 501 static const SK_OT_ULONG Latin2_852Mask = SkOTSetULONGBit<58 - 32>::value; 502 static const SK_OT_ULONG MSDOSBaltic_775Mask = SkOTSetULONGBit<59 - 32>::value; 503 static const SK_OT_ULONG Greek_737Mask = SkOTSetULONGBit<60 - 32>::value; 504 static const SK_OT_ULONG Arabic_708Mask = SkOTSetULONGBit<61 - 32>::value; 505 static const SK_OT_ULONG WELatin1_850Mask = SkOTSetULONGBit<62 - 32>::value; 506 static const SK_OT_ULONG US_437Mask = SkOTSetULONGBit<63 - 32>::value; 507 }; 508 SK_OT_ULONG value[2]; 509 } raw; 510 } ulCodePageRange; 511 }; 512 513 #pragma pack(pop) 514 515 516 SK_COMPILE_ASSERT(sizeof(SkOTTableOS2_V1) == 86, sizeof_SkOTTableOS2_V1_not_86); 517 518 #endif 519