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 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" | 7 #include "core/fpdfapi/fpdf_font/ttgsubtable.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 int i; | 283 int i; |
284 FT_Bytes sp = raw; | 284 FT_Bytes sp = raw; |
285 rec->LookupType = GetUInt16(sp); | 285 rec->LookupType = GetUInt16(sp); |
286 rec->LookupFlag = GetUInt16(sp); | 286 rec->LookupFlag = GetUInt16(sp); |
287 rec->SubTableCount = GetUInt16(sp); | 287 rec->SubTableCount = GetUInt16(sp); |
288 if (rec->SubTableCount <= 0) { | 288 if (rec->SubTableCount <= 0) { |
289 return; | 289 return; |
290 } | 290 } |
291 rec->SubTable = new struct TSubTableBase*[rec->SubTableCount]; | 291 rec->SubTable = new struct TSubTableBase*[rec->SubTableCount]; |
292 for (i = 0; i < rec->SubTableCount; i++) { | 292 for (i = 0; i < rec->SubTableCount; i++) { |
293 rec->SubTable[i] = NULL; | 293 rec->SubTable[i] = nullptr; |
294 } | 294 } |
295 if (rec->LookupType != 1) { | 295 if (rec->LookupType != 1) { |
296 return; | 296 return; |
297 } | 297 } |
298 for (i = 0; i < rec->SubTableCount; i++) { | 298 for (i = 0; i < rec->SubTableCount; i++) { |
299 uint16_t offset = GetUInt16(sp); | 299 uint16_t offset = GetUInt16(sp); |
300 ParseSingleSubst(&raw[offset], &rec->SubTable[i]); | 300 ParseSingleSubst(&raw[offset], &rec->SubTable[i]); |
301 } | 301 } |
302 } | 302 } |
303 void CFX_CTTGSUBTable::ParseCoverage(FT_Bytes raw, TCoverageFormatBase** rec) { | 303 void CFX_CTTGSUBTable::ParseCoverage(FT_Bytes raw, TCoverageFormatBase** rec) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 ParseCoverage(&raw[offset], &rec->Coverage); | 375 ParseCoverage(&raw[offset], &rec->Coverage); |
376 rec->GlyphCount = GetUInt16(sp); | 376 rec->GlyphCount = GetUInt16(sp); |
377 if (rec->GlyphCount <= 0) { | 377 if (rec->GlyphCount <= 0) { |
378 return; | 378 return; |
379 } | 379 } |
380 rec->Substitute = new uint16_t[rec->GlyphCount]; | 380 rec->Substitute = new uint16_t[rec->GlyphCount]; |
381 for (i = 0; i < rec->GlyphCount; i++) { | 381 for (i = 0; i < rec->GlyphCount; i++) { |
382 rec->Substitute[i] = GetUInt16(sp); | 382 rec->Substitute[i] = GetUInt16(sp); |
383 } | 383 } |
384 } | 384 } |
OLD | NEW |