Line | Count | Source |
1 | | // Copyright (c) 2022 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_CPAL_H_ |
6 | | #define OTS_CPAL_H_ |
7 | | |
8 | | #include "ots.h" |
9 | | |
10 | | #include <vector> |
11 | | |
12 | | namespace ots { |
13 | | |
14 | | class OpenTypeCPAL : public Table { |
15 | | public: |
16 | | explicit OpenTypeCPAL(Font *font, uint32_t tag) |
17 | 853 | : Table(font, tag, tag) { |
18 | 853 | } |
19 | | |
20 | | bool Parse(const uint8_t *data, size_t length); |
21 | | bool Serialize(OTSStream *out); |
22 | | |
23 | | // This is public so that COLR can access it. |
24 | | uint16_t num_palette_entries; |
25 | | |
26 | | private: |
27 | | uint16_t version; |
28 | | |
29 | | std::vector<uint16_t> colorRecordIndices; |
30 | | std::vector<uint32_t> colorRecords; |
31 | | |
32 | | // Arrays present only if version == 1. |
33 | | std::vector<uint32_t> paletteTypes; |
34 | | std::vector<uint16_t> paletteLabels; |
35 | | std::vector<uint16_t> paletteEntryLabels; |
36 | | }; |
37 | | |
38 | | } // namespace ots |
39 | | |
40 | | #endif // OTS_CPAL_H_ |