michael@0: // Copyright (c) 2011 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #ifndef OTS_LAYOUT_H_ michael@0: #define OTS_LAYOUT_H_ michael@0: michael@0: #include "ots.h" michael@0: michael@0: // Utility functions for OpenType layout common table formats. michael@0: // http://www.microsoft.com/typography/otspec/chapter2.htm michael@0: michael@0: namespace ots { michael@0: michael@0: michael@0: struct LookupSubtableParser { michael@0: struct TypeParser { michael@0: uint16_t type; michael@0: bool (*parse)(const OpenTypeFile *file, const uint8_t *data, michael@0: const size_t length); michael@0: }; michael@0: size_t num_types; michael@0: uint16_t extension_type; michael@0: const TypeParser *parsers; michael@0: michael@0: bool Parse(const OpenTypeFile *file, const uint8_t *data, michael@0: const size_t length, const uint16_t lookup_type) const; michael@0: }; michael@0: michael@0: bool ParseScriptListTable(const ots::OpenTypeFile *file, michael@0: const uint8_t *data, const size_t length, michael@0: const uint16_t num_features); michael@0: michael@0: bool ParseFeatureListTable(const ots::OpenTypeFile *file, michael@0: const uint8_t *data, const size_t length, michael@0: const uint16_t num_lookups, michael@0: uint16_t *num_features); michael@0: michael@0: bool ParseLookupListTable(OpenTypeFile *file, const uint8_t *data, michael@0: const size_t length, michael@0: const LookupSubtableParser* parser, michael@0: uint16_t* num_lookups); michael@0: michael@0: bool ParseClassDefTable(const ots::OpenTypeFile *file, michael@0: const uint8_t *data, size_t length, michael@0: const uint16_t num_glyphs, michael@0: const uint16_t num_classes); michael@0: michael@0: bool ParseCoverageTable(const ots::OpenTypeFile *file, michael@0: const uint8_t *data, size_t length, michael@0: const uint16_t num_glyphs, michael@0: const uint16_t expected_num_glyphs = 0); michael@0: michael@0: bool ParseDeviceTable(const ots::OpenTypeFile *file, michael@0: const uint8_t *data, size_t length); michael@0: michael@0: // Parser for 'Contextual' subtable shared by GSUB/GPOS tables. michael@0: bool ParseContextSubtable(const ots::OpenTypeFile *file, michael@0: const uint8_t *data, const size_t length, michael@0: const uint16_t num_glyphs, michael@0: const uint16_t num_lookups); michael@0: michael@0: // Parser for 'Chaining Contextual' subtable shared by GSUB/GPOS tables. michael@0: bool ParseChainingContextSubtable(const ots::OpenTypeFile *file, michael@0: const uint8_t *data, const size_t length, michael@0: const uint16_t num_glyphs, michael@0: const uint16_t num_lookups); michael@0: michael@0: bool ParseExtensionSubtable(const OpenTypeFile *file, michael@0: const uint8_t *data, const size_t length, michael@0: const LookupSubtableParser* parser); michael@0: michael@0: } // namespace ots michael@0: michael@0: #endif // OTS_LAYOUT_H_ michael@0: