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

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

Issue 2347313002: Remove duplicated charset definitions (Closed)
Patch Set: Nits Created 4 years, 3 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/fxedit/fxet_edit.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 21 matching lines...) Expand all
32 32
33 CBA_FontMap::~CBA_FontMap() {} 33 CBA_FontMap::~CBA_FontMap() {}
34 34
35 void CBA_FontMap::Reset() { 35 void CBA_FontMap::Reset() {
36 Empty(); 36 Empty();
37 m_pDefaultFont = nullptr; 37 m_pDefaultFont = nullptr;
38 m_sDefaultFontName = ""; 38 m_sDefaultFontName = "";
39 } 39 }
40 40
41 void CBA_FontMap::Initialize() { 41 void CBA_FontMap::Initialize() {
42 int32_t nCharset = DEFAULT_CHARSET; 42 int32_t nCharset = FXFONT_DEFAULT_CHARSET;
43 43
44 if (!m_pDefaultFont) { 44 if (!m_pDefaultFont) {
45 m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName); 45 m_pDefaultFont = GetAnnotDefaultFont(m_sDefaultFontName);
46 if (m_pDefaultFont) { 46 if (m_pDefaultFont) {
47 if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) { 47 if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) {
48 nCharset = pSubstFont->m_Charset; 48 nCharset = pSubstFont->m_Charset;
49 } else { 49 } else {
50 if (m_sDefaultFontName == "Wingdings" || 50 if (m_sDefaultFontName == "Wingdings" ||
51 m_sDefaultFontName == "Wingdings2" || 51 m_sDefaultFontName == "Wingdings2" ||
52 m_sDefaultFontName == "Wingdings3" || 52 m_sDefaultFontName == "Wingdings3" ||
53 m_sDefaultFontName == "Webdings") 53 m_sDefaultFontName == "Webdings")
54 nCharset = SYMBOL_CHARSET; 54 nCharset = FXFONT_SYMBOL_CHARSET;
55 else 55 else
56 nCharset = ANSI_CHARSET; 56 nCharset = FXFONT_ANSI_CHARSET;
57 } 57 }
58 AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset); 58 AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
59 AddFontToAnnotDict(m_pDefaultFont, m_sDefaultFontName); 59 AddFontToAnnotDict(m_pDefaultFont, m_sDefaultFontName);
60 } 60 }
61 } 61 }
62 62
63 if (nCharset != ANSI_CHARSET) 63 if (nCharset != FXFONT_ANSI_CHARSET)
64 CPWL_FontMap::Initialize(); 64 CPWL_FontMap::Initialize();
65 } 65 }
66 66
67 void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont, 67 void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
68 const CFX_ByteString& sFontName) { 68 const CFX_ByteString& sFontName) {
69 ASSERT(pFont); 69 ASSERT(pFont);
70 70
71 if (m_pDefaultFont) 71 if (m_pDefaultFont)
72 return; 72 return;
73 73
74 m_pDefaultFont = pFont; 74 m_pDefaultFont = pFont;
75 m_sDefaultFontName = sFontName; 75 m_sDefaultFontName = sFontName;
76 76
77 int32_t nCharset = DEFAULT_CHARSET; 77 int32_t nCharset = FXFONT_DEFAULT_CHARSET;
78 if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) 78 if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont())
79 nCharset = pSubstFont->m_Charset; 79 nCharset = pSubstFont->m_Charset;
80 AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset); 80 AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
81 } 81 }
82 82
83 CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, 83 CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
84 int32_t nCharset) { 84 int32_t nCharset) {
85 if (m_pAnnotDict->GetStringFor("Subtype") != "Widget") 85 if (m_pAnnotDict->GetStringFor("Subtype") != "Widget")
86 return nullptr; 86 return nullptr;
87 87
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; 248 return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr;
249 } 249 }
250 250
251 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { 251 void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) {
252 m_sAPType = sAPType; 252 m_sAPType = sAPType;
253 253
254 Reset(); 254 Reset();
255 Initialize(); 255 Initialize();
256 } 256 }
OLDNEW
« no previous file with comments | « fpdfsdk/cfx_systemhandler.cpp ('k') | fpdfsdk/fxedit/fxet_edit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698