summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-02 22:40:06 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-02 22:40:06 +0000
commit0c56d6362b95fe0181be2c2ac66db1c3ab73552b (patch)
tree1f2e8df8e6b6e281405d69e2413a68f338917f50
parent4dbea51fc4bfdcc520dec2b949fd44ec8881cac9 (diff)
downloadpdfium-0c56d6362b95fe0181be2c2ac66db1c3ab73552b.tar.xz
Make CFGAS_DefaultFontManager a class with only static methods.
It has no member variables. Change-Id: I25b333e201d76e90d25e3f526cf23bccd2b4687a Reviewed-on: https://pdfium-review.googlesource.com/c/43315 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--xfa/fgas/font/cfgas_defaultfontmanager.cpp6
-rw-r--r--xfa/fgas/font/cfgas_defaultfontmanager.h16
-rw-r--r--xfa/fxfa/cxfa_ffapp.h3
-rw-r--r--xfa/fxfa/cxfa_fontmgr.cpp12
-rw-r--r--xfa/fxfa/cxfa_fontmgr.h2
5 files changed, 18 insertions, 21 deletions
diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.cpp b/xfa/fgas/font/cfgas_defaultfontmanager.cpp
index fcaf6fdffe..4380c4e4df 100644
--- a/xfa/fgas/font/cfgas_defaultfontmanager.cpp
+++ b/xfa/fgas/font/cfgas_defaultfontmanager.cpp
@@ -9,10 +9,7 @@
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/font/fgas_fontutils.h"
-CFGAS_DefaultFontManager::CFGAS_DefaultFontManager() {}
-
-CFGAS_DefaultFontManager::~CFGAS_DefaultFontManager() {}
-
+// static
RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetFont(
CFGAS_FontMgr* pFontMgr,
const WideStringView& wsFontFamily,
@@ -55,6 +52,7 @@ RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetFont(
return pFont;
}
+// static
RetainPtr<CFGAS_GEFont> CFGAS_DefaultFontManager::GetDefaultFont(
CFGAS_FontMgr* pFontMgr,
const WideStringView& wsFontFamily,
diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.h b/xfa/fgas/font/cfgas_defaultfontmanager.h
index 3d723d5e14..e1b36be386 100644
--- a/xfa/fgas/font/cfgas_defaultfontmanager.h
+++ b/xfa/fgas/font/cfgas_defaultfontmanager.h
@@ -15,15 +15,17 @@ class CFGAS_FontMgr;
class CFGAS_DefaultFontManager {
public:
- CFGAS_DefaultFontManager();
- ~CFGAS_DefaultFontManager();
-
- RetainPtr<CFGAS_GEFont> GetFont(CFGAS_FontMgr* pFontMgr,
- const WideStringView& wsFontFamily,
- uint32_t dwFontStyles);
- RetainPtr<CFGAS_GEFont> GetDefaultFont(CFGAS_FontMgr* pFontMgr,
+ static RetainPtr<CFGAS_GEFont> GetFont(CFGAS_FontMgr* pFontMgr,
const WideStringView& wsFontFamily,
uint32_t dwFontStyles);
+ static RetainPtr<CFGAS_GEFont> GetDefaultFont(
+ CFGAS_FontMgr* pFontMgr,
+ const WideStringView& wsFontFamily,
+ uint32_t dwFontStyles);
+
+ CFGAS_DefaultFontManager() = delete;
+ CFGAS_DefaultFontManager(const CFGAS_DefaultFontManager&) = delete;
+ CFGAS_DefaultFontManager& operator=(const CFGAS_DefaultFontManager&) = delete;
};
#endif // XFA_FGAS_FONT_CFGAS_DEFAULTFONTMANAGER_H_
diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h
index a729560e9b..4a93780657 100644
--- a/xfa/fxfa/cxfa_ffapp.h
+++ b/xfa/fxfa/cxfa_ffapp.h
@@ -17,7 +17,6 @@
#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/fxfa.h"
-class CFGAS_DefaultFontManager;
class CFGAS_FontMgr;
class CFWL_WidgetMgr;
class CPDF_Document;
@@ -33,8 +32,6 @@ class CXFA_FFApp {
explicit CXFA_FFApp(IXFA_AppProvider* pProvider);
~CXFA_FFApp();
- void SetDefaultFontMgr(std::unique_ptr<CFGAS_DefaultFontManager> pFontMgr);
-
CXFA_FWLAdapterWidgetMgr* GetFWLAdapterWidgetMgr();
CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pFWLApp->GetWidgetMgr(); }
diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp
index 7abf720b50..92fe77a52c 100644
--- a/xfa/fxfa/cxfa_fontmgr.cpp
+++ b/xfa/fxfa/cxfa_fontmgr.cpp
@@ -16,6 +16,7 @@
#include "core/fxge/cfx_fontmgr.h"
#include "core/fxge/cfx_gemodule.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fgas/font/cfgas_defaultfontmanager.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fgas/font/fgas_fontutils.h"
#include "xfa/fxfa/cxfa_ffapp.h"
@@ -44,9 +45,10 @@ RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(
if (pFont)
return pFont;
}
- if (!pFont)
- pFont = m_pDefFontMgr.GetFont(hDoc->GetApp()->GetFDEFontMgr(), wsFontFamily,
- dwFontStyles);
+ if (!pFont) {
+ pFont = CFGAS_DefaultFontManager::GetFont(hDoc->GetApp()->GetFDEFontMgr(),
+ wsFontFamily, dwFontStyles);
+ }
if (!pFont && pMgr) {
pFont = pMgr->GetFont(wsEnglishName.AsStringView(), dwFontStyles, false);
@@ -55,8 +57,8 @@ RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(
}
if (!pFont) {
- pFont = m_pDefFontMgr.GetDefaultFont(hDoc->GetApp()->GetFDEFontMgr(),
- wsFontFamily, dwFontStyles);
+ pFont = CFGAS_DefaultFontManager::GetDefaultFont(
+ hDoc->GetApp()->GetFDEFontMgr(), wsFontFamily, dwFontStyles);
}
if (!pFont) {
diff --git a/xfa/fxfa/cxfa_fontmgr.h b/xfa/fxfa/cxfa_fontmgr.h
index c009598e06..082c0641bc 100644
--- a/xfa/fxfa/cxfa_fontmgr.h
+++ b/xfa/fxfa/cxfa_fontmgr.h
@@ -10,7 +10,6 @@
#include <map>
#include "core/fxcrt/fx_string.h"
-#include "xfa/fgas/font/cfgas_defaultfontmanager.h"
class CFGAS_GEFont;
class CXFA_FFDoc;
@@ -25,7 +24,6 @@ class CXFA_FontMgr {
uint32_t dwFontStyles);
private:
- CFGAS_DefaultFontManager m_pDefFontMgr;
std::map<ByteString, RetainPtr<CFGAS_GEFont>> m_FontMap;
};