Tidy CFGAS_DefaultFontManager::GetDefaultFont().
-- Remove unused parameter.
-- Use early return.
-- no need to cast nullptr.
Change-Id: Id155301b9ff2283f0eae3c0ec52362cee0b3a03b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/66632
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.cpp b/xfa/fgas/font/cfgas_defaultfontmanager.cpp
index 239dfa7..4115b7b 100644
--- a/xfa/fgas/font/cfgas_defaultfontmanager.cpp
+++ b/xfa/fgas/font/cfgas_defaultfontmanager.cpp
@@ -57,13 +57,11 @@
// static
RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetDefaultFont(
CFGAS_FontMgr* pFontMgr,
- WideStringView wsFontFamily,
uint32_t dwFontStyles) {
RetainPtr<CFGAS_GEFont> pFont =
pFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, 0xFFFF);
- if (!pFont) {
- pFont = pFontMgr->LoadFont(static_cast<const wchar_t*>(nullptr),
- dwFontStyles, 0xFFFF);
- }
- return pFont;
+ if (pFont)
+ return pFont;
+
+ return pFontMgr->LoadFont(nullptr, dwFontStyles, 0xFFFF);
}
diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.h b/xfa/fgas/font/cfgas_defaultfontmanager.h
index ebf2f3c..32fb372 100644
--- a/xfa/fgas/font/cfgas_defaultfontmanager.h
+++ b/xfa/fgas/font/cfgas_defaultfontmanager.h
@@ -19,7 +19,6 @@
WideStringView wsFontFamily,
uint32_t dwFontStyles);
static RetainPtr<CFGAS_GEFont> GetDefaultFont(CFGAS_FontMgr* pFontMgr,
- WideStringView wsFontFamily,
uint32_t dwFontStyles);
CFGAS_DefaultFontManager() = delete;
diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp
index 7259f6cf..b3bbd82 100644
--- a/xfa/fxfa/cxfa_fontmgr.cpp
+++ b/xfa/fxfa/cxfa_fontmgr.cpp
@@ -52,7 +52,7 @@
}
if (!pFont) {
pFont = CFGAS_DefaultFontManager::GetDefaultFont(
- hDoc->GetApp()->GetFDEFontMgr(), wsFontFamily, dwFontStyles);
+ hDoc->GetApp()->GetFDEFontMgr(), dwFontStyles);
}
if (!pFont) {
pFont = CFGAS_GEFont::LoadStockFont(