Line data Source code
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_BITMAP_INDEX_SUBTABLE_FORMAT5_H_
18 : #define SFNTLY_CPP_SRC_SFNTLY_TABLE_BITMAP_INDEX_SUBTABLE_FORMAT5_H_
19 :
20 : #include "sfntly/table/bitmap/big_glyph_metrics.h"
21 : #include "sfntly/table/bitmap/index_sub_table.h"
22 :
23 : namespace sfntly {
24 :
25 : class IndexSubTableFormat5 : public IndexSubTable,
26 : public RefCounted<IndexSubTableFormat5> {
27 : public:
28 : class Builder : public IndexSubTable::Builder,
29 : public RefCounted<Builder> {
30 : public:
31 : class BitmapGlyphInfoIterator
32 : : public RefIterator<BitmapGlyphInfo, Builder, IndexSubTable::Builder> {
33 : public:
34 : explicit BitmapGlyphInfoIterator(Builder* container);
35 0 : virtual ~BitmapGlyphInfoIterator() {}
36 :
37 : virtual bool HasNext();
38 : CALLER_ATTACH virtual BitmapGlyphInfo* Next();
39 :
40 : private:
41 : int32_t offset_index_;
42 : };
43 : virtual ~Builder();
44 : virtual int32_t NumGlyphs();
45 : virtual int32_t GlyphLength(int32_t glyph_id);
46 : virtual int32_t GlyphStartOffset(int32_t glyph_id);
47 : CALLER_ATTACH virtual BitmapGlyphInfoIterator* GetIterator();
48 :
49 : virtual CALLER_ATTACH FontDataTable* SubBuildTable(ReadableFontData* data);
50 : virtual void SubDataSet();
51 : virtual int32_t SubDataSizeToSerialize();
52 : virtual bool SubReadyToSerialize();
53 : virtual int32_t SubSerialize(WritableFontData* new_data);
54 :
55 : int32_t ImageSize();
56 : void SetImageSize(int32_t image_size);
57 : BigGlyphMetrics::Builder* BigMetrics();
58 : IntegerList* GlyphArray();
59 : void SetGlyphArray(const IntegerList& v);
60 :
61 : static CALLER_ATTACH Builder* CreateBuilder();
62 : static CALLER_ATTACH Builder* CreateBuilder(ReadableFontData* data,
63 : int32_t index_sub_table_offset,
64 : int32_t first_glyph_index,
65 : int32_t last_glyph_index);
66 : static CALLER_ATTACH Builder* CreateBuilder(WritableFontData* data,
67 : int32_t index_sub_table_offset,
68 : int32_t first_glyph_index,
69 : int32_t last_glyph_index);
70 : protected:
71 : void Revert();
72 :
73 : private:
74 : Builder();
75 : Builder(WritableFontData* data,
76 : int32_t first_glyph_index,
77 : int32_t last_glyph_index);
78 : Builder(ReadableFontData* data,
79 : int32_t first_glyph_index,
80 : int32_t last_glyph_index);
81 :
82 : IntegerList* GetGlyphArray();
83 : void Initialize(ReadableFontData* data);
84 :
85 : static int32_t DataLength(ReadableFontData* data,
86 : int32_t index_sub_table_offset,
87 : int32_t first_glyph_index,
88 : int32_t last_glyph_index);
89 :
90 : IntegerList glyph_array_;
91 : BigGlyphMetricsBuilderPtr metrics_;
92 : };
93 : virtual ~IndexSubTableFormat5();
94 :
95 : virtual int32_t NumGlyphs();
96 : virtual int32_t GlyphStartOffset(int32_t glyph_id);
97 : virtual int32_t GlyphLength(int32_t glyph_id);
98 :
99 : int32_t ImageSize();
100 : CALLER_ATTACH BigGlyphMetrics* BigMetrics();
101 :
102 : private:
103 : IndexSubTableFormat5(ReadableFontData* data,
104 : int32_t first_glyph_index,
105 : int32_t last_glyph_index);
106 :
107 : static int32_t NumGlyphs(ReadableFontData* dta, int32_t table_offset);
108 :
109 : int32_t image_size_;
110 :
111 : friend class Builder;
112 : };
113 : typedef Ptr<IndexSubTableFormat5> IndexSubTableFormat5Ptr;
114 : typedef Ptr<IndexSubTableFormat5::Builder> IndexSubTableFormat5BuilderPtr;
115 :
116 : } // namespace sfntly
117 :
118 : #endif // SFNTLY_CPP_SRC_SFNTLY_TABLE_BITMAP_INDEX_SUBTABLE_FORMAT5_H_
|