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

Side by Side Diff: xfa/fxfa/app/xfa_fontmgr.cpp

Issue 2494883002: Remove IFGAS_FontMgr and clean up (the renamed) CFGAS_FontMgr a little. (Closed)
Patch Set: Nits Created 4 years, 1 month 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 | « xfa/fxfa/app/xfa_ffapp.cpp ('k') | xfa/fxfa/app/xfa_textlayout.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 "xfa/fxfa/xfa_fontmgr.h" 7 #include "xfa/fxfa/xfa_fontmgr.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 CXFA_DefFontMgr::~CXFA_DefFontMgr() { 1742 CXFA_DefFontMgr::~CXFA_DefFontMgr() {
1743 for (int32_t i = 0; i < m_CacheFonts.GetSize(); i++) 1743 for (int32_t i = 0; i < m_CacheFonts.GetSize(); i++)
1744 m_CacheFonts[i]->Release(); 1744 m_CacheFonts[i]->Release();
1745 } 1745 }
1746 1746
1747 CFGAS_GEFont* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, 1747 CFGAS_GEFont* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc,
1748 const CFX_WideStringC& wsFontFamily, 1748 const CFX_WideStringC& wsFontFamily,
1749 uint32_t dwFontStyles, 1749 uint32_t dwFontStyles,
1750 uint16_t wCodePage) { 1750 uint16_t wCodePage) {
1751 CFX_WideString wsFontName(wsFontFamily); 1751 CFX_WideString wsFontName(wsFontFamily);
1752 IFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); 1752 CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
1753 CFGAS_GEFont* pFont = 1753 CFGAS_GEFont* pFont =
1754 pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage); 1754 pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage);
1755 if (!pFont) { 1755 if (!pFont) {
1756 const XFA_FONTINFO* pCurFont = 1756 const XFA_FONTINFO* pCurFont =
1757 XFA_GetFontINFOByFontName(wsFontName.AsStringC()); 1757 XFA_GetFontINFOByFontName(wsFontName.AsStringC());
1758 if (pCurFont && pCurFont->pReplaceFont) { 1758 if (pCurFont && pCurFont->pReplaceFont) {
1759 uint32_t dwStyle = 0; 1759 uint32_t dwStyle = 0;
1760 if (dwFontStyles & FX_FONTSTYLE_Bold) { 1760 if (dwFontStyles & FX_FONTSTYLE_Bold) {
1761 dwStyle |= FX_FONTSTYLE_Bold; 1761 dwStyle |= FX_FONTSTYLE_Bold;
1762 } 1762 }
(...skipping 23 matching lines...) Expand all
1786 if (pFont) 1786 if (pFont)
1787 m_CacheFonts.Add(pFont); 1787 m_CacheFonts.Add(pFont);
1788 return pFont; 1788 return pFont;
1789 } 1789 }
1790 1790
1791 CFGAS_GEFont* CXFA_DefFontMgr::GetDefaultFont( 1791 CFGAS_GEFont* CXFA_DefFontMgr::GetDefaultFont(
1792 CXFA_FFDoc* hDoc, 1792 CXFA_FFDoc* hDoc,
1793 const CFX_WideStringC& wsFontFamily, 1793 const CFX_WideStringC& wsFontFamily,
1794 uint32_t dwFontStyles, 1794 uint32_t dwFontStyles,
1795 uint16_t wCodePage) { 1795 uint16_t wCodePage) {
1796 IFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); 1796 CFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr();
1797 CFGAS_GEFont* pFont = 1797 CFGAS_GEFont* pFont =
1798 pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); 1798 pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage);
1799 if (!pFont) { 1799 if (!pFont) {
1800 pFont = pFDEFontMgr->LoadFont(static_cast<const FX_WCHAR*>(nullptr), 1800 pFont = pFDEFontMgr->LoadFont(static_cast<const FX_WCHAR*>(nullptr),
1801 dwFontStyles, wCodePage); 1801 dwFontStyles, wCodePage);
1802 } 1802 }
1803 1803
1804 ASSERT(pFont); 1804 ASSERT(pFont);
1805 if (pFont) 1805 if (pFont)
1806 m_CacheFonts.Add(pFont); 1806 m_CacheFonts.Add(pFont);
(...skipping 22 matching lines...) Expand all
1829 pDoc->GetRoot()->GetDictFor("AcroForm")->GetDictFor("DR"); 1829 pDoc->GetRoot()->GetDictFor("AcroForm")->GetDictFor("DR");
1830 if (!pFontSetDict) { 1830 if (!pFontSetDict) {
1831 return nullptr; 1831 return nullptr;
1832 } 1832 }
1833 pFontSetDict = pFontSetDict->GetDictFor("Font"); 1833 pFontSetDict = pFontSetDict->GetDictFor("Font");
1834 if (!pFontSetDict) { 1834 if (!pFontSetDict) {
1835 return nullptr; 1835 return nullptr;
1836 } 1836 }
1837 CFX_ByteString name = strPsName; 1837 CFX_ByteString name = strPsName;
1838 name.Remove(' '); 1838 name.Remove(' ');
1839 IFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr(); 1839 CFGAS_FontMgr* pFDEFontMgr = m_pDoc->GetApp()->GetFDEFontMgr();
1840 for (const auto& it : *pFontSetDict) { 1840 for (const auto& it : *pFontSetDict) {
1841 const CFX_ByteString& key = it.first; 1841 const CFX_ByteString& key = it.first;
1842 CPDF_Object* pObj = it.second; 1842 CPDF_Object* pObj = it.second;
1843 if (!PsNameMatchDRFontName(name.AsStringC(), bBold, bItalic, key, 1843 if (!PsNameMatchDRFontName(name.AsStringC(), bBold, bItalic, key,
1844 bStrictMatch)) { 1844 bStrictMatch)) {
1845 continue; 1845 continue;
1846 } 1846 }
1847 CPDF_Dictionary* pFontDict = ToDictionary(pObj->GetDirect()); 1847 CPDF_Dictionary* pFontDict = ToDictionary(pObj->GetDirect());
1848 if (!pFontDict || pFontDict->GetStringFor("Type") != "Font") { 1848 if (!pFontDict || pFontDict->GetStringFor("Type") != "Font") {
1849 return nullptr; 1849 return nullptr;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc)); 2050 m_PDFFontMgrMap[hDoc].reset(new CXFA_PDFFontMgr(hDoc));
2051 } 2051 }
2052 2052
2053 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { 2053 void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) {
2054 m_PDFFontMgrMap.erase(hDoc); 2054 m_PDFFontMgrMap.erase(hDoc);
2055 } 2055 }
2056 2056
2057 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { 2057 void CXFA_FontMgr::SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) {
2058 m_pDefFontMgr = std::move(pFontMgr); 2058 m_pDefFontMgr = std::move(pFontMgr);
2059 } 2059 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffapp.cpp ('k') | xfa/fxfa/app/xfa_textlayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698