gfx/ots/src/layout.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/ots/src/layout.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,76 @@
     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_LAYOUT_H_
     1.9 +#define OTS_LAYOUT_H_
    1.10 +
    1.11 +#include "ots.h"
    1.12 +
    1.13 +// Utility functions for OpenType layout common table formats.
    1.14 +// http://www.microsoft.com/typography/otspec/chapter2.htm
    1.15 +
    1.16 +namespace ots {
    1.17 +
    1.18 +
    1.19 +struct LookupSubtableParser {
    1.20 +  struct TypeParser {
    1.21 +    uint16_t type;
    1.22 +    bool (*parse)(const OpenTypeFile *file, const uint8_t *data,
    1.23 +                  const size_t length);
    1.24 +  };
    1.25 +  size_t num_types;
    1.26 +  uint16_t extension_type;
    1.27 +  const TypeParser *parsers;
    1.28 +
    1.29 +  bool Parse(const OpenTypeFile *file, const uint8_t *data,
    1.30 +             const size_t length, const uint16_t lookup_type) const;
    1.31 +};
    1.32 +
    1.33 +bool ParseScriptListTable(const ots::OpenTypeFile *file,
    1.34 +                          const uint8_t *data, const size_t length,
    1.35 +                          const uint16_t num_features);
    1.36 +
    1.37 +bool ParseFeatureListTable(const ots::OpenTypeFile *file,
    1.38 +                           const uint8_t *data, const size_t length,
    1.39 +                           const uint16_t num_lookups,
    1.40 +                           uint16_t *num_features);
    1.41 +
    1.42 +bool ParseLookupListTable(OpenTypeFile *file, const uint8_t *data,
    1.43 +                          const size_t length,
    1.44 +                          const LookupSubtableParser* parser,
    1.45 +                          uint16_t* num_lookups);
    1.46 +
    1.47 +bool ParseClassDefTable(const ots::OpenTypeFile *file,
    1.48 +                        const uint8_t *data, size_t length,
    1.49 +                        const uint16_t num_glyphs,
    1.50 +                        const uint16_t num_classes);
    1.51 +
    1.52 +bool ParseCoverageTable(const ots::OpenTypeFile *file,
    1.53 +                        const uint8_t *data, size_t length,
    1.54 +                        const uint16_t num_glyphs,
    1.55 +                        const uint16_t expected_num_glyphs = 0);
    1.56 +
    1.57 +bool ParseDeviceTable(const ots::OpenTypeFile *file,
    1.58 +                      const uint8_t *data, size_t length);
    1.59 +
    1.60 +// Parser for 'Contextual' subtable shared by GSUB/GPOS tables.
    1.61 +bool ParseContextSubtable(const ots::OpenTypeFile *file,
    1.62 +                          const uint8_t *data, const size_t length,
    1.63 +                          const uint16_t num_glyphs,
    1.64 +                          const uint16_t num_lookups);
    1.65 +
    1.66 +// Parser for 'Chaining Contextual' subtable shared by GSUB/GPOS tables.
    1.67 +bool ParseChainingContextSubtable(const ots::OpenTypeFile *file,
    1.68 +                                  const uint8_t *data, const size_t length,
    1.69 +                                  const uint16_t num_glyphs,
    1.70 +                                  const uint16_t num_lookups);
    1.71 +
    1.72 +bool ParseExtensionSubtable(const OpenTypeFile *file,
    1.73 +                            const uint8_t *data, const size_t length,
    1.74 +                            const LookupSubtableParser* parser);
    1.75 +
    1.76 +}  // namespace ots
    1.77 +
    1.78 +#endif  // OTS_LAYOUT_H_
    1.79 +

mercurial