Chromium Code Reviews| 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() { |
| 115 if (LookupListIndex) { | |
| 116 delete[] LookupListIndex; | 103 delete[] LookupListIndex; |
|
Tom Sepez
2015/08/14 21:21:34
nit: indentation. Several other places. clang-fo
Lei Zhang
2015/08/14 21:43:14
I don't know why clang-format did all the ones abo
| |
| 117 } | |
| 118 } | 104 } |
| 119 | 105 |
| 120 private: | 106 private: |
| 121 TFeature(const TFeature&); | 107 TFeature(const TFeature&); |
| 122 TFeature& operator=(const TFeature&); | 108 TFeature& operator=(const TFeature&); |
| 123 }; | 109 }; |
| 124 struct TFeatureRecord { | 110 struct TFeatureRecord { |
| 125 TT_uint32_t FeatureTag; | 111 TT_uint32_t FeatureTag; |
| 126 struct TFeature Feature; | 112 struct TFeature Feature; |
| 127 TFeatureRecord() : FeatureTag(0) {} | 113 TFeatureRecord() : FeatureTag(0) {} |
| 128 | 114 |
| 129 private: | 115 private: |
| 130 TFeatureRecord(const TFeatureRecord&); | 116 TFeatureRecord(const TFeatureRecord&); |
| 131 TFeatureRecord& operator=(const TFeatureRecord&); | 117 TFeatureRecord& operator=(const TFeatureRecord&); |
| 132 }; | 118 }; |
| 133 struct TFeatureList { | 119 struct TFeatureList { |
| 134 int FeatureCount; | 120 int FeatureCount; |
| 135 struct TFeatureRecord* FeatureRecord; | 121 struct TFeatureRecord* FeatureRecord; |
| 136 TFeatureList() : FeatureCount(0), FeatureRecord(NULL) {} | 122 TFeatureList() : FeatureCount(0), FeatureRecord(NULL) {} |
| 137 ~TFeatureList() { | 123 ~TFeatureList() { |
| 138 if (FeatureRecord) { | |
| 139 delete[] FeatureRecord; | 124 delete[] FeatureRecord; |
| 140 } | |
| 141 } | 125 } |
| 142 | 126 |
| 143 private: | 127 private: |
| 144 TFeatureList(const TFeatureList&); | 128 TFeatureList(const TFeatureList&); |
| 145 TFeatureList& operator=(const TFeatureList&); | 129 TFeatureList& operator=(const TFeatureList&); |
| 146 }; | 130 }; |
| 147 enum TLookupFlag { | 131 enum TLookupFlag { |
| 148 LOOKUPFLAG_RightToLeft = 0x0001, | 132 LOOKUPFLAG_RightToLeft = 0x0001, |
| 149 LOOKUPFLAG_IgnoreBaseGlyphs = 0x0002, | 133 LOOKUPFLAG_IgnoreBaseGlyphs = 0x0002, |
| 150 LOOKUPFLAG_IgnoreLigatures = 0x0004, | 134 LOOKUPFLAG_IgnoreLigatures = 0x0004, |
| 151 LOOKUPFLAG_IgnoreMarks = 0x0008, | 135 LOOKUPFLAG_IgnoreMarks = 0x0008, |
| 152 LOOKUPFLAG_Reserved = 0x00F0, | 136 LOOKUPFLAG_Reserved = 0x00F0, |
| 153 LOOKUPFLAG_MarkAttachmentType = 0xFF00, | 137 LOOKUPFLAG_MarkAttachmentType = 0xFF00, |
| 154 }; | 138 }; |
| 155 struct TCoverageFormatBase { | 139 struct TCoverageFormatBase { |
| 156 TT_uint16_t CoverageFormat; | 140 TT_uint16_t CoverageFormat; |
| 157 CFX_GlyphMap m_glyphMap; | 141 CFX_GlyphMap m_glyphMap; |
| 158 TCoverageFormatBase() : CoverageFormat(0) {} | 142 TCoverageFormatBase() : CoverageFormat(0) {} |
| 159 virtual ~TCoverageFormatBase() {} | 143 virtual ~TCoverageFormatBase() {} |
| 160 | 144 |
| 161 private: | 145 private: |
| 162 TCoverageFormatBase(const TCoverageFormatBase&); | 146 TCoverageFormatBase(const TCoverageFormatBase&); |
| 163 TCoverageFormatBase& operator=(const TCoverageFormatBase&); | 147 TCoverageFormatBase& operator=(const TCoverageFormatBase&); |
| 164 }; | 148 }; |
| 165 struct TCoverageFormat1 : public TCoverageFormatBase { | 149 struct TCoverageFormat1 : public TCoverageFormatBase { |
| 166 TT_uint16_t GlyphCount; | 150 TT_uint16_t GlyphCount; |
| 167 TT_uint16_t* GlyphArray; | 151 TT_uint16_t* GlyphArray; |
| 168 TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; } | 152 TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; } |
| 169 ~TCoverageFormat1() { | 153 ~TCoverageFormat1() { |
| 170 if (GlyphArray) { | |
| 171 delete[] GlyphArray; | 154 delete[] GlyphArray; |
| 172 } | |
| 173 } | 155 } |
| 174 | 156 |
| 175 private: | 157 private: |
| 176 TCoverageFormat1(const TCoverageFormat1&); | 158 TCoverageFormat1(const TCoverageFormat1&); |
| 177 TCoverageFormat1& operator=(const TCoverageFormat1&); | 159 TCoverageFormat1& operator=(const TCoverageFormat1&); |
| 178 }; | 160 }; |
| 179 struct TRangeRecord { | 161 struct TRangeRecord { |
| 180 TT_uint16_t Start; | 162 TT_uint16_t Start; |
| 181 TT_uint16_t End; | 163 TT_uint16_t End; |
| 182 TT_uint16_t StartCoverageIndex; | 164 TT_uint16_t StartCoverageIndex; |
| 183 TRangeRecord() : Start(0), End(0), StartCoverageIndex(0) {} | 165 TRangeRecord() : Start(0), End(0), StartCoverageIndex(0) {} |
| 184 friend bool operator>(const TRangeRecord& r1, const TRangeRecord& r2) { | 166 friend bool operator>(const TRangeRecord& r1, const TRangeRecord& r2) { |
| 185 return r1.Start > r2.Start; | 167 return r1.Start > r2.Start; |
| 186 } | 168 } |
| 187 | 169 |
| 188 private: | 170 private: |
| 189 TRangeRecord(const TRangeRecord&); | 171 TRangeRecord(const TRangeRecord&); |
| 190 }; | 172 }; |
| 191 struct TCoverageFormat2 : public TCoverageFormatBase { | 173 struct TCoverageFormat2 : public TCoverageFormatBase { |
| 192 TT_uint16_t RangeCount; | 174 TT_uint16_t RangeCount; |
| 193 struct TRangeRecord* RangeRecord; | 175 struct TRangeRecord* RangeRecord; |
| 194 TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) { | 176 TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) { |
| 195 CoverageFormat = 2; | 177 CoverageFormat = 2; |
| 196 } | 178 } |
| 197 ~TCoverageFormat2() { | 179 ~TCoverageFormat2() { |
| 198 if (RangeRecord) { | |
| 199 delete[] RangeRecord; | 180 delete[] RangeRecord; |
| 200 } | |
| 201 } | 181 } |
| 202 | 182 |
| 203 private: | 183 private: |
| 204 TCoverageFormat2(const TCoverageFormat2&); | 184 TCoverageFormat2(const TCoverageFormat2&); |
| 205 TCoverageFormat2& operator=(const TCoverageFormat2&); | 185 TCoverageFormat2& operator=(const TCoverageFormat2&); |
| 206 }; | 186 }; |
| 207 struct TClassDefFormatBase { | 187 struct TClassDefFormatBase { |
| 208 TT_uint16_t ClassFormat; | 188 TT_uint16_t ClassFormat; |
| 209 TClassDefFormatBase() : ClassFormat(0) {} | 189 TClassDefFormatBase() : ClassFormat(0) {} |
| 210 virtual ~TClassDefFormatBase() {} | 190 virtual ~TClassDefFormatBase() {} |
| 211 | 191 |
| 212 private: | 192 private: |
| 213 TClassDefFormatBase(const TClassDefFormatBase&); | 193 TClassDefFormatBase(const TClassDefFormatBase&); |
| 214 TClassDefFormatBase& operator=(const TClassDefFormatBase&); | 194 TClassDefFormatBase& operator=(const TClassDefFormatBase&); |
| 215 }; | 195 }; |
| 216 struct TClassDefFormat1 : public TClassDefFormatBase { | 196 struct TClassDefFormat1 : public TClassDefFormatBase { |
| 217 TT_uint16_t StartGlyph; | 197 TT_uint16_t StartGlyph; |
| 218 TT_uint16_t GlyphCount; | 198 TT_uint16_t GlyphCount; |
| 219 TT_uint16_t* ClassValueArray; | 199 TT_uint16_t* ClassValueArray; |
| 220 TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) { | 200 TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) { |
| 221 ClassFormat = 1; | 201 ClassFormat = 1; |
| 222 } | 202 } |
| 223 ~TClassDefFormat1() { | 203 ~TClassDefFormat1() { |
| 224 if (ClassValueArray) { | |
| 225 delete[] ClassValueArray; | 204 delete[] ClassValueArray; |
| 226 } | |
| 227 } | 205 } |
| 228 | 206 |
| 229 private: | 207 private: |
| 230 TClassDefFormat1(const TClassDefFormat1&); | 208 TClassDefFormat1(const TClassDefFormat1&); |
| 231 TClassDefFormat1& operator=(const TClassDefFormat1&); | 209 TClassDefFormat1& operator=(const TClassDefFormat1&); |
| 232 }; | 210 }; |
| 233 struct TClassRangeRecord { | 211 struct TClassRangeRecord { |
| 234 TT_uint16_t Start; | 212 TT_uint16_t Start; |
| 235 TT_uint16_t End; | 213 TT_uint16_t End; |
| 236 TT_uint16_t Class; | 214 TT_uint16_t Class; |
| 237 TClassRangeRecord() : Start(0), End(0), Class(0) {} | 215 TClassRangeRecord() : Start(0), End(0), Class(0) {} |
| 238 | 216 |
| 239 private: | 217 private: |
| 240 TClassRangeRecord(const TClassRangeRecord&); | 218 TClassRangeRecord(const TClassRangeRecord&); |
| 241 TClassRangeRecord& operator=(const TClassRangeRecord&); | 219 TClassRangeRecord& operator=(const TClassRangeRecord&); |
| 242 }; | 220 }; |
| 243 struct TClassDefFormat2 : public TClassDefFormatBase { | 221 struct TClassDefFormat2 : public TClassDefFormatBase { |
| 244 TT_uint16_t ClassRangeCount; | 222 TT_uint16_t ClassRangeCount; |
| 245 struct TClassRangeRecord* ClassRangeRecord; | 223 struct TClassRangeRecord* ClassRangeRecord; |
| 246 TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) { | 224 TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) { |
| 247 ClassFormat = 2; | 225 ClassFormat = 2; |
| 248 } | 226 } |
| 249 ~TClassDefFormat2() { | 227 ~TClassDefFormat2() { |
| 250 if (ClassRangeRecord) { | |
| 251 delete[] ClassRangeRecord; | 228 delete[] ClassRangeRecord; |
| 252 } | |
| 253 } | 229 } |
| 254 | 230 |
| 255 private: | 231 private: |
| 256 TClassDefFormat2(const TClassDefFormat2&); | 232 TClassDefFormat2(const TClassDefFormat2&); |
| 257 TClassDefFormat2& operator=(const TClassDefFormat2&); | 233 TClassDefFormat2& operator=(const TClassDefFormat2&); |
| 258 }; | 234 }; |
| 259 struct TDevice { | 235 struct TDevice { |
| 260 TT_uint16_t StartSize; | 236 TT_uint16_t StartSize; |
| 261 TT_uint16_t EndSize; | 237 TT_uint16_t EndSize; |
| 262 TT_uint16_t DeltaFormat; | 238 TT_uint16_t DeltaFormat; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 | 295 |
| 320 private: | 296 private: |
| 321 TLookup(const TLookup&); | 297 TLookup(const TLookup&); |
| 322 TLookup& operator=(const TLookup&); | 298 TLookup& operator=(const TLookup&); |
| 323 }; | 299 }; |
| 324 struct TLookupList { | 300 struct TLookupList { |
| 325 int LookupCount; | 301 int LookupCount; |
| 326 struct TLookup* Lookup; | 302 struct TLookup* Lookup; |
| 327 TLookupList() : LookupCount(0), Lookup(NULL) {} | 303 TLookupList() : LookupCount(0), Lookup(NULL) {} |
| 328 ~TLookupList() { | 304 ~TLookupList() { |
| 329 if (Lookup) { | |
| 330 delete[] Lookup; | 305 delete[] Lookup; |
| 331 } | |
| 332 } | 306 } |
| 333 | 307 |
| 334 private: | 308 private: |
| 335 TLookupList(const TLookupList&); | 309 TLookupList(const TLookupList&); |
| 336 TLookupList& operator=(const TLookupList&); | 310 TLookupList& operator=(const TLookupList&); |
| 337 }; | 311 }; |
| 338 bool Parse(FT_Bytes scriptlist, FT_Bytes featurelist, FT_Bytes lookuplist); | 312 bool Parse(FT_Bytes scriptlist, FT_Bytes featurelist, FT_Bytes lookuplist); |
| 339 void ParseScriptList(FT_Bytes raw, TScriptList* rec); | 313 void ParseScriptList(FT_Bytes raw, TScriptList* rec); |
| 340 void ParseScript(FT_Bytes raw, TScript* rec); | 314 void ParseScript(FT_Bytes raw, TScript* rec); |
| 341 void ParseLangSys(FT_Bytes raw, TLangSys* rec); | 315 void ParseLangSys(FT_Bytes raw, TLangSys* rec); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 class CFX_GSUBTable final : public IFX_GSUBTable { | 366 class CFX_GSUBTable final : public IFX_GSUBTable { |
| 393 public: | 367 public: |
| 394 ~CFX_GSUBTable() override {} | 368 ~CFX_GSUBTable() override {} |
| 395 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, | 369 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, |
| 396 FX_DWORD* vglyphnum) override; | 370 FX_DWORD* vglyphnum) override; |
| 397 | 371 |
| 398 CFX_CTTGSUBTable m_GsubImp; | 372 CFX_CTTGSUBTable m_GsubImp; |
| 399 }; | 373 }; |
| 400 | 374 |
| 401 #endif // CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ | 375 #endif // CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ |
| OLD | NEW |