Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef OTS_LAYOUT_H_ |
michael@0 | 6 | #define OTS_LAYOUT_H_ |
michael@0 | 7 | |
michael@0 | 8 | #include "ots.h" |
michael@0 | 9 | |
michael@0 | 10 | // Utility functions for OpenType layout common table formats. |
michael@0 | 11 | // http://www.microsoft.com/typography/otspec/chapter2.htm |
michael@0 | 12 | |
michael@0 | 13 | namespace ots { |
michael@0 | 14 | |
michael@0 | 15 | |
michael@0 | 16 | struct LookupSubtableParser { |
michael@0 | 17 | struct TypeParser { |
michael@0 | 18 | uint16_t type; |
michael@0 | 19 | bool (*parse)(const OpenTypeFile *file, const uint8_t *data, |
michael@0 | 20 | const size_t length); |
michael@0 | 21 | }; |
michael@0 | 22 | size_t num_types; |
michael@0 | 23 | uint16_t extension_type; |
michael@0 | 24 | const TypeParser *parsers; |
michael@0 | 25 | |
michael@0 | 26 | bool Parse(const OpenTypeFile *file, const uint8_t *data, |
michael@0 | 27 | const size_t length, const uint16_t lookup_type) const; |
michael@0 | 28 | }; |
michael@0 | 29 | |
michael@0 | 30 | bool ParseScriptListTable(const ots::OpenTypeFile *file, |
michael@0 | 31 | const uint8_t *data, const size_t length, |
michael@0 | 32 | const uint16_t num_features); |
michael@0 | 33 | |
michael@0 | 34 | bool ParseFeatureListTable(const ots::OpenTypeFile *file, |
michael@0 | 35 | const uint8_t *data, const size_t length, |
michael@0 | 36 | const uint16_t num_lookups, |
michael@0 | 37 | uint16_t *num_features); |
michael@0 | 38 | |
michael@0 | 39 | bool ParseLookupListTable(OpenTypeFile *file, const uint8_t *data, |
michael@0 | 40 | const size_t length, |
michael@0 | 41 | const LookupSubtableParser* parser, |
michael@0 | 42 | uint16_t* num_lookups); |
michael@0 | 43 | |
michael@0 | 44 | bool ParseClassDefTable(const ots::OpenTypeFile *file, |
michael@0 | 45 | const uint8_t *data, size_t length, |
michael@0 | 46 | const uint16_t num_glyphs, |
michael@0 | 47 | const uint16_t num_classes); |
michael@0 | 48 | |
michael@0 | 49 | bool ParseCoverageTable(const ots::OpenTypeFile *file, |
michael@0 | 50 | const uint8_t *data, size_t length, |
michael@0 | 51 | const uint16_t num_glyphs, |
michael@0 | 52 | const uint16_t expected_num_glyphs = 0); |
michael@0 | 53 | |
michael@0 | 54 | bool ParseDeviceTable(const ots::OpenTypeFile *file, |
michael@0 | 55 | const uint8_t *data, size_t length); |
michael@0 | 56 | |
michael@0 | 57 | // Parser for 'Contextual' subtable shared by GSUB/GPOS tables. |
michael@0 | 58 | bool ParseContextSubtable(const ots::OpenTypeFile *file, |
michael@0 | 59 | const uint8_t *data, const size_t length, |
michael@0 | 60 | const uint16_t num_glyphs, |
michael@0 | 61 | const uint16_t num_lookups); |
michael@0 | 62 | |
michael@0 | 63 | // Parser for 'Chaining Contextual' subtable shared by GSUB/GPOS tables. |
michael@0 | 64 | bool ParseChainingContextSubtable(const ots::OpenTypeFile *file, |
michael@0 | 65 | const uint8_t *data, const size_t length, |
michael@0 | 66 | const uint16_t num_glyphs, |
michael@0 | 67 | const uint16_t num_lookups); |
michael@0 | 68 | |
michael@0 | 69 | bool ParseExtensionSubtable(const OpenTypeFile *file, |
michael@0 | 70 | const uint8_t *data, const size_t length, |
michael@0 | 71 | const LookupSubtableParser* parser); |
michael@0 | 72 | |
michael@0 | 73 | } // namespace ots |
michael@0 | 74 | |
michael@0 | 75 | #endif // OTS_LAYOUT_H_ |
michael@0 | 76 |