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