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_V0_DEFINED 9 #define SkOTTable_OS_2_V0_DEFINED 10 11 #include "SkEndian.h" 12 #include "SkIBMFamilyClass.h" 13 #include "SkOTTableTypes.h" 14 #include "SkPanose.h" 15 16 #pragma pack(push, 1) 17 18 struct SkOTTableOS2_V0 { 19 SK_OT_USHORT version; 20 //SkOTTableOS2_VA::VERSION and SkOTTableOS2_V0::VERSION are both 0. 21 //The only way to differentiate these two versions is by the size of the table. 22 static const SK_OT_USHORT VERSION = SkTEndian_SwapBE16(0); 23 24 SK_OT_SHORT xAvgCharWidth; 25 struct WeightClass { 26 enum Value : SK_OT_USHORT { 27 Thin = SkTEndian_SwapBE16(100), 28 ExtraLight = SkTEndian_SwapBE16(200), 29 Light = SkTEndian_SwapBE16(300), 30 Normal = SkTEndian_SwapBE16(400), 31 Medium = SkTEndian_SwapBE16(500), 32 SemiBold = SkTEndian_SwapBE16(600), 33 Bold = SkTEndian_SwapBE16(700), 34 ExtraBold = SkTEndian_SwapBE16(800), 35 Black = SkTEndian_SwapBE16(900), 36 }; 37 SK_OT_USHORT value; 38 } usWeightClass; 39 struct WidthClass { 40 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 } value; 51 } usWidthClass; 52 union Type { 53 struct Field { 54 //8-15 55 SK_OT_BYTE_BITFIELD( 56 Reserved08, 57 Reserved09, 58 Reserved10, 59 Reserved11, 60 Reserved12, 61 Reserved13, 62 Reserved14, 63 Reserved15) 64 //0-7 65 SK_OT_BYTE_BITFIELD( 66 Reserved00, 67 Restricted, 68 PreviewPrint, 69 Editable, 70 Reserved04, 71 Reserved05, 72 Reserved06, 73 Reserved07) 74 } field; 75 struct Raw { 76 static const SK_OT_USHORT Installable = 0; 77 static const SK_OT_USHORT RestrictedMask = SkOTSetUSHORTBit<1>::value; 78 static const SK_OT_USHORT PreviewPrintMask = SkOTSetUSHORTBit<2>::value; 79 static const SK_OT_USHORT EditableMask = SkOTSetUSHORTBit<3>::value; 80 SK_OT_USHORT value; 81 } raw; 82 } fsType; 83 SK_OT_SHORT ySubscriptXSize; 84 SK_OT_SHORT ySubscriptYSize; 85 SK_OT_SHORT ySubscriptXOffset; 86 SK_OT_SHORT ySubscriptYOffset; 87 SK_OT_SHORT ySuperscriptXSize; 88 SK_OT_SHORT ySuperscriptYSize; 89 SK_OT_SHORT ySuperscriptXOffset; 90 SK_OT_SHORT ySuperscriptYOffset; 91 SK_OT_SHORT yStrikeoutSize; 92 SK_OT_SHORT yStrikeoutPosition; 93 SkIBMFamilyClass sFamilyClass; 94 SkPanose panose; 95 SK_OT_ULONG ulCharRange[4]; 96 SK_OT_CHAR achVendID[4]; 97 union Selection { 98 struct Field { 99 //8-15 100 SK_OT_BYTE_BITFIELD( 101 Reserved08, 102 Reserved09, 103 Reserved10, 104 Reserved11, 105 Reserved12, 106 Reserved13, 107 Reserved14, 108 Reserved15) 109 //0-7 110 SK_OT_BYTE_BITFIELD( 111 Italic, 112 Underscore, 113 Negative, 114 Outlined, 115 Strikeout, 116 Bold, 117 Regular, 118 Reserved07) 119 } field; 120 struct Raw { 121 static const SK_OT_USHORT ItalicMask = SkOTSetUSHORTBit<0>::value; 122 static const SK_OT_USHORT UnderscoreMask = SkOTSetUSHORTBit<1>::value; 123 static const SK_OT_USHORT NegativeMask = SkOTSetUSHORTBit<2>::value; 124 static const SK_OT_USHORT OutlinedMask = SkOTSetUSHORTBit<3>::value; 125 static const SK_OT_USHORT StrikeoutMask = SkOTSetUSHORTBit<4>::value; 126 static const SK_OT_USHORT BoldMask = SkOTSetUSHORTBit<5>::value; 127 static const SK_OT_USHORT RegularMask = SkOTSetUSHORTBit<6>::value; 128 SK_OT_USHORT value; 129 } raw; 130 } fsSelection; 131 SK_OT_USHORT usFirstCharIndex; 132 SK_OT_USHORT usLastCharIndex; 133 //version0 134 SK_OT_SHORT sTypoAscender; 135 SK_OT_SHORT sTypoDescender; 136 SK_OT_SHORT sTypoLineGap; 137 SK_OT_USHORT usWinAscent; 138 SK_OT_USHORT usWinDescent; 139 }; 140 141 #pragma pack(pop) 142 143 144 static_assert(sizeof(SkOTTableOS2_V0) == 78, "sizeof_SkOTTableOS2_V0_not_78"); 145 146 #endif 147