summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-09-26 12:02:16 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-26 17:30:44 +0000
commit81f02f4c8347890ce66d6ec48781589d10098689 (patch)
tree6e085c69e5a5addf964014fb63b42d1d8c7a36fa /xfa/fwl
parent15dffdf6bd8d595193cfb072974a8efeb8052a91 (diff)
downloadpdfium-81f02f4c8347890ce66d6ec48781589d10098689.tar.xz
Move font source into CFGAS_FontMgr
This CL moves the font source into the font manager so it doesn't need to be stored by each caller (and removes the platform dependant code). The |EnumFonts| method is exposed on the CFGAS_FontMgr so the caller can clear the manager if the enumeration fails. Change-Id: Iecce3d2e09ff01152b7bb79a34fe2b728320da9c Reviewed-on: https://pdfium-review.googlesource.com/14816 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp10
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.h3
2 files changed, 4 insertions, 9 deletions
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 630da7793d..b2c1c9aa74 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -274,13 +274,11 @@ bool CFWL_FontData::LoadFont(const WideStringView& wsFontFamily,
m_dwStyles = dwFontStyles;
m_dwCodePage = dwCodePage;
if (!m_pFontMgr) {
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- m_pFontMgr = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
-#else
- m_pFontSource = pdfium::MakeUnique<CFX_FontSourceEnum_File>();
- m_pFontMgr = CFGAS_FontMgr::Create(m_pFontSource.get());
-#endif
+ m_pFontMgr = pdfium::MakeUnique<CFGAS_FontMgr>();
+ if (!m_pFontMgr->EnumFonts())
+ m_pFontMgr = nullptr;
}
+
// TODO(tsepez): check usage of c_str() below.
m_pFont = CFGAS_GEFont::LoadFont(wsFontFamily.unterminated_c_str(),
dwFontStyles, dwCodePage, m_pFontMgr.get());
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index eb1423e602..32a48d136d 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -118,9 +118,6 @@ class CFWL_FontData {
WideString m_wsFamily;
uint32_t m_dwStyles;
uint32_t m_dwCodePage;
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource;
-#endif
std::unique_ptr<CFGAS_FontMgr> m_pFontMgr;
RetainPtr<CFGAS_GEFont> m_pFont;
};