1// Copyright (c) 2009 The Chromium 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_CFF_H_
6#define OTS_CFF_H_
7
8#include "ots.h"
9
10#include <map>
11#include <string>
12#include <vector>
13
14namespace ots {
15
16struct CFFIndex {
17  CFFIndex()
18      : count(0), off_size(0), offset_to_next(0) {}
19  uint16_t count;
20  uint8_t off_size;
21  std::vector<uint32_t> offsets;
22  uint32_t offset_to_next;
23};
24
25struct OpenTypeCFF {
26  const uint8_t *data;
27  size_t length;
28  // Name INDEX. This name is used in name.cc as a postscript font name.
29  std::string name;
30
31  // The number of fonts the file has.
32  size_t font_dict_length;
33  // A map from glyph # to font #.
34  std::map<uint16_t, uint8_t> fd_select;
35
36  // A list of char strings.
37  std::vector<CFFIndex *> char_strings_array;
38  // A list of Local Subrs associated with FDArrays. Can be empty.
39  std::vector<CFFIndex *> local_subrs_per_font;
40  // A Local Subrs associated with Top DICT. Can be NULL.
41  CFFIndex *local_subrs;
42};
43
44}  // namespace ots
45
46#endif  // OTS_CFF_H_
47