summaryrefslogtreecommitdiffstats
path: root/gfx/ots/src/metrics.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /gfx/ots/src/metrics.h
parentInitial commit. (diff)
downloadfirefox-upstream/124.0.1.tar.xz
firefox-upstream/124.0.1.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/ots/src/metrics.h')
-rw-r--r--gfx/ots/src/metrics.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/gfx/ots/src/metrics.h b/gfx/ots/src/metrics.h
new file mode 100644
index 0000000000..efe14c0709
--- /dev/null
+++ b/gfx/ots/src/metrics.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2011-2017 The OTS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef OTS_METRICS_H_
+#define OTS_METRICS_H_
+
+#include <new>
+#include <utility>
+#include <vector>
+
+#include "ots.h"
+
+namespace ots {
+
+class OpenTypeMetricsHeader : public Table {
+ public:
+ explicit OpenTypeMetricsHeader(Font *font, uint32_t tag, uint32_t type)
+ : Table(font, tag, type) { }
+
+ bool Parse(const uint8_t *data, size_t length);
+ bool Serialize(OTSStream *out);
+
+ uint32_t version;
+ int16_t ascent;
+ int16_t descent;
+ int16_t linegap;
+ uint16_t adv_width_max;
+ int16_t min_sb1;
+ int16_t min_sb2;
+ int16_t max_extent;
+ int16_t caret_slope_rise;
+ int16_t caret_slope_run;
+ int16_t caret_offset;
+ uint16_t num_metrics;
+};
+
+struct OpenTypeMetricsTable : public Table {
+ public:
+ explicit OpenTypeMetricsTable(Font *font, uint32_t tag, uint32_t type,
+ uint32_t header_tag)
+ : Table(font, tag, type), m_header_tag(header_tag) { }
+
+ bool Parse(const uint8_t *data, size_t length);
+ bool Serialize(OTSStream *out);
+
+ private:
+ uint32_t m_header_tag;
+
+ std::vector<std::pair<uint16_t, int16_t> > entries;
+ std::vector<int16_t> sbs;
+};
+
+} // namespace ots
+
+#endif // OTS_METRICS_H_