Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: fpdfsdk/formfiller/cba_fontmap.cpp

Issue 2083943003: Use FXFONT defines in place of integers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/cfx_systemhandler.cpp ('k') | fpdfsdk/formfiller/cffl_combobox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 m_sDefaultFontName = sFontName; 72 m_sDefaultFontName = sFontName;
73 73
74 int32_t nCharset = DEFAULT_CHARSET; 74 int32_t nCharset = DEFAULT_CHARSET;
75 if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) 75 if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont())
76 nCharset = pSubstFont->m_Charset; 76 nCharset = pSubstFont->m_Charset;
77 AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset); 77 AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
78 } 78 }
79 79
80 CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, 80 CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
81 int32_t nCharset) { 81 int32_t nCharset) {
82 if (m_pAnnotDict->GetStringBy("Subtype") == "Widget") { 82 if (m_pAnnotDict->GetStringBy("Subtype") != "Widget")
83 CPDF_Document* pDocument = GetDocument(); 83 return nullptr;
84 CPDF_Dictionary* pRootDict = pDocument->GetRoot();
85 if (!pRootDict)
86 return nullptr;
87 84
88 CPDF_Dictionary* pAcroFormDict = pRootDict->GetDictBy("AcroForm"); 85 CPDF_Document* pDocument = GetDocument();
89 if (!pAcroFormDict) 86 CPDF_Dictionary* pRootDict = pDocument->GetRoot();
90 return nullptr; 87 if (!pRootDict)
88 return nullptr;
91 89
92 CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictBy("DR"); 90 CPDF_Dictionary* pAcroFormDict = pRootDict->GetDictBy("AcroForm");
93 if (!pDRDict) 91 if (!pAcroFormDict)
94 return nullptr; 92 return nullptr;
95 93
96 return FindResFontSameCharset(pDRDict, sFontAlias, nCharset); 94 CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictBy("DR");
97 } 95 if (!pDRDict)
96 return nullptr;
98 97
99 return nullptr; 98 return FindResFontSameCharset(pDRDict, sFontAlias, nCharset);
100 } 99 }
101 100
102 CPDF_Document* CBA_FontMap::GetDocument() { 101 CPDF_Document* CBA_FontMap::GetDocument() {
103 return m_pDocument; 102 return m_pDocument;
104 } 103 }
105 104
106 CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, 105 CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
107 CFX_ByteString& sFontAlias, 106 CFX_ByteString& sFontAlias,
108 int32_t nCharset) { 107 int32_t nCharset) {
109 if (!pResDict) 108 if (!pResDict)
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 251
253 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; 252 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
254 } 253 }
255 254
256 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { 255 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) {
257 m_sAPType = sAPType; 256 m_sAPType = sAPType;
258 257
259 Reset(); 258 Reset();
260 Initialize(); 259 Initialize();
261 } 260 }
OLDNEW
« no previous file with comments | « fpdfsdk/cfx_systemhandler.cpp ('k') | fpdfsdk/formfiller/cffl_combobox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698