| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 10 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 } | 460 } |
| 461 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); | 461 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); |
| 462 if (!pElement) | 462 if (!pElement) |
| 463 continue; | 463 continue; |
| 464 if (pElement->GetStringBy("Type") != "Font") | 464 if (pElement->GetStringBy("Type") != "Font") |
| 465 continue; | 465 continue; |
| 466 CPDF_Font* pFind = pDocument->LoadFont(pElement); | 466 CPDF_Font* pFind = pDocument->LoadFont(pElement); |
| 467 if (!pFind) { | 467 if (!pFind) { |
| 468 continue; | 468 continue; |
| 469 } | 469 } |
| 470 CFX_SubstFont* pSubst = (CFX_SubstFont*)pFind->GetSubstFont(); | 470 CFX_SubstFont* pSubst = pFind->GetSubstFont(); |
| 471 if (!pSubst) { | 471 if (!pSubst) { |
| 472 continue; | 472 continue; |
| 473 } | 473 } |
| 474 if (pSubst->m_Charset == (int)charSet) { | 474 if (pSubst->m_Charset == (int)charSet) { |
| 475 csNameTag = csKey; | 475 csNameTag = csKey; |
| 476 return pFind; | 476 return pFind; |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 return nullptr; | 479 return nullptr; |
| 480 } | 480 } |
| 481 CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, | 481 CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, |
| 482 CPDF_Document* pDocument, | 482 CPDF_Document* pDocument, |
| 483 CFX_ByteString& csNameTag) { | 483 CFX_ByteString& csNameTag) { |
| 484 csNameTag = ""; | 484 csNameTag = ""; |
| 485 uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); | 485 uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); |
| 486 CFX_SubstFont* pSubst; | 486 CFX_SubstFont* pSubst; |
| 487 CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument); | 487 CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument); |
| 488 if (pFont) { | 488 if (pFont) { |
| 489 pSubst = (CFX_SubstFont*)pFont->GetSubstFont(); | 489 pSubst = pFont->GetSubstFont(); |
| 490 if (pSubst && pSubst->m_Charset == (int)charSet) { | 490 if (pSubst && pSubst->m_Charset == (int)charSet) { |
| 491 FindInterFormFont(pFormDict, pFont, csNameTag); | 491 FindInterFormFont(pFormDict, pFont, csNameTag); |
| 492 return pFont; | 492 return pFont; |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 return GetNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag); | 495 return GetNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag); |
| 496 } | 496 } |
| 497 FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, | 497 FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, |
| 498 const CPDF_Font* pFont, | 498 const CPDF_Font* pFont, |
| 499 CFX_ByteString& csNameTag) { | 499 CFX_ByteString& csNameTag) { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 CPDF_Object* pAttr = pFieldDict->GetDirectObjectBy(name); | 744 CPDF_Object* pAttr = pFieldDict->GetDirectObjectBy(name); |
| 745 if (pAttr) { | 745 if (pAttr) { |
| 746 return pAttr; | 746 return pAttr; |
| 747 } | 747 } |
| 748 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); | 748 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); |
| 749 if (!pParent) { | 749 if (!pParent) { |
| 750 return nullptr; | 750 return nullptr; |
| 751 } | 751 } |
| 752 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); | 752 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); |
| 753 } | 753 } |
| OLD | NEW |