OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef OTS_METRICS_H_ | 5 #ifndef OTS_METRICS_H_ |
6 #define OTS_METRICS_H_ | 6 #define OTS_METRICS_H_ |
7 | 7 |
8 #include <utility> // std::pair | 8 #include <new> |
| 9 #include <utility> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "ots.h" | 12 #include "ots.h" |
12 | 13 |
13 namespace ots { | 14 namespace ots { |
14 | 15 |
15 struct OpenTypeMetricsHeader { | 16 struct OpenTypeMetricsHeader { |
16 uint32_t version; | 17 uint32_t version; |
17 int16_t ascent; | 18 int16_t ascent; |
18 int16_t descent; | 19 int16_t descent; |
19 int16_t linegap; | 20 int16_t linegap; |
20 uint16_t adv_width_max; | 21 uint16_t adv_width_max; |
21 int16_t min_sb1; | 22 int16_t min_sb1; |
22 int16_t min_sb2; | 23 int16_t min_sb2; |
23 int16_t max_extent; | 24 int16_t max_extent; |
24 int16_t caret_slope_rise; | 25 int16_t caret_slope_rise; |
25 int16_t caret_slope_run; | 26 int16_t caret_slope_run; |
26 int16_t caret_offset; | 27 int16_t caret_offset; |
27 uint16_t num_metrics; | 28 uint16_t num_metrics; |
28 }; | 29 }; |
29 | 30 |
30 struct OpenTypeMetricsTable { | 31 struct OpenTypeMetricsTable { |
31 std::vector<std::pair<uint16_t, int16_t> > entries; | 32 std::vector<std::pair<uint16_t, int16_t> > entries; |
32 std::vector<int16_t> sbs; | 33 std::vector<int16_t> sbs; |
33 }; | 34 }; |
34 | 35 |
35 bool ParseMetricsHeader(OpenTypeFile *file, Buffer *table, | 36 bool ParseMetricsHeader(OpenTypeFile *file, Buffer *table, |
36 OpenTypeMetricsHeader *header); | 37 OpenTypeMetricsHeader *header); |
37 bool SerialiseMetricsHeader(OTSStream *out, | 38 bool SerialiseMetricsHeader(const ots::OpenTypeFile *file, |
| 39 OTSStream *out, |
38 const OpenTypeMetricsHeader *header); | 40 const OpenTypeMetricsHeader *header); |
39 | 41 |
40 bool ParseMetricsTable(Buffer *table, | 42 bool ParseMetricsTable(const ots::OpenTypeFile *file, |
| 43 Buffer *table, |
41 const uint16_t num_glyphs, | 44 const uint16_t num_glyphs, |
42 const OpenTypeMetricsHeader *header, | 45 const OpenTypeMetricsHeader *header, |
43 OpenTypeMetricsTable *metrics); | 46 OpenTypeMetricsTable *metrics); |
44 bool SerialiseMetricsTable(OTSStream *out, | 47 bool SerialiseMetricsTable(const ots::OpenTypeFile *file, |
| 48 OTSStream *out, |
45 const OpenTypeMetricsTable *metrics); | 49 const OpenTypeMetricsTable *metrics); |
46 | 50 |
47 } // namespace ots | 51 } // namespace ots |
48 | 52 |
49 #endif // OTS_METRICS_H_ | 53 #endif // OTS_METRICS_H_ |
50 | 54 |
OLD | NEW |