1 /*
2  * Copyright 2017 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_fvar_DEFINED
9 #define SkOTTable_fvar_DEFINED
10 
11 #include "SkEndian.h"
12 #include "SkOTTableTypes.h"
13 
14 #pragma pack(push, 1)
15 
16 struct SkOTTableFontVariations {
17     static const SK_OT_CHAR TAG0 = 'f';
18     static const SK_OT_CHAR TAG1 = 'v';
19     static const SK_OT_CHAR TAG2 = 'a';
20     static const SK_OT_CHAR TAG3 = 'r';
21     static const SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableFontVariations>::value;
22 
23     SK_OT_USHORT majorVersion;
24     SK_OT_USHORT minorVersion;
25     SK_OT_USHORT offsetToAxesArray;
26     SK_OT_USHORT reserved;
27     SK_OT_USHORT axisCount;
28     SK_OT_USHORT axisSize; // Must be 0x0014 in v1.0
29     SK_OT_USHORT instanceCount;
30     SK_OT_USHORT instanceSize; // Must be axisCount * sizeof(Fixed) + (4 | 6)
31 
32     struct VariationAxisRecord {
33         SK_OT_ULONG axisTag;
34         SK_OT_Fixed minValue;
35         SK_OT_Fixed defaultValue;
36         SK_OT_Fixed maxValue;
37         SK_OT_USHORT flags; // Must be 0
38         SK_OT_USHORT axisNameID;
39     }; // axes[axisCount];
40 
41     template <size_t AxisCount> struct InstanceRecord {
42         SK_OT_USHORT subfamilyNameID;
43         SK_OT_USHORT flags; // Must be 0
44         SK_OT_Fixed coordinates[AxisCount];
45         SK_OT_USHORT postScriptNameID;
46     }; // instances[instanceCount];
47 };
48 
49 #pragma pack(pop)
50 
51 
52 #include <stddef.h>
53 static_assert(offsetof(SkOTTableFontVariations, instanceSize) == 14, "SkOTTableFontVariations_instanceSize_not_at_14");
54 static_assert(sizeof(SkOTTableFontVariations) == 16, "sizeof_SkOTTableFontVariations_not_16");
55 
56 #endif
57