os2.h (1577B)
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. 4 5 #ifndef OTS_OS2_H_ 6 #define OTS_OS2_H_ 7 8 #include "ots.h" 9 10 namespace ots { 11 12 struct OS2Data { 13 uint16_t version; 14 int16_t avg_char_width; 15 uint16_t weight_class; 16 uint16_t width_class; 17 uint16_t type; 18 int16_t subscript_x_size; 19 int16_t subscript_y_size; 20 int16_t subscript_x_offset; 21 int16_t subscript_y_offset; 22 int16_t superscript_x_size; 23 int16_t superscript_y_size; 24 int16_t superscript_x_offset; 25 int16_t superscript_y_offset; 26 int16_t strikeout_size; 27 int16_t strikeout_position; 28 int16_t family_class; 29 uint8_t panose[10]; 30 uint32_t unicode_range_1; 31 uint32_t unicode_range_2; 32 uint32_t unicode_range_3; 33 uint32_t unicode_range_4; 34 uint32_t vendor_id; 35 uint16_t selection; 36 uint16_t first_char_index; 37 uint16_t last_char_index; 38 int16_t typo_ascender; 39 int16_t typo_descender; 40 int16_t typo_linegap; 41 uint16_t win_ascent; 42 uint16_t win_descent; 43 uint32_t code_page_range_1; 44 uint32_t code_page_range_2; 45 int16_t x_height; 46 int16_t cap_height; 47 uint16_t default_char; 48 uint16_t break_char; 49 uint16_t max_context; 50 uint16_t lower_optical_pointsize; 51 uint16_t upper_optical_pointsize; 52 }; 53 54 class OpenTypeOS2 : public Table { 55 public: 56 explicit OpenTypeOS2(Font *font, uint32_t tag) 57 : Table(font, tag, tag) { } 58 59 bool Parse(const uint8_t *data, size_t length); 60 bool Serialize(OTSStream *out); 61 62 OS2Data table; 63 }; 64 65 } // namespace ots 66 67 #endif // OTS_OS2_H_