subtable.h revision 584bf6606b53bda8bf0810e7c0ad57e24cacb4f1
1/*
2 * Copyright 2011 Google Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef SFNTLY_CPP_SRC_SFNTLY_TABLE_SUBTABLE_H_
18#define SFNTLY_CPP_SRC_SFNTLY_TABLE_SUBTABLE_H_
19
20#include "sfntly/table/font_data_table.h"
21
22namespace sfntly {
23
24// An abstract base class for subtables. Subtables are smaller tables nested
25// within other tables and don't have an entry in the main font index. Examples
26// of these are the CMap subtables within CMap table (cmap) or a glyph within
27// the glyph table (glyf).
28class SubTable : public FontDataTable {
29 public:
30  class Builder : public FontDataTable::Builder {
31   public:
32    virtual ~Builder();
33
34   protected:
35    Builder(FontDataTableBuilderContainer* container, WritableFontData* data);
36    Builder(FontDataTableBuilderContainer* container, ReadableFontData* data);
37  };
38
39  virtual ~SubTable();
40
41 protected:
42  // Note: constructor refactored in C++ to avoid heavy lifting.
43  //       caller need to do data->Slice(offset, length) beforehand.
44  explicit SubTable(ReadableFontData* data);
45};
46
47}  // namespace sfntly
48
49#endif  // SFNTLY_CPP_SRC_SFNTLY_TABLE_SUBTABLE_H_
50