1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/ots/src/metrics.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +// Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#ifndef OTS_METRICS_H_ 1.9 +#define OTS_METRICS_H_ 1.10 + 1.11 +#include <new> 1.12 +#include <utility> 1.13 +#include <vector> 1.14 + 1.15 +#include "ots.h" 1.16 + 1.17 +namespace ots { 1.18 + 1.19 +struct OpenTypeMetricsHeader { 1.20 + uint32_t version; 1.21 + int16_t ascent; 1.22 + int16_t descent; 1.23 + int16_t linegap; 1.24 + uint16_t adv_width_max; 1.25 + int16_t min_sb1; 1.26 + int16_t min_sb2; 1.27 + int16_t max_extent; 1.28 + int16_t caret_slope_rise; 1.29 + int16_t caret_slope_run; 1.30 + int16_t caret_offset; 1.31 + uint16_t num_metrics; 1.32 +}; 1.33 + 1.34 +struct OpenTypeMetricsTable { 1.35 + std::vector<std::pair<uint16_t, int16_t> > entries; 1.36 + std::vector<int16_t> sbs; 1.37 +}; 1.38 + 1.39 +bool ParseMetricsHeader(OpenTypeFile *file, Buffer *table, 1.40 + OpenTypeMetricsHeader *header); 1.41 +bool SerialiseMetricsHeader(const ots::OpenTypeFile *file, 1.42 + OTSStream *out, 1.43 + const OpenTypeMetricsHeader *header); 1.44 + 1.45 +bool ParseMetricsTable(const ots::OpenTypeFile *file, 1.46 + Buffer *table, 1.47 + const uint16_t num_glyphs, 1.48 + const OpenTypeMetricsHeader *header, 1.49 + OpenTypeMetricsTable *metrics); 1.50 +bool SerialiseMetricsTable(const ots::OpenTypeFile *file, 1.51 + OTSStream *out, 1.52 + const OpenTypeMetricsTable *metrics); 1.53 + 1.54 +} // namespace ots 1.55 + 1.56 +#endif // OTS_METRICS_H_ 1.57 +