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 "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" | 7 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" |
8 | 8 |
9 #include "core/include/fpdfapi/fpdf_page.h" | 9 #include "core/include/fpdfapi/fpdf_page.h" |
10 #include "fpdfsdk/include/fsdk_baseannot.h" | 10 #include "fpdfsdk/include/fsdk_baseannot.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 CPDF_Document* pDocument = GetDocument(); | 112 CPDF_Document* pDocument = GetDocument(); |
113 ASSERT(pDocument != NULL); | 113 ASSERT(pDocument != NULL); |
114 | 114 |
115 CPDF_Dictionary* pFonts = pResDict->GetDict("Font"); | 115 CPDF_Dictionary* pFonts = pResDict->GetDict("Font"); |
116 if (!pFonts) | 116 if (!pFonts) |
117 return NULL; | 117 return NULL; |
118 | 118 |
119 CPDF_Font* pFind = NULL; | 119 CPDF_Font* pFind = NULL; |
120 | 120 |
121 FX_POSITION pos = pFonts->GetStartPos(); | 121 for (const auto& it : *pFonts) { |
122 while (pos) { | 122 const CFX_ByteString& csKey = it.first; |
123 CPDF_Object* pObj = NULL; | 123 CPDF_Object* pObj = it.second; |
124 CFX_ByteString csKey; | |
125 pObj = pFonts->GetNextElement(pos, csKey); | |
126 if (!pObj) | 124 if (!pObj) |
127 continue; | 125 continue; |
128 | 126 |
129 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); | 127 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); |
130 if (!pElement) | 128 if (!pElement) |
131 continue; | 129 continue; |
132 if (pElement->GetString("Type") != "Font") | 130 if (pElement->GetString("Type") != "Font") |
133 continue; | 131 continue; |
134 | 132 |
135 CPDF_Font* pFont = pDocument->LoadFont(pElement); | 133 CPDF_Font* pFont = pDocument->LoadFont(pElement); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 262 |
265 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; | 263 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; |
266 } | 264 } |
267 | 265 |
268 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { | 266 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { |
269 m_sAPType = sAPType; | 267 m_sAPType = sAPType; |
270 | 268 |
271 Reset(); | 269 Reset(); |
272 Initialize(); | 270 Initialize(); |
273 } | 271 } |
OLD | NEW |