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_VA_DEFINED
9#define SkOTTable_OS_2_VA_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//Original V0 TT
19struct SkOTTableOS2_VA {
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 enum Value : SK_OT_USHORT {
28 UltraLight = SkTEndian_SwapBE16(1),
29 ExtraLight = SkTEndian_SwapBE16(2),
30 Light = SkTEndian_SwapBE16(3),
31 SemiLight = SkTEndian_SwapBE16(4),
32 Medium = SkTEndian_SwapBE16(5),
33 SemiBold = SkTEndian_SwapBE16(6),
34 Bold = SkTEndian_SwapBE16(7),
35 ExtraBold = SkTEndian_SwapBE16(8),
36 UltraBold = SkTEndian_SwapBE16(9),
37 SK_SEQ_END,
38 } value;
39 } usWeightClass;
40 struct WidthClass {
41 enum Value : SK_OT_USHORT {
42 UltraCondensed = SkTEndian_SwapBE16(1),
43 ExtraCondensed = SkTEndian_SwapBE16(2),
44 Condensed = SkTEndian_SwapBE16(3),
45 SemiCondensed = SkTEndian_SwapBE16(4),
46 Medium = SkTEndian_SwapBE16(5),
47 SemiExpanded = SkTEndian_SwapBE16(6),
48 Expanded = SkTEndian_SwapBE16(7),
49 ExtraExpanded = SkTEndian_SwapBE16(8),
50 UltraExpanded = SkTEndian_SwapBE16(9),
51 SK_SEQ_END,
52 } value;
53 } usWidthClass;
54 union Type {
55 struct Field {
56 //8-15
57 SK_OT_BYTE_BITFIELD(
58 Reserved08,
59 Reserved09,
60 Reserved10,
61 Reserved11,
62 Reserved12,
63 Reserved13,
64 Reserved14,
65 Reserved15)
66 //0-7
67 SK_OT_BYTE_BITFIELD(
68 Reserved00,
69 Restricted,
70 PreviewPrint,
71 Editable,
72 Reserved04,
73 Reserved05,
74 Reserved06,
75 Reserved07)
76 } field;
77 struct Raw {
78 static const SK_OT_USHORT Installable = 0;
79 static const SK_OT_USHORT RestrictedMask = SkOTSetUSHORTBit<1>::value;
80 static const SK_OT_USHORT PreviewPrintMask = SkOTSetUSHORTBit<2>::value;
81 static const SK_OT_USHORT EditableMask = SkOTSetUSHORTBit<3>::value;
82 SK_OT_USHORT value;
83 } raw;
84 } fsType;
85 SK_OT_SHORT ySubscriptXSize;
86 SK_OT_SHORT ySubscriptYSize;
87 SK_OT_SHORT ySubscriptXOffset;
88 SK_OT_SHORT ySubscriptYOffset;
89 SK_OT_SHORT ySuperscriptXSize;
90 SK_OT_SHORT ySuperscriptYSize;
91 SK_OT_SHORT ySuperscriptXOffset;
92 SK_OT_SHORT ySuperscriptYOffset;
93 SK_OT_SHORT yStrikeoutSize;
94 SK_OT_SHORT yStrikeoutPosition;
95 SkIBMFamilyClass sFamilyClass;
96 SkPanose panose;
97 SK_OT_ULONG ulCharRange[4];
98 SK_OT_CHAR achVendID[4];
99 union Selection {
100 struct Field {
101 //8-15
102 SK_OT_BYTE_BITFIELD(
103 Reserved08,
104 Reserved09,
105 Reserved10,
106 Reserved11,
107 Reserved12,
108 Reserved13,
109 Reserved14,
110 Reserved15)
111 //0-7
112 SK_OT_BYTE_BITFIELD(
113 Italic,
114 Underscore,
115 Negative,
116 Outlined,
117 Strikeout,
118 Bold,
119 Reserved06,
120 Reserved07)
121 } field;
122 struct Raw {
123 static const SK_OT_USHORT ItalicMask = SkOTSetUSHORTBit<0>::value;
124 static const SK_OT_USHORT UnderscoreMask = SkOTSetUSHORTBit<1>::value;
125 static const SK_OT_USHORT NegativeMask = SkOTSetUSHORTBit<2>::value;
126 static const SK_OT_USHORT OutlinedMask = SkOTSetUSHORTBit<3>::value;
127 static const SK_OT_USHORT StrikeoutMask = SkOTSetUSHORTBit<4>::value;
128 static const SK_OT_USHORT BoldMask = SkOTSetUSHORTBit<5>::value;
129 SK_OT_USHORT value;
130 } raw;
131 } fsSelection;
132 SK_OT_USHORT usFirstCharIndex;
133 SK_OT_USHORT usLastCharIndex;
134};
135
136#pragma pack(pop)
137
138
139static_assert(sizeof(SkOTTableOS2_VA) == 68, "sizeof_SkOTTableOS2_VA_not_68");
140
141#endif
142