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 "../../../include/fxge/fx_freetype.h" | 10 #include "../../../include/fxge/fx_freetype.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 struct TLangSys { | 42 struct TLangSys { |
43 TT_uint16_t LookupOrder; | 43 TT_uint16_t LookupOrder; |
44 TT_uint16_t ReqFeatureIndex; | 44 TT_uint16_t ReqFeatureIndex; |
45 TT_uint16_t FeatureCount; | 45 TT_uint16_t FeatureCount; |
46 TT_uint16_t* FeatureIndex; | 46 TT_uint16_t* FeatureIndex; |
47 TLangSys() | 47 TLangSys() |
48 : LookupOrder(0), | 48 : LookupOrder(0), |
49 ReqFeatureIndex(0), | 49 ReqFeatureIndex(0), |
50 FeatureCount(0), | 50 FeatureCount(0), |
51 FeatureIndex(NULL) {} | 51 FeatureIndex(NULL) {} |
52 ~TLangSys() { | 52 ~TLangSys() { delete[] FeatureIndex; } |
53 if (FeatureIndex) { | |
54 delete[] FeatureIndex; | |
55 } | |
56 } | |
57 | 53 |
58 private: | 54 private: |
59 TLangSys(const TLangSys&); | 55 TLangSys(const TLangSys&); |
60 TLangSys& operator=(const TLangSys&); | 56 TLangSys& operator=(const TLangSys&); |
61 }; | 57 }; |
62 struct TLangSysRecord { | 58 struct TLangSysRecord { |
63 TT_uint32_t LangSysTag; | 59 TT_uint32_t LangSysTag; |
64 struct TLangSys LangSys; | 60 struct TLangSys LangSys; |
65 TLangSysRecord() : LangSysTag(0) {} | 61 TLangSysRecord() : LangSysTag(0) {} |
66 | 62 |
67 private: | 63 private: |
68 TLangSysRecord(const TLangSysRecord&); | 64 TLangSysRecord(const TLangSysRecord&); |
69 TLangSysRecord& operator=(const TLangSysRecord&); | 65 TLangSysRecord& operator=(const TLangSysRecord&); |
70 }; | 66 }; |
71 struct TScript { | 67 struct TScript { |
72 TT_uint16_t DefaultLangSys; | 68 TT_uint16_t DefaultLangSys; |
73 TT_uint16_t LangSysCount; | 69 TT_uint16_t LangSysCount; |
74 struct TLangSysRecord* LangSysRecord; | 70 struct TLangSysRecord* LangSysRecord; |
75 TScript() : DefaultLangSys(0), LangSysCount(0), LangSysRecord(NULL) {} | 71 TScript() : DefaultLangSys(0), LangSysCount(0), LangSysRecord(NULL) {} |
76 ~TScript() { | 72 ~TScript() { delete[] LangSysRecord; } |
77 if (LangSysRecord) { | |
78 delete[] LangSysRecord; | |
79 } | |
80 } | |
81 | 73 |
82 private: | 74 private: |
83 TScript(const TScript&); | 75 TScript(const TScript&); |
84 TScript& operator=(const TScript&); | 76 TScript& operator=(const TScript&); |
85 }; | 77 }; |
86 struct TScriptRecord { | 78 struct TScriptRecord { |
87 TT_uint32_t ScriptTag; | 79 TT_uint32_t ScriptTag; |
88 struct TScript Script; | 80 struct TScript Script; |
89 TScriptRecord() : ScriptTag(0) {} | 81 TScriptRecord() : ScriptTag(0) {} |
90 | 82 |
91 private: | 83 private: |
92 TScriptRecord(const TScriptRecord&); | 84 TScriptRecord(const TScriptRecord&); |
93 TScriptRecord& operator=(const TScriptRecord&); | 85 TScriptRecord& operator=(const TScriptRecord&); |
94 }; | 86 }; |
95 struct TScriptList { | 87 struct TScriptList { |
96 TT_uint16_t ScriptCount; | 88 TT_uint16_t ScriptCount; |
97 struct TScriptRecord* ScriptRecord; | 89 struct TScriptRecord* ScriptRecord; |
98 TScriptList() : ScriptCount(0), ScriptRecord(NULL) {} | 90 TScriptList() : ScriptCount(0), ScriptRecord(NULL) {} |
99 ~TScriptList() { | 91 ~TScriptList() { delete[] ScriptRecord; } |
100 if (ScriptRecord) { | |
101 delete[] ScriptRecord; | |
102 } | |
103 } | |
104 | 92 |
105 private: | 93 private: |
106 TScriptList(const TScriptList&); | 94 TScriptList(const TScriptList&); |
107 TScriptList& operator=(const TScriptList&); | 95 TScriptList& operator=(const TScriptList&); |
108 }; | 96 }; |
109 struct TFeature { | 97 struct TFeature { |
110 TT_uint16_t FeatureParams; | 98 TT_uint16_t FeatureParams; |
111 int LookupCount; | 99 int LookupCount; |
112 TT_uint16_t* LookupListIndex; | 100 TT_uint16_t* LookupListIndex; |
113 TFeature() : FeatureParams(0), LookupCount(0), LookupListIndex(NULL) {} | 101 TFeature() : FeatureParams(0), LookupCount(0), LookupListIndex(NULL) {} |
114 ~TFeature() { | 102 ~TFeature() { delete[] LookupListIndex; } |
115 if (LookupListIndex) { | |
116 delete[] LookupListIndex; | |
117 } | |
118 } | |
119 | 103 |
120 private: | 104 private: |
121 TFeature(const TFeature&); | 105 TFeature(const TFeature&); |
122 TFeature& operator=(const TFeature&); | 106 TFeature& operator=(const TFeature&); |
123 }; | 107 }; |
124 struct TFeatureRecord { | 108 struct TFeatureRecord { |
125 TT_uint32_t FeatureTag; | 109 TT_uint32_t FeatureTag; |
126 struct TFeature Feature; | 110 struct TFeature Feature; |
127 TFeatureRecord() : FeatureTag(0) {} | 111 TFeatureRecord() : FeatureTag(0) {} |
128 | 112 |
129 private: | 113 private: |
130 TFeatureRecord(const TFeatureRecord&); | 114 TFeatureRecord(const TFeatureRecord&); |
131 TFeatureRecord& operator=(const TFeatureRecord&); | 115 TFeatureRecord& operator=(const TFeatureRecord&); |
132 }; | 116 }; |
133 struct TFeatureList { | 117 struct TFeatureList { |
134 int FeatureCount; | 118 int FeatureCount; |
135 struct TFeatureRecord* FeatureRecord; | 119 struct TFeatureRecord* FeatureRecord; |
136 TFeatureList() : FeatureCount(0), FeatureRecord(NULL) {} | 120 TFeatureList() : FeatureCount(0), FeatureRecord(NULL) {} |
137 ~TFeatureList() { | 121 ~TFeatureList() { delete[] FeatureRecord; } |
138 if (FeatureRecord) { | |
139 delete[] FeatureRecord; | |
140 } | |
141 } | |
142 | 122 |
143 private: | 123 private: |
144 TFeatureList(const TFeatureList&); | 124 TFeatureList(const TFeatureList&); |
145 TFeatureList& operator=(const TFeatureList&); | 125 TFeatureList& operator=(const TFeatureList&); |
146 }; | 126 }; |
147 enum TLookupFlag { | 127 enum TLookupFlag { |
148 LOOKUPFLAG_RightToLeft = 0x0001, | 128 LOOKUPFLAG_RightToLeft = 0x0001, |
149 LOOKUPFLAG_IgnoreBaseGlyphs = 0x0002, | 129 LOOKUPFLAG_IgnoreBaseGlyphs = 0x0002, |
150 LOOKUPFLAG_IgnoreLigatures = 0x0004, | 130 LOOKUPFLAG_IgnoreLigatures = 0x0004, |
151 LOOKUPFLAG_IgnoreMarks = 0x0008, | 131 LOOKUPFLAG_IgnoreMarks = 0x0008, |
152 LOOKUPFLAG_Reserved = 0x00F0, | 132 LOOKUPFLAG_Reserved = 0x00F0, |
153 LOOKUPFLAG_MarkAttachmentType = 0xFF00, | 133 LOOKUPFLAG_MarkAttachmentType = 0xFF00, |
154 }; | 134 }; |
155 struct TCoverageFormatBase { | 135 struct TCoverageFormatBase { |
156 TT_uint16_t CoverageFormat; | 136 TT_uint16_t CoverageFormat; |
157 CFX_GlyphMap m_glyphMap; | 137 CFX_GlyphMap m_glyphMap; |
158 TCoverageFormatBase() : CoverageFormat(0) {} | 138 TCoverageFormatBase() : CoverageFormat(0) {} |
159 virtual ~TCoverageFormatBase() {} | 139 virtual ~TCoverageFormatBase() {} |
160 | 140 |
161 private: | 141 private: |
162 TCoverageFormatBase(const TCoverageFormatBase&); | 142 TCoverageFormatBase(const TCoverageFormatBase&); |
163 TCoverageFormatBase& operator=(const TCoverageFormatBase&); | 143 TCoverageFormatBase& operator=(const TCoverageFormatBase&); |
164 }; | 144 }; |
165 struct TCoverageFormat1 : public TCoverageFormatBase { | 145 struct TCoverageFormat1 : public TCoverageFormatBase { |
166 TT_uint16_t GlyphCount; | 146 TT_uint16_t GlyphCount; |
167 TT_uint16_t* GlyphArray; | 147 TT_uint16_t* GlyphArray; |
168 TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; } | 148 TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; } |
169 ~TCoverageFormat1() override { | 149 ~TCoverageFormat1() override { delete[] GlyphArray; } |
170 if (GlyphArray) { | |
171 delete[] GlyphArray; | |
172 } | |
173 } | |
174 | 150 |
175 private: | 151 private: |
176 TCoverageFormat1(const TCoverageFormat1&); | 152 TCoverageFormat1(const TCoverageFormat1&); |
177 TCoverageFormat1& operator=(const TCoverageFormat1&); | 153 TCoverageFormat1& operator=(const TCoverageFormat1&); |
178 }; | 154 }; |
179 struct TRangeRecord { | 155 struct TRangeRecord { |
180 TT_uint16_t Start; | 156 TT_uint16_t Start; |
181 TT_uint16_t End; | 157 TT_uint16_t End; |
182 TT_uint16_t StartCoverageIndex; | 158 TT_uint16_t StartCoverageIndex; |
183 TRangeRecord() : Start(0), End(0), StartCoverageIndex(0) {} | 159 TRangeRecord() : Start(0), End(0), StartCoverageIndex(0) {} |
184 friend bool operator>(const TRangeRecord& r1, const TRangeRecord& r2) { | 160 friend bool operator>(const TRangeRecord& r1, const TRangeRecord& r2) { |
185 return r1.Start > r2.Start; | 161 return r1.Start > r2.Start; |
186 } | 162 } |
187 | 163 |
188 private: | 164 private: |
189 TRangeRecord(const TRangeRecord&); | 165 TRangeRecord(const TRangeRecord&); |
190 }; | 166 }; |
191 struct TCoverageFormat2 : public TCoverageFormatBase { | 167 struct TCoverageFormat2 : public TCoverageFormatBase { |
192 TT_uint16_t RangeCount; | 168 TT_uint16_t RangeCount; |
193 struct TRangeRecord* RangeRecord; | 169 struct TRangeRecord* RangeRecord; |
194 TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) { | 170 TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) { |
195 CoverageFormat = 2; | 171 CoverageFormat = 2; |
196 } | 172 } |
197 ~TCoverageFormat2() override { | 173 ~TCoverageFormat2() override { delete[] RangeRecord; } |
198 if (RangeRecord) { | |
199 delete[] RangeRecord; | |
200 } | |
201 } | |
202 | 174 |
203 private: | 175 private: |
204 TCoverageFormat2(const TCoverageFormat2&); | 176 TCoverageFormat2(const TCoverageFormat2&); |
205 TCoverageFormat2& operator=(const TCoverageFormat2&); | 177 TCoverageFormat2& operator=(const TCoverageFormat2&); |
206 }; | 178 }; |
207 struct TClassDefFormatBase { | 179 struct TClassDefFormatBase { |
208 TT_uint16_t ClassFormat; | 180 TT_uint16_t ClassFormat; |
209 TClassDefFormatBase() : ClassFormat(0) {} | 181 TClassDefFormatBase() : ClassFormat(0) {} |
210 virtual ~TClassDefFormatBase() {} | 182 virtual ~TClassDefFormatBase() {} |
211 | 183 |
212 private: | 184 private: |
213 TClassDefFormatBase(const TClassDefFormatBase&); | 185 TClassDefFormatBase(const TClassDefFormatBase&); |
214 TClassDefFormatBase& operator=(const TClassDefFormatBase&); | 186 TClassDefFormatBase& operator=(const TClassDefFormatBase&); |
215 }; | 187 }; |
216 struct TClassDefFormat1 : public TClassDefFormatBase { | 188 struct TClassDefFormat1 : public TClassDefFormatBase { |
217 TT_uint16_t StartGlyph; | 189 TT_uint16_t StartGlyph; |
218 TT_uint16_t GlyphCount; | 190 TT_uint16_t GlyphCount; |
219 TT_uint16_t* ClassValueArray; | 191 TT_uint16_t* ClassValueArray; |
220 TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) { | 192 TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) { |
221 ClassFormat = 1; | 193 ClassFormat = 1; |
222 } | 194 } |
223 ~TClassDefFormat1() override { | 195 ~TClassDefFormat1() override { delete[] ClassValueArray; } |
224 if (ClassValueArray) { | |
225 delete[] ClassValueArray; | |
226 } | |
227 } | |
228 | 196 |
229 private: | 197 private: |
230 TClassDefFormat1(const TClassDefFormat1&); | 198 TClassDefFormat1(const TClassDefFormat1&); |
231 TClassDefFormat1& operator=(const TClassDefFormat1&); | 199 TClassDefFormat1& operator=(const TClassDefFormat1&); |
232 }; | 200 }; |
233 struct TClassRangeRecord { | 201 struct TClassRangeRecord { |
234 TT_uint16_t Start; | 202 TT_uint16_t Start; |
235 TT_uint16_t End; | 203 TT_uint16_t End; |
236 TT_uint16_t Class; | 204 TT_uint16_t Class; |
237 TClassRangeRecord() : Start(0), End(0), Class(0) {} | 205 TClassRangeRecord() : Start(0), End(0), Class(0) {} |
238 | 206 |
239 private: | 207 private: |
240 TClassRangeRecord(const TClassRangeRecord&); | 208 TClassRangeRecord(const TClassRangeRecord&); |
241 TClassRangeRecord& operator=(const TClassRangeRecord&); | 209 TClassRangeRecord& operator=(const TClassRangeRecord&); |
242 }; | 210 }; |
243 struct TClassDefFormat2 : public TClassDefFormatBase { | 211 struct TClassDefFormat2 : public TClassDefFormatBase { |
244 TT_uint16_t ClassRangeCount; | 212 TT_uint16_t ClassRangeCount; |
245 struct TClassRangeRecord* ClassRangeRecord; | 213 struct TClassRangeRecord* ClassRangeRecord; |
246 TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) { | 214 TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) { |
247 ClassFormat = 2; | 215 ClassFormat = 2; |
248 } | 216 } |
249 ~TClassDefFormat2() override { | 217 ~TClassDefFormat2() override { delete[] ClassRangeRecord; } |
250 if (ClassRangeRecord) { | |
251 delete[] ClassRangeRecord; | |
252 } | |
253 } | |
254 | 218 |
255 private: | 219 private: |
256 TClassDefFormat2(const TClassDefFormat2&); | 220 TClassDefFormat2(const TClassDefFormat2&); |
257 TClassDefFormat2& operator=(const TClassDefFormat2&); | 221 TClassDefFormat2& operator=(const TClassDefFormat2&); |
258 }; | 222 }; |
259 struct TDevice { | 223 struct TDevice { |
260 TT_uint16_t StartSize; | 224 TT_uint16_t StartSize; |
261 TT_uint16_t EndSize; | 225 TT_uint16_t EndSize; |
262 TT_uint16_t DeltaFormat; | 226 TT_uint16_t DeltaFormat; |
263 TDevice() : StartSize(0), EndSize(0), DeltaFormat(0) {} | 227 TDevice() : StartSize(0), EndSize(0), DeltaFormat(0) {} |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } | 282 } |
319 | 283 |
320 private: | 284 private: |
321 TLookup(const TLookup&); | 285 TLookup(const TLookup&); |
322 TLookup& operator=(const TLookup&); | 286 TLookup& operator=(const TLookup&); |
323 }; | 287 }; |
324 struct TLookupList { | 288 struct TLookupList { |
325 int LookupCount; | 289 int LookupCount; |
326 struct TLookup* Lookup; | 290 struct TLookup* Lookup; |
327 TLookupList() : LookupCount(0), Lookup(NULL) {} | 291 TLookupList() : LookupCount(0), Lookup(NULL) {} |
328 ~TLookupList() { | 292 ~TLookupList() { delete[] Lookup; } |
329 if (Lookup) { | |
330 delete[] Lookup; | |
331 } | |
332 } | |
333 | 293 |
334 private: | 294 private: |
335 TLookupList(const TLookupList&); | 295 TLookupList(const TLookupList&); |
336 TLookupList& operator=(const TLookupList&); | 296 TLookupList& operator=(const TLookupList&); |
337 }; | 297 }; |
338 bool Parse(FT_Bytes scriptlist, FT_Bytes featurelist, FT_Bytes lookuplist); | 298 bool Parse(FT_Bytes scriptlist, FT_Bytes featurelist, FT_Bytes lookuplist); |
339 void ParseScriptList(FT_Bytes raw, TScriptList* rec); | 299 void ParseScriptList(FT_Bytes raw, TScriptList* rec); |
340 void ParseScript(FT_Bytes raw, TScript* rec); | 300 void ParseScript(FT_Bytes raw, TScript* rec); |
341 void ParseLangSys(FT_Bytes raw, TLangSys* rec); | 301 void ParseLangSys(FT_Bytes raw, TLangSys* rec); |
342 void ParseFeatureList(FT_Bytes raw, TFeatureList* rec); | 302 void ParseFeatureList(FT_Bytes raw, TFeatureList* rec); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 class CFX_GSUBTable final : public IFX_GSUBTable { | 352 class CFX_GSUBTable final : public IFX_GSUBTable { |
393 public: | 353 public: |
394 ~CFX_GSUBTable() override {} | 354 ~CFX_GSUBTable() override {} |
395 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, | 355 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, |
396 FX_DWORD* vglyphnum) override; | 356 FX_DWORD* vglyphnum) override; |
397 | 357 |
398 CFX_CTTGSUBTable m_GsubImp; | 358 CFX_CTTGSUBTable m_GsubImp; |
399 }; | 359 }; |
400 | 360 |
401 #endif // CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ | 361 #endif // CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ |
OLD | NEW |