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