1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkOTTable_head_DEFINED
#define SkOTTable_head_DEFINED
#include "SkEndian.h"
#include "SkOTTableTypes.h"
#include "SkTypedEnum.h"
#pragma pack(push, 1)
struct SkOTTableHead {
static const SK_OT_CHAR TAG0 = 'h';
static const SK_OT_CHAR TAG1 = 'e';
static const SK_OT_CHAR TAG2 = 'a';
static const SK_OT_CHAR TAG3 = 'd';
static const SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableHead>::value;
SK_OT_Fixed version;
static const SK_OT_Fixed version1 = SkTEndian_SwapBE32(0x00010000);
SK_OT_Fixed fontRevision;
static const uint32_t fontChecksum = 0xB1B0AFBA; //checksum of all TT fonts
SK_OT_ULONG checksumAdjustment;
SK_OT_ULONG magicNumber;
static const SK_OT_ULONG magicNumberConst = SkTEndian_SwapBE32(0x5F0F3CF5);
union Flags {
struct Field {
//8-15
SK_OT_BYTE_BITFIELD(
GXMetamorphosis_Apple,
HasStrongRTL_Apple,
HasIndicStyleRearrangement,
AgfaMicroTypeExpressProcessed,
FontConverted,
DesignedForClearType,
LastResort,
Reserved15)
//0-7
SK_OT_BYTE_BITFIELD(
BaselineAtY0,
LeftSidebearingAtX0,
InstructionsDependOnPointSize,
IntegerScaling,
InstructionsAlterAdvanceWidth,
VerticalCenteredGlyphs_Apple,
Reserved06,
RequiresLayout_Apple)
} field;
struct Raw {
static const SK_OT_USHORT BaselineAtY0Mask = SkTEndian_SwapBE16(1 << 0);
static const SK_OT_USHORT LeftSidebearingAtX0Mask = SkTEndian_SwapBE16(1 << 1);
static const SK_OT_USHORT InstructionsDependOnPointSizeMask = SkTEndian_SwapBE16(1 << 2);
static const SK_OT_USHORT IntegerScalingMask = SkTEndian_SwapBE16(1 << 3);
static const SK_OT_USHORT InstructionsAlterAdvanceWidthMask = SkTEndian_SwapBE16(1 << 4);
static const SK_OT_USHORT VerticalCenteredGlyphs_AppleMask = SkTEndian_SwapBE16(1 << 5);
//Reserved
static const SK_OT_USHORT RequiresLayout_AppleMask = SkTEndian_SwapBE16(1 << 7);
static const SK_OT_USHORT GXMetamorphosis_AppleMask = SkTEndian_SwapBE16(1 << 8);
static const SK_OT_USHORT HasStrongRTL_AppleMask = SkTEndian_SwapBE16(1 << 9);
static const SK_OT_USHORT HasIndicStyleRearrangementMask = SkTEndian_SwapBE16(1 << 10);
static const SK_OT_USHORT AgfaMicroTypeExpressProcessedMask = SkTEndian_SwapBE16(1 << 11);
static const SK_OT_USHORT FontConvertedMask = SkTEndian_SwapBE16(1 << 12);
static const SK_OT_USHORT DesignedForClearTypeMask = SkTEndian_SwapBE16(1 << 13);
static const SK_OT_USHORT LastResortMask = SkTEndian_SwapBE16(1 << 14);
//Reserved
SK_OT_USHORT value;
} raw;
} flags;
SK_OT_USHORT unitsPerEm;
SK_OT_LONGDATETIME created;
SK_OT_LONGDATETIME modified;
SK_OT_SHORT xMin;
SK_OT_SHORT yMin;
SK_OT_SHORT xMax;
SK_OT_SHORT yMax;
union MacStyle {
struct Field {
//8-15
SK_OT_BYTE_BITFIELD(
Reserved08,
Reserved09,
Reserved10,
Reserved11,
Reserved12,
Reserved13,
Reserved14,
Reserved15)
//0-7
SK_OT_BYTE_BITFIELD(
Bold,
Italic,
Underline,
Outline,
Shadow,
Condensed,
Extended,
Reserved07)
} field;
struct Raw {
static const SK_OT_USHORT BoldMask = SkTEndian_SwapBE16(1);
static const SK_OT_USHORT ItalicMask = SkTEndian_SwapBE16(1 << 1);
static const SK_OT_USHORT UnderlineMask = SkTEndian_SwapBE16(1 << 2);
static const SK_OT_USHORT OutlineMask = SkTEndian_SwapBE16(1 << 3);
static const SK_OT_USHORT ShadowMask = SkTEndian_SwapBE16(1 << 4);
static const SK_OT_USHORT CondensedMask = SkTEndian_SwapBE16(1 << 5);
static const SK_OT_USHORT ExtendedMask = SkTEndian_SwapBE16(1 << 6);
SK_OT_USHORT value;
} raw;
} macStyle;
SK_OT_USHORT lowestRecPPEM;
struct FontDirectionHint {
SK_TYPED_ENUM(Value, SK_OT_SHORT,
((FullyMixedDirectionalGlyphs, SkTEndian_SwapBE16(0)))
((OnlyStronglyLTR, SkTEndian_SwapBE16(1)))
((StronglyLTR, SkTEndian_SwapBE16(2)))
((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16((uint16_t)-1))))
((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16((uint16_t)-2))))
SK_SEQ_END,
(value)SK_SEQ_END)
} fontDirectionHint;
struct IndexToLocFormat {
SK_TYPED_ENUM(Value, SK_OT_SHORT,
((ShortOffsets, SkTEndian_SwapBE16(0)))
((LongOffsets, SkTEndian_SwapBE16(1)))
SK_SEQ_END,
(value)SK_SEQ_END)
} indexToLocFormat;
struct GlyphDataFormat {
SK_TYPED_ENUM(Value, SK_OT_SHORT,
((CurrentFormat, SkTEndian_SwapBE16(0)))
SK_SEQ_END,
(value)SK_SEQ_END)
} glyphDataFormat;
};
#pragma pack(pop)
#include <stddef.h>
static_assert(offsetof(SkOTTableHead, glyphDataFormat) == 52, "SkOTTableHead_glyphDataFormat_not_at_52");
static_assert(sizeof(SkOTTableHead) == 54, "sizeof_SkOTTableHead_not_54");
#endif
|