1f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com/*
2f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com * Copyright 2012 Google Inc.
3f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com *
4f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com * Use of this source code is governed by a BSD-style license that can be
5f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com * found in the LICENSE file.
6f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com */
7f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com
8f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com#ifndef SkOTTable_OS_2_VA_DEFINED
9f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com#define SkOTTable_OS_2_VA_DEFINED
10f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com
11f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com#include "SkEndian.h"
12f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com#include "SkIBMFamilyClass.h"
13f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com#include "SkOTTableTypes.h"
14f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com#include "SkPanose.h"
15f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com
16f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com#pragma pack(push, 1)
17f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com
18f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com//Original V0 TT
19f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.comstruct SkOTTableOS2_VA {
20f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_USHORT version;
21a544f29496758de6ed2ebf5a53558574019c9da1bungeman@google.com    //SkOTTableOS2_VA::VERSION and SkOTTableOS2_V0::VERSION are both 0.
22a544f29496758de6ed2ebf5a53558574019c9da1bungeman@google.com    //The only way to differentiate these two versions is by the size of the table.
23a544f29496758de6ed2ebf5a53558574019c9da1bungeman@google.com    static const SK_OT_USHORT VERSION = SkTEndian_SwapBE16(0);
24b0a327e9390da5865d4c56db5e5259adc3380d37skia.committer@gmail.com
25f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT xAvgCharWidth;
26f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    struct WeightClass {
278fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman        enum Value : SK_OT_USHORT {
288fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            UltraLight = SkTEndian_SwapBE16(1),
298fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            ExtraLight = SkTEndian_SwapBE16(2),
308fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            Light = SkTEndian_SwapBE16(3),
318fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            SemiLight = SkTEndian_SwapBE16(4),
328fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            Medium = SkTEndian_SwapBE16(5),
338fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            SemiBold = SkTEndian_SwapBE16(6),
348fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            Bold = SkTEndian_SwapBE16(7),
358fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            ExtraBold = SkTEndian_SwapBE16(8),
368fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            UltraBold = SkTEndian_SwapBE16(9),
37f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            SK_SEQ_END,
388fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman        } value;
39f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    } usWeightClass;
40f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    struct WidthClass {
418fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman        enum Value : SK_OT_USHORT {
428fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            UltraCondensed = SkTEndian_SwapBE16(1),
438fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            ExtraCondensed = SkTEndian_SwapBE16(2),
448fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            Condensed = SkTEndian_SwapBE16(3),
458fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            SemiCondensed = SkTEndian_SwapBE16(4),
468fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            Medium = SkTEndian_SwapBE16(5),
478fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            SemiExpanded = SkTEndian_SwapBE16(6),
488fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            Expanded = SkTEndian_SwapBE16(7),
498fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            ExtraExpanded = SkTEndian_SwapBE16(8),
508fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman            UltraExpanded = SkTEndian_SwapBE16(9),
51f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            SK_SEQ_END,
528fd23a86d0d16c93e4fa08f79cdcca4b48b6d7f9bungeman        } value;
53f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    } usWidthClass;
54f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    union Type {
55f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com        struct Field {
56f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            //8-15
57f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            SK_OT_BYTE_BITFIELD(
58f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved08,
59f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved09,
60f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved10,
61f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved11,
62f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved12,
63f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved13,
64f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved14,
65f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved15)
66f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            //0-7
67f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            SK_OT_BYTE_BITFIELD(
68f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved00,
69f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Restricted,
70f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                PreviewPrint,
71f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Editable,
72f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved04,
73f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved05,
74f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved06,
75f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved07)
76f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com        } field;
77f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com        struct Raw {
78562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT Installable = 0;
79562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT RestrictedMask = SkOTSetUSHORTBit<1>::value;
80562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT PreviewPrintMask = SkOTSetUSHORTBit<2>::value;
81562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT EditableMask = SkOTSetUSHORTBit<3>::value;
82f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            SK_OT_USHORT value;
83f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com        } raw;
84f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    } fsType;
85f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT ySubscriptXSize;
86f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT ySubscriptYSize;
87f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT ySubscriptXOffset;
88f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT ySubscriptYOffset;
89f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT ySuperscriptXSize;
90f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT ySuperscriptYSize;
91f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT ySuperscriptXOffset;
92f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT ySuperscriptYOffset;
93f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT yStrikeoutSize;
94f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_SHORT yStrikeoutPosition;
95f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SkIBMFamilyClass sFamilyClass;
96f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SkPanose panose;
97f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_ULONG ulCharRange[4];
98f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_CHAR achVendID[4];
99f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    union Selection {
100f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com        struct Field {
101f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            //8-15
102f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            SK_OT_BYTE_BITFIELD(
103f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved08,
104f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved09,
105f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved10,
106f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved11,
107f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved12,
108f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved13,
109f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved14,
110f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved15)
111f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            //0-7
112f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            SK_OT_BYTE_BITFIELD(
113f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Italic,
114f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Underscore,
115f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Negative,
116f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Outlined,
117f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Strikeout,
118f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Bold,
119f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved06,
120f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com                Reserved07)
121f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com        } field;
122f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com        struct Raw {
123562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT ItalicMask = SkOTSetUSHORTBit<0>::value;
124562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT UnderscoreMask = SkOTSetUSHORTBit<1>::value;
125562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT NegativeMask = SkOTSetUSHORTBit<2>::value;
126562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT OutlinedMask = SkOTSetUSHORTBit<3>::value;
127562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT StrikeoutMask = SkOTSetUSHORTBit<4>::value;
128562b2e67a29f24db4c258aa2fa59cd7b4ee15174bungeman@google.com            static const SK_OT_USHORT BoldMask = SkOTSetUSHORTBit<5>::value;
129f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com            SK_OT_USHORT value;
130f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com        } raw;
131f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    } fsSelection;
132f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_USHORT usFirstCharIndex;
133f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com    SK_OT_USHORT usLastCharIndex;
134f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com};
135f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com
136f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com#pragma pack(pop)
137f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com
138f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com
13999fe82260633fcf5d92cca38d12ef0937ecca61cbungemanstatic_assert(sizeof(SkOTTableOS2_VA) == 68, "sizeof_SkOTTableOS2_VA_not_68");
140f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com
141f8d1aee2526a384a570b082b17f3a19fe72bd15ebungeman@google.com#endif
142