| 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_LAYOUT_H_ | 5 #ifndef OTS_LAYOUT_H_ |
| 6 #define OTS_LAYOUT_H_ | 6 #define OTS_LAYOUT_H_ |
| 7 | 7 |
| 8 #include "ots.h" | 8 #include "ots.h" |
| 9 | 9 |
| 10 // Utility functions for OpenType layout common table formats. | 10 // Utility functions for OpenType layout common table formats. |
| 11 // http://www.microsoft.com/typography/otspec/chapter2.htm | 11 // http://www.microsoft.com/typography/otspec/chapter2.htm |
| 12 | 12 |
| 13 namespace ots { | 13 namespace ots { |
| 14 | 14 |
| 15 | 15 |
| 16 struct LookupSubtableParser { | 16 struct LookupSubtableParser { |
| 17 struct TypeParser { | 17 struct TypeParser { |
| 18 uint16_t type; | 18 uint16_t type; |
| 19 bool (*parse)(const OpenTypeFile *file, const uint8_t *data, | 19 bool (*parse)(const Font *font, const uint8_t *data, |
| 20 const size_t length); | 20 const size_t length); |
| 21 }; | 21 }; |
| 22 size_t num_types; | 22 size_t num_types; |
| 23 uint16_t extension_type; | 23 uint16_t extension_type; |
| 24 const TypeParser *parsers; | 24 const TypeParser *parsers; |
| 25 | 25 |
| 26 bool Parse(const OpenTypeFile *file, const uint8_t *data, | 26 bool Parse(const Font *font, const uint8_t *data, |
| 27 const size_t length, const uint16_t lookup_type) const; | 27 const size_t length, const uint16_t lookup_type) const; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 bool ParseScriptListTable(const ots::OpenTypeFile *file, | 30 bool ParseScriptListTable(const ots::Font *font, |
| 31 const uint8_t *data, const size_t length, | 31 const uint8_t *data, const size_t length, |
| 32 const uint16_t num_features); | 32 const uint16_t num_features); |
| 33 | 33 |
| 34 bool ParseFeatureListTable(const ots::OpenTypeFile *file, | 34 bool ParseFeatureListTable(const ots::Font *font, |
| 35 const uint8_t *data, const size_t length, | 35 const uint8_t *data, const size_t length, |
| 36 const uint16_t num_lookups, | 36 const uint16_t num_lookups, |
| 37 uint16_t *num_features); | 37 uint16_t *num_features); |
| 38 | 38 |
| 39 bool ParseLookupListTable(OpenTypeFile *file, const uint8_t *data, | 39 bool ParseLookupListTable(Font *font, const uint8_t *data, |
| 40 const size_t length, | 40 const size_t length, |
| 41 const LookupSubtableParser* parser, | 41 const LookupSubtableParser* parser, |
| 42 uint16_t* num_lookups); | 42 uint16_t* num_lookups); |
| 43 | 43 |
| 44 bool ParseClassDefTable(const ots::OpenTypeFile *file, | 44 bool ParseClassDefTable(const ots::Font *font, |
| 45 const uint8_t *data, size_t length, | 45 const uint8_t *data, size_t length, |
| 46 const uint16_t num_glyphs, | 46 const uint16_t num_glyphs, |
| 47 const uint16_t num_classes); | 47 const uint16_t num_classes); |
| 48 | 48 |
| 49 bool ParseCoverageTable(const ots::OpenTypeFile *file, | 49 bool ParseCoverageTable(const ots::Font *font, |
| 50 const uint8_t *data, size_t length, | 50 const uint8_t *data, size_t length, |
| 51 const uint16_t num_glyphs, | 51 const uint16_t num_glyphs, |
| 52 const uint16_t expected_num_glyphs = 0); | 52 const uint16_t expected_num_glyphs = 0); |
| 53 | 53 |
| 54 bool ParseDeviceTable(const ots::OpenTypeFile *file, | 54 bool ParseDeviceTable(const ots::Font *font, |
| 55 const uint8_t *data, size_t length); | 55 const uint8_t *data, size_t length); |
| 56 | 56 |
| 57 // Parser for 'Contextual' subtable shared by GSUB/GPOS tables. | 57 // Parser for 'Contextual' subtable shared by GSUB/GPOS tables. |
| 58 bool ParseContextSubtable(const ots::OpenTypeFile *file, | 58 bool ParseContextSubtable(const ots::Font *font, |
| 59 const uint8_t *data, const size_t length, | 59 const uint8_t *data, const size_t length, |
| 60 const uint16_t num_glyphs, | 60 const uint16_t num_glyphs, |
| 61 const uint16_t num_lookups); | 61 const uint16_t num_lookups); |
| 62 | 62 |
| 63 // Parser for 'Chaining Contextual' subtable shared by GSUB/GPOS tables. | 63 // Parser for 'Chaining Contextual' subtable shared by GSUB/GPOS tables. |
| 64 bool ParseChainingContextSubtable(const ots::OpenTypeFile *file, | 64 bool ParseChainingContextSubtable(const ots::Font *font, |
| 65 const uint8_t *data, const size_t length, | 65 const uint8_t *data, const size_t length, |
| 66 const uint16_t num_glyphs, | 66 const uint16_t num_glyphs, |
| 67 const uint16_t num_lookups); | 67 const uint16_t num_lookups); |
| 68 | 68 |
| 69 bool ParseExtensionSubtable(const OpenTypeFile *file, | 69 bool ParseExtensionSubtable(const Font *font, |
| 70 const uint8_t *data, const size_t length, | 70 const uint8_t *data, const size_t length, |
| 71 const LookupSubtableParser* parser); | 71 const LookupSubtableParser* parser); |
| 72 | 72 |
| 73 } // namespace ots | 73 } // namespace ots |
| 74 | 74 |
| 75 #endif // OTS_LAYOUT_H_ | 75 #endif // OTS_LAYOUT_H_ |
| 76 | 76 |
| OLD | NEW |