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/formfiller/cba_fontmap.h" | 7 #include "fpdfsdk/formfiller/cba_fontmap.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) { | 200 CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) { |
201 CPDF_Dictionary* pAcroFormDict = NULL; | 201 CPDF_Dictionary* pAcroFormDict = NULL; |
202 const bool bWidget = (m_pAnnotDict->GetStringBy("Subtype") == "Widget"); | 202 const bool bWidget = (m_pAnnotDict->GetStringBy("Subtype") == "Widget"); |
203 if (bWidget) { | 203 if (bWidget) { |
204 if (CPDF_Dictionary* pRootDict = m_pDocument->GetRoot()) | 204 if (CPDF_Dictionary* pRootDict = m_pDocument->GetRoot()) |
205 pAcroFormDict = pRootDict->GetDictBy("AcroForm"); | 205 pAcroFormDict = pRootDict->GetDictBy("AcroForm"); |
206 } | 206 } |
207 | 207 |
208 CFX_ByteString sDA; | 208 CFX_ByteString sDA; |
209 CPDF_Object* pObj; | 209 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA"); |
210 if ((pObj = FPDF_GetFieldAttr(m_pAnnotDict, "DA"))) | 210 if (pObj) |
211 sDA = pObj->GetString(); | 211 sDA = pObj->GetString(); |
212 | 212 |
213 if (bWidget) { | 213 if (bWidget) { |
214 if (sDA.IsEmpty()) { | 214 if (sDA.IsEmpty()) { |
215 pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA"); | 215 pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA"); |
216 sDA = pObj ? pObj->GetString() : CFX_ByteString(); | 216 sDA = pObj ? pObj->GetString() : CFX_ByteString(); |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 CPDF_Dictionary* pFontDict = NULL; | 220 CPDF_Dictionary* pFontDict = NULL; |
(...skipping 30 matching lines...) Expand all Loading... |
251 | 251 |
252 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; | 252 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; |
253 } | 253 } |
254 | 254 |
255 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { | 255 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { |
256 m_sAPType = sAPType; | 256 m_sAPType = sAPType; |
257 | 257 |
258 Reset(); | 258 Reset(); |
259 Initialize(); | 259 Initialize(); |
260 } | 260 } |
OLD | NEW |