OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ | 7 #ifndef CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ |
8 #define CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ | 8 #define CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ |
9 | 9 |
| 10 #include <stdint.h> |
| 11 |
10 #include <map> | 12 #include <map> |
11 | 13 |
12 #include "common.h" | |
13 #include "core/include/fxcrt/fx_basic.h" | 14 #include "core/include/fxcrt/fx_basic.h" |
14 #include "core/include/fxge/fx_font.h" | 15 #include "core/include/fxge/fx_font.h" |
15 #include "core/include/fxge/fx_freetype.h" | 16 #include "core/include/fxge/fx_freetype.h" |
16 | 17 |
17 class CFX_GlyphMap { | 18 class CFX_GlyphMap { |
18 public: | 19 public: |
19 CFX_GlyphMap(); | 20 CFX_GlyphMap(); |
20 ~CFX_GlyphMap(); | 21 ~CFX_GlyphMap(); |
21 void SetAt(int key, int value); | 22 void SetAt(int key, int value); |
22 FX_BOOL Lookup(int key, int& value); | 23 FX_BOOL Lookup(int key, int& value); |
23 | 24 |
24 protected: | 25 protected: |
25 CFX_BinaryBuf m_Buffer; | 26 CFX_BinaryBuf m_Buffer; |
26 }; | 27 }; |
27 class CFX_CTTGSUBTable { | 28 class CFX_CTTGSUBTable { |
28 public: | 29 public: |
29 CFX_CTTGSUBTable(void) : m_bFeautureMapLoad(FALSE), loaded(false) {} | 30 CFX_CTTGSUBTable(void) : m_bFeautureMapLoad(FALSE), loaded(false) {} |
30 CFX_CTTGSUBTable(FT_Bytes gsub) : m_bFeautureMapLoad(FALSE), loaded(false) { | 31 CFX_CTTGSUBTable(FT_Bytes gsub) : m_bFeautureMapLoad(FALSE), loaded(false) { |
31 LoadGSUBTable(gsub); | 32 LoadGSUBTable(gsub); |
32 } | 33 } |
33 virtual ~CFX_CTTGSUBTable() {} | 34 virtual ~CFX_CTTGSUBTable() {} |
34 bool IsOk(void) const { return loaded; } | 35 bool IsOk(void) const { return loaded; } |
35 bool LoadGSUBTable(FT_Bytes gsub); | 36 bool LoadGSUBTable(FT_Bytes gsub); |
36 bool GetVerticalGlyph(TT_uint32_t glyphnum, TT_uint32_t* vglyphnum); | 37 bool GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum); |
37 | 38 |
38 private: | 39 private: |
39 struct tt_gsub_header { | 40 struct tt_gsub_header { |
40 TT_uint32_t Version; | 41 uint32_t Version; |
41 TT_uint16_t ScriptList; | 42 uint16_t ScriptList; |
42 TT_uint16_t FeatureList; | 43 uint16_t FeatureList; |
43 TT_uint16_t LookupList; | 44 uint16_t LookupList; |
44 }; | 45 }; |
45 struct TLangSys { | 46 struct TLangSys { |
46 TT_uint16_t LookupOrder; | 47 uint16_t LookupOrder; |
47 TT_uint16_t ReqFeatureIndex; | 48 uint16_t ReqFeatureIndex; |
48 TT_uint16_t FeatureCount; | 49 uint16_t FeatureCount; |
49 TT_uint16_t* FeatureIndex; | 50 uint16_t* FeatureIndex; |
50 TLangSys() | 51 TLangSys() |
51 : LookupOrder(0), | 52 : LookupOrder(0), |
52 ReqFeatureIndex(0), | 53 ReqFeatureIndex(0), |
53 FeatureCount(0), | 54 FeatureCount(0), |
54 FeatureIndex(NULL) {} | 55 FeatureIndex(NULL) {} |
55 ~TLangSys() { delete[] FeatureIndex; } | 56 ~TLangSys() { delete[] FeatureIndex; } |
56 | 57 |
57 private: | 58 private: |
58 TLangSys(const TLangSys&); | 59 TLangSys(const TLangSys&); |
59 TLangSys& operator=(const TLangSys&); | 60 TLangSys& operator=(const TLangSys&); |
60 }; | 61 }; |
61 struct TLangSysRecord { | 62 struct TLangSysRecord { |
62 TT_uint32_t LangSysTag; | 63 uint32_t LangSysTag; |
63 struct TLangSys LangSys; | 64 struct TLangSys LangSys; |
64 TLangSysRecord() : LangSysTag(0) {} | 65 TLangSysRecord() : LangSysTag(0) {} |
65 | 66 |
66 private: | 67 private: |
67 TLangSysRecord(const TLangSysRecord&); | 68 TLangSysRecord(const TLangSysRecord&); |
68 TLangSysRecord& operator=(const TLangSysRecord&); | 69 TLangSysRecord& operator=(const TLangSysRecord&); |
69 }; | 70 }; |
70 struct TScript { | 71 struct TScript { |
71 TT_uint16_t DefaultLangSys; | 72 uint16_t DefaultLangSys; |
72 TT_uint16_t LangSysCount; | 73 uint16_t LangSysCount; |
73 struct TLangSysRecord* LangSysRecord; | 74 struct TLangSysRecord* LangSysRecord; |
74 TScript() : DefaultLangSys(0), LangSysCount(0), LangSysRecord(NULL) {} | 75 TScript() : DefaultLangSys(0), LangSysCount(0), LangSysRecord(NULL) {} |
75 ~TScript() { delete[] LangSysRecord; } | 76 ~TScript() { delete[] LangSysRecord; } |
76 | 77 |
77 private: | 78 private: |
78 TScript(const TScript&); | 79 TScript(const TScript&); |
79 TScript& operator=(const TScript&); | 80 TScript& operator=(const TScript&); |
80 }; | 81 }; |
81 struct TScriptRecord { | 82 struct TScriptRecord { |
82 TT_uint32_t ScriptTag; | 83 uint32_t ScriptTag; |
83 struct TScript Script; | 84 struct TScript Script; |
84 TScriptRecord() : ScriptTag(0) {} | 85 TScriptRecord() : ScriptTag(0) {} |
85 | 86 |
86 private: | 87 private: |
87 TScriptRecord(const TScriptRecord&); | 88 TScriptRecord(const TScriptRecord&); |
88 TScriptRecord& operator=(const TScriptRecord&); | 89 TScriptRecord& operator=(const TScriptRecord&); |
89 }; | 90 }; |
90 struct TScriptList { | 91 struct TScriptList { |
91 TT_uint16_t ScriptCount; | 92 uint16_t ScriptCount; |
92 struct TScriptRecord* ScriptRecord; | 93 struct TScriptRecord* ScriptRecord; |
93 TScriptList() : ScriptCount(0), ScriptRecord(NULL) {} | 94 TScriptList() : ScriptCount(0), ScriptRecord(NULL) {} |
94 ~TScriptList() { delete[] ScriptRecord; } | 95 ~TScriptList() { delete[] ScriptRecord; } |
95 | 96 |
96 private: | 97 private: |
97 TScriptList(const TScriptList&); | 98 TScriptList(const TScriptList&); |
98 TScriptList& operator=(const TScriptList&); | 99 TScriptList& operator=(const TScriptList&); |
99 }; | 100 }; |
100 struct TFeature { | 101 struct TFeature { |
101 TT_uint16_t FeatureParams; | 102 uint16_t FeatureParams; |
102 int LookupCount; | 103 int LookupCount; |
103 TT_uint16_t* LookupListIndex; | 104 uint16_t* LookupListIndex; |
104 TFeature() : FeatureParams(0), LookupCount(0), LookupListIndex(NULL) {} | 105 TFeature() : FeatureParams(0), LookupCount(0), LookupListIndex(NULL) {} |
105 ~TFeature() { delete[] LookupListIndex; } | 106 ~TFeature() { delete[] LookupListIndex; } |
106 | 107 |
107 private: | 108 private: |
108 TFeature(const TFeature&); | 109 TFeature(const TFeature&); |
109 TFeature& operator=(const TFeature&); | 110 TFeature& operator=(const TFeature&); |
110 }; | 111 }; |
111 struct TFeatureRecord { | 112 struct TFeatureRecord { |
112 TT_uint32_t FeatureTag; | 113 uint32_t FeatureTag; |
113 struct TFeature Feature; | 114 struct TFeature Feature; |
114 TFeatureRecord() : FeatureTag(0) {} | 115 TFeatureRecord() : FeatureTag(0) {} |
115 | 116 |
116 private: | 117 private: |
117 TFeatureRecord(const TFeatureRecord&); | 118 TFeatureRecord(const TFeatureRecord&); |
118 TFeatureRecord& operator=(const TFeatureRecord&); | 119 TFeatureRecord& operator=(const TFeatureRecord&); |
119 }; | 120 }; |
120 struct TFeatureList { | 121 struct TFeatureList { |
121 int FeatureCount; | 122 int FeatureCount; |
122 struct TFeatureRecord* FeatureRecord; | 123 struct TFeatureRecord* FeatureRecord; |
123 TFeatureList() : FeatureCount(0), FeatureRecord(NULL) {} | 124 TFeatureList() : FeatureCount(0), FeatureRecord(NULL) {} |
124 ~TFeatureList() { delete[] FeatureRecord; } | 125 ~TFeatureList() { delete[] FeatureRecord; } |
125 | 126 |
126 private: | 127 private: |
127 TFeatureList(const TFeatureList&); | 128 TFeatureList(const TFeatureList&); |
128 TFeatureList& operator=(const TFeatureList&); | 129 TFeatureList& operator=(const TFeatureList&); |
129 }; | 130 }; |
130 enum TLookupFlag { | 131 enum TLookupFlag { |
131 LOOKUPFLAG_RightToLeft = 0x0001, | 132 LOOKUPFLAG_RightToLeft = 0x0001, |
132 LOOKUPFLAG_IgnoreBaseGlyphs = 0x0002, | 133 LOOKUPFLAG_IgnoreBaseGlyphs = 0x0002, |
133 LOOKUPFLAG_IgnoreLigatures = 0x0004, | 134 LOOKUPFLAG_IgnoreLigatures = 0x0004, |
134 LOOKUPFLAG_IgnoreMarks = 0x0008, | 135 LOOKUPFLAG_IgnoreMarks = 0x0008, |
135 LOOKUPFLAG_Reserved = 0x00F0, | 136 LOOKUPFLAG_Reserved = 0x00F0, |
136 LOOKUPFLAG_MarkAttachmentType = 0xFF00, | 137 LOOKUPFLAG_MarkAttachmentType = 0xFF00, |
137 }; | 138 }; |
138 struct TCoverageFormatBase { | 139 struct TCoverageFormatBase { |
139 TT_uint16_t CoverageFormat; | 140 uint16_t CoverageFormat; |
140 CFX_GlyphMap m_glyphMap; | 141 CFX_GlyphMap m_glyphMap; |
141 TCoverageFormatBase() : CoverageFormat(0) {} | 142 TCoverageFormatBase() : CoverageFormat(0) {} |
142 virtual ~TCoverageFormatBase() {} | 143 virtual ~TCoverageFormatBase() {} |
143 | 144 |
144 private: | 145 private: |
145 TCoverageFormatBase(const TCoverageFormatBase&); | 146 TCoverageFormatBase(const TCoverageFormatBase&); |
146 TCoverageFormatBase& operator=(const TCoverageFormatBase&); | 147 TCoverageFormatBase& operator=(const TCoverageFormatBase&); |
147 }; | 148 }; |
148 struct TCoverageFormat1 : public TCoverageFormatBase { | 149 struct TCoverageFormat1 : public TCoverageFormatBase { |
149 TT_uint16_t GlyphCount; | 150 uint16_t GlyphCount; |
150 TT_uint16_t* GlyphArray; | 151 uint16_t* GlyphArray; |
151 TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; } | 152 TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; } |
152 ~TCoverageFormat1() override { delete[] GlyphArray; } | 153 ~TCoverageFormat1() override { delete[] GlyphArray; } |
153 | 154 |
154 private: | 155 private: |
155 TCoverageFormat1(const TCoverageFormat1&); | 156 TCoverageFormat1(const TCoverageFormat1&); |
156 TCoverageFormat1& operator=(const TCoverageFormat1&); | 157 TCoverageFormat1& operator=(const TCoverageFormat1&); |
157 }; | 158 }; |
158 struct TRangeRecord { | 159 struct TRangeRecord { |
159 TT_uint16_t Start; | 160 uint16_t Start; |
160 TT_uint16_t End; | 161 uint16_t End; |
161 TT_uint16_t StartCoverageIndex; | 162 uint16_t StartCoverageIndex; |
162 TRangeRecord() : Start(0), End(0), StartCoverageIndex(0) {} | 163 TRangeRecord() : Start(0), End(0), StartCoverageIndex(0) {} |
163 friend bool operator>(const TRangeRecord& r1, const TRangeRecord& r2) { | 164 friend bool operator>(const TRangeRecord& r1, const TRangeRecord& r2) { |
164 return r1.Start > r2.Start; | 165 return r1.Start > r2.Start; |
165 } | 166 } |
166 | 167 |
167 private: | 168 private: |
168 TRangeRecord(const TRangeRecord&); | 169 TRangeRecord(const TRangeRecord&); |
169 }; | 170 }; |
170 struct TCoverageFormat2 : public TCoverageFormatBase { | 171 struct TCoverageFormat2 : public TCoverageFormatBase { |
171 TT_uint16_t RangeCount; | 172 uint16_t RangeCount; |
172 struct TRangeRecord* RangeRecord; | 173 struct TRangeRecord* RangeRecord; |
173 TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) { | 174 TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) { |
174 CoverageFormat = 2; | 175 CoverageFormat = 2; |
175 } | 176 } |
176 ~TCoverageFormat2() override { delete[] RangeRecord; } | 177 ~TCoverageFormat2() override { delete[] RangeRecord; } |
177 | 178 |
178 private: | 179 private: |
179 TCoverageFormat2(const TCoverageFormat2&); | 180 TCoverageFormat2(const TCoverageFormat2&); |
180 TCoverageFormat2& operator=(const TCoverageFormat2&); | 181 TCoverageFormat2& operator=(const TCoverageFormat2&); |
181 }; | 182 }; |
182 struct TClassDefFormatBase { | 183 struct TClassDefFormatBase { |
183 TT_uint16_t ClassFormat; | 184 uint16_t ClassFormat; |
184 TClassDefFormatBase() : ClassFormat(0) {} | 185 TClassDefFormatBase() : ClassFormat(0) {} |
185 virtual ~TClassDefFormatBase() {} | 186 virtual ~TClassDefFormatBase() {} |
186 | 187 |
187 private: | 188 private: |
188 TClassDefFormatBase(const TClassDefFormatBase&); | 189 TClassDefFormatBase(const TClassDefFormatBase&); |
189 TClassDefFormatBase& operator=(const TClassDefFormatBase&); | 190 TClassDefFormatBase& operator=(const TClassDefFormatBase&); |
190 }; | 191 }; |
191 struct TClassDefFormat1 : public TClassDefFormatBase { | 192 struct TClassDefFormat1 : public TClassDefFormatBase { |
192 TT_uint16_t StartGlyph; | 193 uint16_t StartGlyph; |
193 TT_uint16_t GlyphCount; | 194 uint16_t GlyphCount; |
194 TT_uint16_t* ClassValueArray; | 195 uint16_t* ClassValueArray; |
195 TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) { | 196 TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) { |
196 ClassFormat = 1; | 197 ClassFormat = 1; |
197 } | 198 } |
198 ~TClassDefFormat1() override { delete[] ClassValueArray; } | 199 ~TClassDefFormat1() override { delete[] ClassValueArray; } |
199 | 200 |
200 private: | 201 private: |
201 TClassDefFormat1(const TClassDefFormat1&); | 202 TClassDefFormat1(const TClassDefFormat1&); |
202 TClassDefFormat1& operator=(const TClassDefFormat1&); | 203 TClassDefFormat1& operator=(const TClassDefFormat1&); |
203 }; | 204 }; |
204 struct TClassRangeRecord { | 205 struct TClassRangeRecord { |
205 TT_uint16_t Start; | 206 uint16_t Start; |
206 TT_uint16_t End; | 207 uint16_t End; |
207 TT_uint16_t Class; | 208 uint16_t Class; |
208 TClassRangeRecord() : Start(0), End(0), Class(0) {} | 209 TClassRangeRecord() : Start(0), End(0), Class(0) {} |
209 | 210 |
210 private: | 211 private: |
211 TClassRangeRecord(const TClassRangeRecord&); | 212 TClassRangeRecord(const TClassRangeRecord&); |
212 TClassRangeRecord& operator=(const TClassRangeRecord&); | 213 TClassRangeRecord& operator=(const TClassRangeRecord&); |
213 }; | 214 }; |
214 struct TClassDefFormat2 : public TClassDefFormatBase { | 215 struct TClassDefFormat2 : public TClassDefFormatBase { |
215 TT_uint16_t ClassRangeCount; | 216 uint16_t ClassRangeCount; |
216 struct TClassRangeRecord* ClassRangeRecord; | 217 struct TClassRangeRecord* ClassRangeRecord; |
217 TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) { | 218 TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) { |
218 ClassFormat = 2; | 219 ClassFormat = 2; |
219 } | 220 } |
220 ~TClassDefFormat2() override { delete[] ClassRangeRecord; } | 221 ~TClassDefFormat2() override { delete[] ClassRangeRecord; } |
221 | 222 |
222 private: | 223 private: |
223 TClassDefFormat2(const TClassDefFormat2&); | 224 TClassDefFormat2(const TClassDefFormat2&); |
224 TClassDefFormat2& operator=(const TClassDefFormat2&); | 225 TClassDefFormat2& operator=(const TClassDefFormat2&); |
225 }; | 226 }; |
226 struct TDevice { | 227 struct TDevice { |
227 TT_uint16_t StartSize; | 228 uint16_t StartSize; |
228 TT_uint16_t EndSize; | 229 uint16_t EndSize; |
229 TT_uint16_t DeltaFormat; | 230 uint16_t DeltaFormat; |
230 TDevice() : StartSize(0), EndSize(0), DeltaFormat(0) {} | 231 TDevice() : StartSize(0), EndSize(0), DeltaFormat(0) {} |
231 | 232 |
232 private: | 233 private: |
233 TDevice(const TDevice&); | 234 TDevice(const TDevice&); |
234 TDevice& operator=(const TDevice&); | 235 TDevice& operator=(const TDevice&); |
235 }; | 236 }; |
236 struct TSubTableBase { | 237 struct TSubTableBase { |
237 TT_uint16_t SubstFormat; | 238 uint16_t SubstFormat; |
238 TSubTableBase() : SubstFormat(0) {} | 239 TSubTableBase() : SubstFormat(0) {} |
239 virtual ~TSubTableBase() {} | 240 virtual ~TSubTableBase() {} |
240 | 241 |
241 private: | 242 private: |
242 TSubTableBase(const TSubTableBase&); | 243 TSubTableBase(const TSubTableBase&); |
243 TSubTableBase& operator=(const TSubTableBase&); | 244 TSubTableBase& operator=(const TSubTableBase&); |
244 }; | 245 }; |
245 struct TSingleSubstFormat1 : public TSubTableBase { | 246 struct TSingleSubstFormat1 : public TSubTableBase { |
246 TCoverageFormatBase* Coverage; | 247 TCoverageFormatBase* Coverage; |
247 TT_int16_t DeltaGlyphID; | 248 int16_t DeltaGlyphID; |
248 TSingleSubstFormat1() : Coverage(NULL), DeltaGlyphID(0) { SubstFormat = 1; } | 249 TSingleSubstFormat1() : Coverage(NULL), DeltaGlyphID(0) { SubstFormat = 1; } |
249 ~TSingleSubstFormat1() override { delete Coverage; } | 250 ~TSingleSubstFormat1() override { delete Coverage; } |
250 | 251 |
251 private: | 252 private: |
252 TSingleSubstFormat1(const TSingleSubstFormat1&); | 253 TSingleSubstFormat1(const TSingleSubstFormat1&); |
253 TSingleSubstFormat1& operator=(const TSingleSubstFormat1&); | 254 TSingleSubstFormat1& operator=(const TSingleSubstFormat1&); |
254 }; | 255 }; |
255 struct TSingleSubstFormat2 : public TSubTableBase { | 256 struct TSingleSubstFormat2 : public TSubTableBase { |
256 TCoverageFormatBase* Coverage; | 257 TCoverageFormatBase* Coverage; |
257 TT_uint16_t GlyphCount; | 258 uint16_t GlyphCount; |
258 TT_uint16_t* Substitute; | 259 uint16_t* Substitute; |
259 TSingleSubstFormat2() : Coverage(NULL), GlyphCount(0), Substitute(NULL) { | 260 TSingleSubstFormat2() : Coverage(NULL), GlyphCount(0), Substitute(NULL) { |
260 SubstFormat = 2; | 261 SubstFormat = 2; |
261 } | 262 } |
262 ~TSingleSubstFormat2() { | 263 ~TSingleSubstFormat2() { |
263 delete Coverage; | 264 delete Coverage; |
264 delete[] Substitute; | 265 delete[] Substitute; |
265 } | 266 } |
266 | 267 |
267 private: | 268 private: |
268 TSingleSubstFormat2(const TSingleSubstFormat2&); | 269 TSingleSubstFormat2(const TSingleSubstFormat2&); |
269 TSingleSubstFormat2& operator=(const TSingleSubstFormat2&); | 270 TSingleSubstFormat2& operator=(const TSingleSubstFormat2&); |
270 }; | 271 }; |
271 struct TLookup { | 272 struct TLookup { |
272 TT_uint16_t LookupType; | 273 uint16_t LookupType; |
273 TT_uint16_t LookupFlag; | 274 uint16_t LookupFlag; |
274 TT_uint16_t SubTableCount; | 275 uint16_t SubTableCount; |
275 struct TSubTableBase** SubTable; | 276 struct TSubTableBase** SubTable; |
276 TLookup() | 277 TLookup() |
277 : LookupType(0), LookupFlag(0), SubTableCount(0), SubTable(NULL) {} | 278 : LookupType(0), LookupFlag(0), SubTableCount(0), SubTable(NULL) {} |
278 ~TLookup() { | 279 ~TLookup() { |
279 if (SubTableCount > 0 && SubTable != NULL) { | 280 if (SubTableCount > 0 && SubTable != NULL) { |
280 for (int i = 0; i < SubTableCount; i++) { | 281 for (int i = 0; i < SubTableCount; i++) { |
281 delete SubTable[i]; | 282 delete SubTable[i]; |
282 } | 283 } |
283 delete[] SubTable; | 284 delete[] SubTable; |
284 } | 285 } |
(...skipping 20 matching lines...) Expand all Loading... |
305 void ParseFeatureList(FT_Bytes raw, TFeatureList* rec); | 306 void ParseFeatureList(FT_Bytes raw, TFeatureList* rec); |
306 void ParseFeature(FT_Bytes raw, TFeature* rec); | 307 void ParseFeature(FT_Bytes raw, TFeature* rec); |
307 void ParseLookupList(FT_Bytes raw, TLookupList* rec); | 308 void ParseLookupList(FT_Bytes raw, TLookupList* rec); |
308 void ParseLookup(FT_Bytes raw, TLookup* rec); | 309 void ParseLookup(FT_Bytes raw, TLookup* rec); |
309 void ParseCoverage(FT_Bytes raw, TCoverageFormatBase** rec); | 310 void ParseCoverage(FT_Bytes raw, TCoverageFormatBase** rec); |
310 void ParseCoverageFormat1(FT_Bytes raw, TCoverageFormat1* rec); | 311 void ParseCoverageFormat1(FT_Bytes raw, TCoverageFormat1* rec); |
311 void ParseCoverageFormat2(FT_Bytes raw, TCoverageFormat2* rec); | 312 void ParseCoverageFormat2(FT_Bytes raw, TCoverageFormat2* rec); |
312 void ParseSingleSubst(FT_Bytes raw, TSubTableBase** rec); | 313 void ParseSingleSubst(FT_Bytes raw, TSubTableBase** rec); |
313 void ParseSingleSubstFormat1(FT_Bytes raw, TSingleSubstFormat1* rec); | 314 void ParseSingleSubstFormat1(FT_Bytes raw, TSingleSubstFormat1* rec); |
314 void ParseSingleSubstFormat2(FT_Bytes raw, TSingleSubstFormat2* rec); | 315 void ParseSingleSubstFormat2(FT_Bytes raw, TSingleSubstFormat2* rec); |
315 bool GetVerticalGlyphSub(TT_uint32_t glyphnum, | 316 bool GetVerticalGlyphSub(uint32_t glyphnum, |
316 TT_uint32_t* vglyphnum, | 317 uint32_t* vglyphnum, |
317 struct TFeature* Feature); | 318 struct TFeature* Feature); |
318 bool GetVerticalGlyphSub2(TT_uint32_t glyphnum, | 319 bool GetVerticalGlyphSub2(uint32_t glyphnum, |
319 TT_uint32_t* vglyphnum, | 320 uint32_t* vglyphnum, |
320 struct TLookup* Lookup); | 321 struct TLookup* Lookup); |
321 int GetCoverageIndex(struct TCoverageFormatBase* Coverage, TT_uint32_t g); | 322 int GetCoverageIndex(struct TCoverageFormatBase* Coverage, uint32_t g); |
322 TT_uint8_t GetUInt8(FT_Bytes& p) const { | 323 uint8_t GetUInt8(FT_Bytes& p) const { |
323 TT_uint8_t ret = p[0]; | 324 uint8_t ret = p[0]; |
324 p += 1; | 325 p += 1; |
325 return ret; | 326 return ret; |
326 } | 327 } |
327 TT_int16_t GetInt16(FT_Bytes& p) const { | 328 int16_t GetInt16(FT_Bytes& p) const { |
328 TT_uint16_t ret = p[0] << 8 | p[1]; | 329 uint16_t ret = p[0] << 8 | p[1]; |
329 p += 2; | 330 p += 2; |
330 return *(TT_int16_t*)&ret; | 331 return *(int16_t*)&ret; |
331 } | 332 } |
332 TT_uint16_t GetUInt16(FT_Bytes& p) const { | 333 uint16_t GetUInt16(FT_Bytes& p) const { |
333 TT_uint16_t ret = p[0] << 8 | p[1]; | 334 uint16_t ret = p[0] << 8 | p[1]; |
334 p += 2; | 335 p += 2; |
335 return ret; | 336 return ret; |
336 } | 337 } |
337 TT_int32_t GetInt32(FT_Bytes& p) const { | 338 int32_t GetInt32(FT_Bytes& p) const { |
338 TT_uint32_t ret = p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; | 339 uint32_t ret = p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; |
339 p += 4; | 340 p += 4; |
340 return *(TT_int32_t*)&ret; | 341 return *(int32_t*)&ret; |
341 } | 342 } |
342 TT_uint32_t GetUInt32(FT_Bytes& p) const { | 343 uint32_t GetUInt32(FT_Bytes& p) const { |
343 TT_uint32_t ret = p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; | 344 uint32_t ret = p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; |
344 p += 4; | 345 p += 4; |
345 return ret; | 346 return ret; |
346 } | 347 } |
347 std::map<FX_DWORD, FX_DWORD> m_featureMap; | 348 std::map<FX_DWORD, FX_DWORD> m_featureMap; |
348 FX_BOOL m_bFeautureMapLoad; | 349 FX_BOOL m_bFeautureMapLoad; |
349 bool loaded; | 350 bool loaded; |
350 struct tt_gsub_header header; | 351 struct tt_gsub_header header; |
351 struct TScriptList ScriptList; | 352 struct TScriptList ScriptList; |
352 struct TFeatureList FeatureList; | 353 struct TFeatureList FeatureList; |
353 struct TLookupList LookupList; | 354 struct TLookupList LookupList; |
354 }; | 355 }; |
355 class CFX_GSUBTable final : public IFX_GSUBTable { | 356 class CFX_GSUBTable final : public IFX_GSUBTable { |
356 public: | 357 public: |
357 ~CFX_GSUBTable() override {} | 358 ~CFX_GSUBTable() override {} |
358 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, | 359 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, |
359 FX_DWORD* vglyphnum) override; | 360 FX_DWORD* vglyphnum) override; |
360 | 361 |
361 CFX_CTTGSUBTable m_GsubImp; | 362 CFX_CTTGSUBTable m_GsubImp; |
362 }; | 363 }; |
363 | 364 |
364 #endif // CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ | 365 #endif // CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ |
OLD | NEW |