| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/include/cpdf_font.h" | 7 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_font/cpdf_truetypefont.h" | 9 #include "core/fpdfapi/fpdf_font/cpdf_truetypefont.h" |
| 10 #include "core/fpdfapi/fpdf_font/cpdf_type1font.h" | 10 #include "core/fpdfapi/fpdf_font/cpdf_type1font.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 if ((!bEmbedded || bTrueType) && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) { | 445 if ((!bEmbedded || bTrueType) && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) { |
| 446 iBaseEncoding = PDFFONT_ENCODING_STANDARD; | 446 iBaseEncoding = PDFFONT_ENCODING_STANDARD; |
| 447 } | 447 } |
| 448 CPDF_Array* pDiffs = pDict->GetArrayBy("Differences"); | 448 CPDF_Array* pDiffs = pDict->GetArrayBy("Differences"); |
| 449 if (!pDiffs) { | 449 if (!pDiffs) { |
| 450 return; | 450 return; |
| 451 } | 451 } |
| 452 pCharNames = new CFX_ByteString[256]; | 452 pCharNames = new CFX_ByteString[256]; |
| 453 uint32_t cur_code = 0; | 453 uint32_t cur_code = 0; |
| 454 for (uint32_t i = 0; i < pDiffs->GetCount(); i++) { | 454 for (uint32_t i = 0; i < pDiffs->GetCount(); i++) { |
| 455 CPDF_Object* pElement = pDiffs->GetElementValue(i); | 455 CPDF_Object* pElement = pDiffs->GetDirectObjectAt(i); |
| 456 if (!pElement) | 456 if (!pElement) |
| 457 continue; | 457 continue; |
| 458 | 458 |
| 459 if (CPDF_Name* pName = pElement->AsName()) { | 459 if (CPDF_Name* pName = pElement->AsName()) { |
| 460 if (cur_code < 256) | 460 if (cur_code < 256) |
| 461 pCharNames[cur_code] = pName->GetString(); | 461 pCharNames[cur_code] = pName->GetString(); |
| 462 cur_code++; | 462 cur_code++; |
| 463 } else { | 463 } else { |
| 464 cur_code = pElement->GetInteger(); | 464 cur_code = pElement->GetInteger(); |
| 465 } | 465 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 483 if (charcode < 0 || charcode >= 256) | 483 if (charcode < 0 || charcode >= 256) |
| 484 return nullptr; | 484 return nullptr; |
| 485 | 485 |
| 486 const FX_CHAR* name = nullptr; | 486 const FX_CHAR* name = nullptr; |
| 487 if (pCharNames) | 487 if (pCharNames) |
| 488 name = pCharNames[charcode]; | 488 name = pCharNames[charcode]; |
| 489 if ((!name || name[0] == 0) && iBaseEncoding) | 489 if ((!name || name[0] == 0) && iBaseEncoding) |
| 490 name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); | 490 name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); |
| 491 return name && name[0] ? name : nullptr; | 491 return name && name[0] ? name : nullptr; |
| 492 } | 492 } |
| OLD | NEW |