From a44a48043e54eac6126c9a2cfae9e6055ef4a15f Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 21 Sep 2017 10:45:18 -0400 Subject: Move CFGAS_PDFFontMgr to the CXFA_FFDoc This CL removes the map of CXFA_FFDoc -> CFGAS_PDFFontMgr from the CXFA_FontMgr and moves the storage of the PDFFontMgr into the CXFA_FFDoc itself. Change-Id: Ia725ddd94b1ac2c9504bfd6370040ab6ac01e272 Reviewed-on: https://pdfium-review.googlesource.com/14590 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/cxfa_fontmgr.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'xfa/fxfa/cxfa_fontmgr.cpp') diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp index d5ba2ea807..5a11dd5dc0 100644 --- a/xfa/fxfa/cxfa_fontmgr.cpp +++ b/xfa/fxfa/cxfa_fontmgr.cpp @@ -36,9 +36,8 @@ CFX_RetainPtr CXFA_FontMgr::GetFont( return iter->second; WideString wsEnglishName = FGAS_FontNameToEnglishName(wsFontFamily); - auto it = m_PDFFontMgrMap.find(hDoc); - CFGAS_PDFFontMgr* pMgr = - it != m_PDFFontMgrMap.end() ? it->second.get() : nullptr; + + CFGAS_PDFFontMgr* pMgr = hDoc->GetPDFFontMgr(); CPDF_Font* pPDFFont = nullptr; CFX_RetainPtr pFont; if (pMgr) { @@ -62,6 +61,7 @@ CFX_RetainPtr CXFA_FontMgr::GetFont( pFont = m_pDefFontMgr->GetDefaultFont( hDoc->GetApp()->GetFDEFontMgr(), wsFontFamily, dwFontStyles, wCodePage); } + if (pFont) { if (pPDFFont) { pMgr->SetFont(pFont, pPDFFont); @@ -72,16 +72,6 @@ CFX_RetainPtr CXFA_FontMgr::GetFont( return pFont; } -void CXFA_FontMgr::LoadDocFonts(CXFA_FFDoc* hDoc) { - if (!m_PDFFontMgrMap[hDoc]) - m_PDFFontMgrMap[hDoc] = pdfium::MakeUnique( - hDoc->GetPDFDoc(), hDoc->GetApp()->GetFDEFontMgr()); -} - -void CXFA_FontMgr::ReleaseDocFonts(CXFA_FFDoc* hDoc) { - m_PDFFontMgrMap.erase(hDoc); -} - void CXFA_FontMgr::SetDefFontMgr( std::unique_ptr pFontMgr) { m_pDefFontMgr = std::move(pFontMgr); -- cgit v1.2.3