Bug 1785744 [wpt PR 35504] - Recalc style for elements where :toggle() pseudo-class...
[gecko.git] / gfx / ots / src / glyf.h
blob08c585df349db447a7b9bfa0fd2e8dde31728e5d
1 // Copyright (c) 2009-2017 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.
5 #ifndef OTS_GLYF_H_
6 #define OTS_GLYF_H_
8 #include <new>
9 #include <utility>
10 #include <vector>
12 #include "ots.h"
14 namespace ots {
15 class OpenTypeMAXP;
17 class OpenTypeGLYF : public Table {
18 public:
19 explicit OpenTypeGLYF(Font *font, uint32_t tag)
20 : Table(font, tag, tag), maxp(NULL) { }
22 bool Parse(const uint8_t *data, size_t length);
23 bool Serialize(OTSStream *out);
25 private:
26 struct GidAtLevel {
27 uint16_t gid;
28 uint32_t level;
31 struct ComponentPointCount {
32 ComponentPointCount() : accumulated_component_points(0) {};
33 uint32_t accumulated_component_points;
34 std::vector<GidAtLevel> gid_stack;
37 bool ParseFlagsForSimpleGlyph(Buffer &glyph,
38 uint32_t num_flags,
39 uint32_t *flag_index,
40 uint32_t *coordinates_length);
41 bool ParseSimpleGlyph(Buffer &glyph, int16_t num_contours);
42 bool ParseCompositeGlyph(
43 Buffer &glyph,
44 ComponentPointCount* component_point_count);
47 bool TraverseComponentsCountingPoints(
48 Buffer& glyph,
49 uint16_t base_glyph_id,
50 uint32_t level,
51 ComponentPointCount* component_point_count);
53 Buffer GetGlyphBufferSection(
54 const uint8_t *data,
55 size_t length,
56 const std::vector<uint32_t>& loca_offsets,
57 unsigned glyph_id);
59 OpenTypeMAXP* maxp;
61 std::vector<std::pair<const uint8_t*, size_t> > iov;
64 } // namespace ots
66 #endif // OTS_GLYF_H_