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/fpdfdoc/cpvt_fontmap.h" | 7 #include "core/fpdfdoc/cpvt_fontmap.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 if (!pDoc || !pResDict) | 31 if (!pDoc || !pResDict) |
32 return; | 32 return; |
33 | 33 |
34 CFX_ByteString sFontAlias; | 34 CFX_ByteString sFontAlias; |
35 CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDictBy("AcroForm"); | 35 CPDF_Dictionary* pFormDict = pDoc->GetRoot()->GetDictBy("AcroForm"); |
36 CPDF_Font* pPDFFont = AddNativeInterFormFont(pFormDict, pDoc, sSysFontAlias); | 36 CPDF_Font* pPDFFont = AddNativeInterFormFont(pFormDict, pDoc, sSysFontAlias); |
37 if (!pPDFFont) | 37 if (!pPDFFont) |
38 return; | 38 return; |
39 | 39 |
40 if (CPDF_Dictionary* pFontList = pResDict->GetDictBy("Font")) { | 40 if (CPDF_Dictionary* pFontList = pResDict->GetDictBy("Font")) { |
41 if (!pFontList->KeyExist(sSysFontAlias)) | 41 if (!pFontList->KeyExist(sSysFontAlias.AsByteStringC())) |
42 pFontList->SetAtReference(sSysFontAlias, pDoc, pPDFFont->GetFontDict()); | 42 pFontList->SetAtReference(sSysFontAlias.AsByteStringC(), pDoc, |
| 43 pPDFFont->GetFontDict()); |
43 } | 44 } |
44 pSysFont = pPDFFont; | 45 pSysFont = pPDFFont; |
45 } | 46 } |
46 | 47 |
47 CPDF_Font* CPVT_FontMap::GetPDFFont(int32_t nFontIndex) { | 48 CPDF_Font* CPVT_FontMap::GetPDFFont(int32_t nFontIndex) { |
48 switch (nFontIndex) { | 49 switch (nFontIndex) { |
49 case 0: | 50 case 0: |
50 return m_pDefFont; | 51 return m_pDefFont; |
51 case 1: | 52 case 1: |
52 if (!m_pSysFont) { | 53 if (!m_pSysFont) { |
(...skipping 13 matching lines...) Expand all Loading... |
66 case 1: | 67 case 1: |
67 if (!m_pSysFont) { | 68 if (!m_pSysFont) { |
68 GetAnnotSysPDFFont(m_pDocument, m_pResDict, m_pSysFont, | 69 GetAnnotSysPDFFont(m_pDocument, m_pResDict, m_pSysFont, |
69 m_sSysFontAlias); | 70 m_sSysFontAlias); |
70 } | 71 } |
71 return m_sSysFontAlias; | 72 return m_sSysFontAlias; |
72 default: | 73 default: |
73 return ""; | 74 return ""; |
74 } | 75 } |
75 } | 76 } |
OLD | NEW |