From a4fdfc5ed0e8d2e6acc52cc34eac42c6072f0ccc Mon Sep 17 00:00:00 2001 From: thestig Date: Tue, 7 Jun 2016 17:33:37 -0700 Subject: Replace IFGAS_Font with underlying concrete type Review-Url: https://codereview.chromium.org/2037563002 --- xfa/fxfa/app/xfa_fontmgr.cpp | 56 +++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 27 deletions(-) (limited to 'xfa/fxfa/app/xfa_fontmgr.cpp') diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index ed93b16ad2..964c0352b8 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -12,6 +12,7 @@ #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "xfa/fgas/font/fgas_gefont.h" #include "xfa/fxfa/include/xfa_ffapp.h" #include "xfa/fxfa/include/xfa_ffdoc.h" @@ -1742,13 +1743,13 @@ CXFA_DefFontMgr::~CXFA_DefFontMgr() { m_CacheFonts[i]->Release(); } -IFGAS_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +CFGAS_GEFont* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { CFX_WideString wsFontName(wsFontFamily); IFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); - IFGAS_Font* pFont = + CFGAS_GEFont* pFont = pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage); if (!pFont) { const XFA_FONTINFO* pCurFont = @@ -1787,12 +1788,13 @@ IFGAS_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, return pFont; } -IFGAS_Font* CXFA_DefFontMgr::GetDefaultFont(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +CFGAS_GEFont* CXFA_DefFontMgr::GetDefaultFont( + CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { IFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); - IFGAS_Font* pFont = + CFGAS_GEFont* pFont = pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); if (!pFont) pFont = @@ -1824,11 +1826,11 @@ CXFA_PDFFontMgr::~CXFA_PDFFontMgr() { pair.second->Release(); } } -IFGAS_Font* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName, - FX_BOOL bBold, - FX_BOOL bItalic, - CPDF_Font** pDstPDFFont, - FX_BOOL bStrictMatch) { +CFGAS_GEFont* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName, + FX_BOOL bBold, + FX_BOOL bItalic, + CPDF_Font** pDstPDFFont, + FX_BOOL bStrictMatch) { CPDF_Document* pDoc = m_pDoc->GetPDFDoc(); if (pDoc == NULL) { return NULL; @@ -1867,15 +1869,15 @@ IFGAS_Font* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName, *pDstPDFFont = pPDFFont; return NULL; } - return IFGAS_Font::LoadFont(&pPDFFont->m_Font, pFDEFontMgr); + return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, pFDEFontMgr, FALSE); } return NULL; } -IFGAS_Font* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - CPDF_Font** pPDFFont, - FX_BOOL bStrictMatch) { +CFGAS_GEFont* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + CPDF_Font** pPDFFont, + FX_BOOL bStrictMatch) { uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false); CFX_ByteString strKey; strKey.Format("%u%u", dwHashCode, dwFontStyles); @@ -1887,7 +1889,7 @@ IFGAS_Font* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, FX_BOOL bBold = (dwFontStyles & FX_FONTSTYLE_Bold) == FX_FONTSTYLE_Bold; FX_BOOL bItalic = (dwFontStyles & FX_FONTSTYLE_Italic) == FX_FONTSTYLE_Italic; CFX_ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic); - IFGAS_Font* pFont = + CFGAS_GEFont* pFont = FindFont(strFontName, bBold, bItalic, pPDFFont, bStrictMatch); if (pFont) m_FontMap[strKey] = pFont; @@ -1982,7 +1984,7 @@ FX_BOOL CXFA_PDFFontMgr::PsNameMatchDRFontName( } return TRUE; } -FX_BOOL CXFA_PDFFontMgr::GetCharWidth(IFGAS_Font* pFont, +FX_BOOL CXFA_PDFFontMgr::GetCharWidth(CFGAS_GEFont* pFont, FX_WCHAR wUnicode, int32_t& iWidth, FX_BOOL bCharCode) { @@ -2002,10 +2004,10 @@ CXFA_FontMgr::CXFA_FontMgr() {} CXFA_FontMgr::~CXFA_FontMgr() {} -IFGAS_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +CFGAS_GEFont* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false); CFX_ByteString bsKey; bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage); @@ -2018,7 +2020,7 @@ IFGAS_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, CXFA_PDFFontMgr* pMgr = it != m_PDFFontMgrMap.end() ? it->second.get() : nullptr; CPDF_Font* pPDFFont = nullptr; - IFGAS_Font* pFont = nullptr; + CFGAS_GEFont* pFont = nullptr; if (pMgr) { pFont = pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont); if (pFont) -- cgit v1.2.3