Chromium Code Reviews| 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_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 | 215 |
| 216 if (bWidget) { | 216 if (bWidget) { |
| 217 if (sDA.IsEmpty()) { | 217 if (sDA.IsEmpty()) { |
| 218 pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA"); | 218 pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA"); |
| 219 sDA = pObj ? pObj->GetString() : CFX_ByteString(); | 219 sDA = pObj ? pObj->GetString() : CFX_ByteString(); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 CPDF_Dictionary* pFontDict = nullptr; | 223 CPDF_Dictionary* pFontDict = nullptr; |
| 224 | 224 |
| 225 if (!sDA.IsEmpty()) { | 225 if (!sDA.IsEmpty()) { |
|
Tom Sepez
2016/09/12 21:19:22
nit: can we avoid some indentation with early retu
npm
2016/09/12 21:40:12
Cleanly, just one :( I can replace the if stack wi
| |
| 226 CPDF_SimpleParser syntax(sDA.AsStringC()); | 226 CPDF_SimpleParser syntax(sDA.AsStringC()); |
| 227 syntax.FindTagParamFromStart("Tf", 2); | 227 syntax.FindTagParamFromStart("Tf", 2); |
| 228 CFX_ByteString sFontName(syntax.GetWord()); | 228 CFX_ByteString sFontName(syntax.GetWord()); |
| 229 sAlias = PDF_NameDecode(sFontName).Mid(1); | 229 sAlias = PDF_NameDecode(sFontName).Mid(1); |
| 230 | 230 |
| 231 if (CPDF_Dictionary* pDRDict = m_pAnnotDict->GetDictBy("DR")) | 231 if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictBy("AP")) |
|
dsinclair
2016/09/12 20:51:49
These need {}'s added.
npm
2016/09/12 21:40:12
Done.
| |
| 232 if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDictBy("Font")) | 232 if (CPDF_Dictionary* pNormalDict = pAPDict->GetDictBy("N")) |
| 233 pFontDict = pDRFontDict->GetDictBy(sAlias); | 233 if (CPDF_Dictionary* pNormalResDict = |
| 234 | 234 pNormalDict->GetDictBy("Resources")) |
| 235 if (!pFontDict) | 235 if (CPDF_Dictionary* pResFontDict = pNormalResDict->GetDictBy("Font")) |
| 236 if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictBy("AP")) | 236 pFontDict = pResFontDict->GetDictBy(sAlias); |
| 237 if (CPDF_Dictionary* pNormalDict = pAPDict->GetDictBy("N")) | |
| 238 if (CPDF_Dictionary* pNormalResDict = | |
| 239 pNormalDict->GetDictBy("Resources")) | |
| 240 if (CPDF_Dictionary* pResFontDict = | |
| 241 pNormalResDict->GetDictBy("Font")) | |
| 242 pFontDict = pResFontDict->GetDictBy(sAlias); | |
| 243 | 237 |
| 244 if (bWidget) { | 238 if (bWidget) { |
| 245 if (!pFontDict) { | 239 if (!pFontDict) { |
| 246 if (pAcroFormDict) { | 240 if (pAcroFormDict) { |
| 247 if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictBy("DR")) | 241 if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictBy("DR")) |
| 248 if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDictBy("Font")) | 242 if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDictBy("Font")) |
| 249 pFontDict = pDRFontDict->GetDictBy(sAlias); | 243 pFontDict = pDRFontDict->GetDictBy(sAlias); |
| 250 } | 244 } |
| 251 } | 245 } |
| 252 } | 246 } |
| 253 } | 247 } |
| 254 | 248 |
| 255 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; | 249 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; |
| 256 } | 250 } |
| 257 | 251 |
| 258 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { | 252 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { |
| 259 m_sAPType = sAPType; | 253 m_sAPType = sAPType; |
| 260 | 254 |
| 261 Reset(); | 255 Reset(); |
| 262 Initialize(); | 256 Initialize(); |
| 263 } | 257 } |
| OLD | NEW |