Line | Count | Source |
1 | | // Copyright (c) 2018 The OTS Authors. All rights reserved. |
2 | | // Use of this source code is governed by a BSD-style license that can be |
3 | | // found in the LICENSE file. |
4 | | |
5 | | #ifndef OTS_FVAR_H_ |
6 | | #define OTS_FVAR_H_ |
7 | | |
8 | | #include <vector> |
9 | | |
10 | | #include "ots.h" |
11 | | |
12 | | namespace ots { |
13 | | |
14 | | // ----------------------------------------------------------------------------- |
15 | | // OpenTypeFVAR Interface |
16 | | // ----------------------------------------------------------------------------- |
17 | | |
18 | | class OpenTypeFVAR : public Table { |
19 | | public: |
20 | | explicit OpenTypeFVAR(Font* font, uint32_t tag) |
21 | 3.84k | : Table(font, tag, tag) { } |
22 | | |
23 | | bool Parse(const uint8_t* data, size_t length); |
24 | | bool Serialize(OTSStream* out); |
25 | | |
26 | 2.18k | uint16_t AxisCount() const { return axisCount; } |
27 | | |
28 | | private: |
29 | | uint16_t majorVersion; |
30 | | uint16_t minorVersion; |
31 | | uint16_t axesArrayOffset; |
32 | | uint16_t reserved; |
33 | | uint16_t axisCount; |
34 | | uint16_t axisSize; |
35 | | uint16_t instanceCount; |
36 | | uint16_t instanceSize; |
37 | | |
38 | | typedef int32_t Fixed; /* 16.16 fixed-point value */ |
39 | | |
40 | | struct VariationAxisRecord { |
41 | | uint32_t axisTag; |
42 | | Fixed minValue; |
43 | | Fixed defaultValue; |
44 | | Fixed maxValue; |
45 | | uint16_t flags; |
46 | | uint16_t axisNameID; |
47 | | }; |
48 | | std::vector<VariationAxisRecord> axes; |
49 | | |
50 | | struct InstanceRecord { |
51 | | uint16_t subfamilyNameID; |
52 | | uint16_t flags; |
53 | | std::vector<Fixed> coordinates; |
54 | | uint16_t postScriptNameID; // optional |
55 | | }; |
56 | | std::vector<InstanceRecord> instances; |
57 | | |
58 | | bool instancesHavePostScriptNameID; |
59 | | }; |
60 | | |
61 | | } // namespace ots |
62 | | |
63 | | #endif // OTS_FVAR_H_ |