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