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 "../../include/formfiller/FormFiller.h" | 7 #include "../../include/formfiller/FormFiller.h" |
8 #include "../../include/formfiller/FFL_CBA_Fontmap.h" | 8 #include "../../include/formfiller/FFL_CBA_Fontmap.h" |
9 | 9 |
10 CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandle
r) : | 10 CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandle
r) : |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 int32_t nCharset = DEFAULT_CHARSET; | 86 int32_t nCharset = DEFAULT_CHARSET; |
87 if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) | 87 if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) |
88 nCharset = pSubstFont->m_Charset; | 88 nCharset = pSubstFont->m_Charset; |
89 AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset); | 89 AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset); |
90 } | 90 } |
91 | 91 |
92 CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t
nCharset) | 92 CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t
nCharset) |
93 { | 93 { |
94 ASSERT(m_pAnnotDict != NULL); | 94 ASSERT(m_pAnnotDict != NULL); |
95 | 95 |
96 » if (m_pAnnotDict->GetString("Subtype") == "Widget") | 96 » if (m_pAnnotDict->GetStringAt("Subtype") == "Widget") |
97 { | 97 { |
98 CPDF_Document* pDocument = GetDocument(); | 98 CPDF_Document* pDocument = GetDocument(); |
99 ASSERT(pDocument != NULL); | 99 ASSERT(pDocument != NULL); |
100 | 100 |
101 CPDF_Dictionary * pRootDict = pDocument->GetRoot(); | 101 CPDF_Dictionary * pRootDict = pDocument->GetRoot(); |
102 if (!pRootDict) return NULL; | 102 if (!pRootDict) return NULL; |
103 | 103 |
104 CPDF_Dictionary* pAcroFormDict = pRootDict->GetDict("AcroForm"); | 104 CPDF_Dictionary* pAcroFormDict = pRootDict->GetDict("AcroForm"); |
105 if (!pAcroFormDict) return NULL; | 105 if (!pAcroFormDict) return NULL; |
106 | 106 |
(...skipping 29 matching lines...) Expand all Loading... |
136 { | 136 { |
137 CPDF_Object* pObj = NULL; | 137 CPDF_Object* pObj = NULL; |
138 CFX_ByteString csKey; | 138 CFX_ByteString csKey; |
139 pObj = pFonts->GetNextElement(pos, csKey); | 139 pObj = pFonts->GetNextElement(pos, csKey); |
140 if (pObj == NULL) continue; | 140 if (pObj == NULL) continue; |
141 | 141 |
142 CPDF_Object* pDirect = pObj->GetDirect(); | 142 CPDF_Object* pDirect = pObj->GetDirect(); |
143 if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY)
continue; | 143 if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY)
continue; |
144 | 144 |
145 CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect; | 145 CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect; |
146 » » if (pElement->GetString("Type") != "Font") continue; | 146 » » if (pElement->GetStringAt("Type") != "Font") |
| 147 continue; |
147 | 148 |
148 CPDF_Font* pFont = pDocument->LoadFont(pElement); | 149 CPDF_Font* pFont = pDocument->LoadFont(pElement); |
149 if (pFont == NULL) continue; | 150 if (pFont == NULL) continue; |
150 const CFX_SubstFont* pSubst = pFont->GetSubstFont(); | 151 const CFX_SubstFont* pSubst = pFont->GetSubstFont(); |
151 if (pSubst == NULL) continue; | 152 if (pSubst == NULL) continue; |
152 if (pSubst->m_Charset == nCharset) | 153 if (pSubst->m_Charset == nCharset) |
153 { | 154 { |
154 sFontAlias = csKey; | 155 sFontAlias = csKey; |
155 pFind = pFont; | 156 pFind = pFont; |
156 } | 157 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 224 } |
224 } | 225 } |
225 | 226 |
226 CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString &sAlias) | 227 CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString &sAlias) |
227 { | 228 { |
228 ASSERT(m_pAnnotDict != NULL); | 229 ASSERT(m_pAnnotDict != NULL); |
229 ASSERT(m_pDocument != NULL); | 230 ASSERT(m_pDocument != NULL); |
230 | 231 |
231 CPDF_Dictionary* pAcroFormDict = NULL; | 232 CPDF_Dictionary* pAcroFormDict = NULL; |
232 | 233 |
233 » FX_BOOL bWidget = (m_pAnnotDict->GetString("Subtype") == "Widget"); | 234 » FX_BOOL bWidget = (m_pAnnotDict->GetStringAt("Subtype") == "Widget"); |
234 | 235 |
235 if (bWidget) | 236 if (bWidget) |
236 { | 237 { |
237 if (CPDF_Dictionary * pRootDict = m_pDocument->GetRoot()) | 238 if (CPDF_Dictionary * pRootDict = m_pDocument->GetRoot()) |
238 pAcroFormDict = pRootDict->GetDict("AcroForm"); | 239 pAcroFormDict = pRootDict->GetDict("AcroForm"); |
239 } | 240 } |
240 | 241 |
241 CFX_ByteString sDA; | 242 CFX_ByteString sDA; |
242 CPDF_Object* pObj; | 243 CPDF_Object* pObj; |
243 if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA"))) | 244 if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA"))) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 291 } |
291 | 292 |
292 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) | 293 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) |
293 { | 294 { |
294 m_sAPType = sAPType; | 295 m_sAPType = sAPType; |
295 | 296 |
296 Reset(); | 297 Reset(); |
297 Initial(); | 298 Initial(); |
298 } | 299 } |
299 | 300 |
OLD | NEW |