From 1a43b3064dc38a55de4b1d727237806578bb3ef9 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 26 Sep 2017 11:09:35 -0400 Subject: Remove font default params This CL removes some default parameters from the font code. Change-Id: If6f6e09c93474e1e8b7ffaae53eb37dd40c32fab Reviewed-on: https://pdfium-review.googlesource.com/14815 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fgas/font/cfgas_defaultfontmanager.cpp | 14 ++++++-------- xfa/fgas/font/cfgas_defaultfontmanager.h | 6 ++---- xfa/fgas/font/cfgas_fontmgr.cpp | 10 +++++----- xfa/fgas/font/cfgas_fontmgr.h | 4 ++-- xfa/fxfa/cxfa_fontmgr.cpp | 11 +++++------ xfa/fxfa/cxfa_fontmgr.h | 3 +-- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.cpp b/xfa/fgas/font/cfgas_defaultfontmanager.cpp index d3864be16a..4b9091f690 100644 --- a/xfa/fgas/font/cfgas_defaultfontmanager.cpp +++ b/xfa/fgas/font/cfgas_defaultfontmanager.cpp @@ -15,11 +15,10 @@ CFGAS_DefaultFontManager::~CFGAS_DefaultFontManager() {} RetainPtr CFGAS_DefaultFontManager::GetFont( CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { + uint32_t dwFontStyles) { WideString wsFontName(wsFontFamily); RetainPtr pFont = - pFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage); + pFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, 0xFFFF); if (!pFont) { const FGAS_FontInfo* pCurFont = FGAS_FontInfoByFontName(wsFontName.AsStringView()); @@ -39,7 +38,7 @@ RetainPtr CFGAS_DefaultFontManager::GetFont( iLength--; } WideString wsReplace = WideString(pReplace, pNameText - pReplace); - pFont = pFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage); + pFont = pFontMgr->LoadFont(wsReplace.c_str(), dwStyle, 0xFFFF); if (pFont) break; @@ -57,13 +56,12 @@ RetainPtr CFGAS_DefaultFontManager::GetFont( RetainPtr CFGAS_DefaultFontManager::GetDefaultFont( CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { + uint32_t dwFontStyles) { RetainPtr pFont = - pFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); + pFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, 0xFFFF); if (!pFont) { pFont = pFontMgr->LoadFont(static_cast(nullptr), - dwFontStyles, wCodePage); + dwFontStyles, 0xFFFF); } if (pFont) m_CacheFonts.push_back(pFont); diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.h b/xfa/fgas/font/cfgas_defaultfontmanager.h index 4e2e5e10d4..2afe9ebc54 100644 --- a/xfa/fgas/font/cfgas_defaultfontmanager.h +++ b/xfa/fgas/font/cfgas_defaultfontmanager.h @@ -20,12 +20,10 @@ class CFGAS_DefaultFontManager { RetainPtr GetFont(CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); + uint32_t dwFontStyles); RetainPtr GetDefaultFont(CFGAS_FontMgr* pFontMgr, const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); + uint32_t dwFontStyles); private: std::vector> m_CacheFonts; diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index da1763214b..2175a23288 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -207,11 +207,11 @@ RetainPtr CFGAS_FontMgr::GetFontByCodePage( return it->second ? LoadFont(it->second, dwFontStyles, wCodePage) : nullptr; } const FX_FONTDESCRIPTOR* pFD = - FindFont(pszFontFamily, dwFontStyles, true, wCodePage); + FindFont(pszFontFamily, dwFontStyles, true, wCodePage, 999, 0); if (!pFD) - pFD = FindFont(nullptr, dwFontStyles, true, wCodePage); + pFD = FindFont(nullptr, dwFontStyles, true, wCodePage, 999, 0); if (!pFD) - pFD = FindFont(nullptr, dwFontStyles, false, wCodePage); + pFD = FindFont(nullptr, dwFontStyles, false, wCodePage, 999, 0); if (!pFD) return nullptr; @@ -276,9 +276,9 @@ RetainPtr CFGAS_FontMgr::LoadFont(const wchar_t* pszFontFamily, return it->second ? LoadFont(it->second, dwFontStyles, wCodePage) : nullptr; const FX_FONTDESCRIPTOR* pFD = - FindFont(pszFontFamily, dwFontStyles, true, wCodePage); + FindFont(pszFontFamily, dwFontStyles, true, wCodePage, 999, 0); if (!pFD) - pFD = FindFont(pszFontFamily, dwFontStyles, false, wCodePage); + pFD = FindFont(pszFontFamily, dwFontStyles, false, wCodePage, 999, 0); if (!pFD) return nullptr; diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 0bcee12e4d..9424cd9657 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -109,8 +109,8 @@ class CFGAS_FontMgr : public Observable { uint32_t dwFontStyles, uint32_t dwMatchFlags, uint16_t wCodePage, - uint32_t dwUSB = 999, - wchar_t wUnicode = 0); + uint32_t dwUSB, + wchar_t wUnicode); FX_LPEnumAllFonts m_pEnumerator; std::deque m_FontFaces; diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp index ddf8ffada4..d144bd2cb5 100644 --- a/xfa/fxfa/cxfa_fontmgr.cpp +++ b/xfa/fxfa/cxfa_fontmgr.cpp @@ -26,11 +26,10 @@ CXFA_FontMgr::~CXFA_FontMgr() {} RetainPtr CXFA_FontMgr::GetFont( CXFA_FFDoc* hDoc, const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { + uint32_t dwFontStyles) { uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false); ByteString bsKey; - bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage); + bsKey.Format("%u%u%u", dwHash, dwFontStyles, 0xFFFF); auto iter = m_FontMap.find(bsKey); if (iter != m_FontMap.end()) return iter->second; @@ -48,7 +47,7 @@ RetainPtr CXFA_FontMgr::GetFont( } if (!pFont && m_pDefFontMgr) pFont = m_pDefFontMgr->GetFont(hDoc->GetApp()->GetFDEFontMgr(), - wsFontFamily, dwFontStyles, wCodePage); + wsFontFamily, dwFontStyles); if (!pFont && pMgr) { pPDFFont = nullptr; @@ -58,8 +57,8 @@ RetainPtr CXFA_FontMgr::GetFont( return pFont; } if (!pFont && m_pDefFontMgr) { - pFont = m_pDefFontMgr->GetDefaultFont( - hDoc->GetApp()->GetFDEFontMgr(), wsFontFamily, dwFontStyles, wCodePage); + pFont = m_pDefFontMgr->GetDefaultFont(hDoc->GetApp()->GetFDEFontMgr(), + wsFontFamily, dwFontStyles); } if (pFont) { diff --git a/xfa/fxfa/cxfa_fontmgr.h b/xfa/fxfa/cxfa_fontmgr.h index 55ee6bbc4d..a940fafc46 100644 --- a/xfa/fxfa/cxfa_fontmgr.h +++ b/xfa/fxfa/cxfa_fontmgr.h @@ -28,8 +28,7 @@ class CXFA_FontMgr { RetainPtr GetFont(CXFA_FFDoc* hDoc, const WideStringView& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF); + uint32_t dwFontStyles); void SetDefFontMgr(std::unique_ptr pFontMgr); private: -- cgit v1.2.3