diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-09-26 12:02:16 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-26 17:30:44 +0000 |
commit | 81f02f4c8347890ce66d6ec48781589d10098689 (patch) | |
tree | 6e085c69e5a5addf964014fb63b42d1d8c7a36fa /xfa/fgas/font/cfgas_fontmgr.h | |
parent | 15dffdf6bd8d595193cfb072974a8efeb8052a91 (diff) | |
download | pdfium-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/fgas/font/cfgas_fontmgr.h')
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 9424cd9657..d0d73bb688 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -83,9 +83,7 @@ FX_LPEnumAllFonts FX_GetDefFontEnumerator(); class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { public: - static std::unique_ptr<CFGAS_FontMgr> Create(FX_LPEnumAllFonts pEnumerator); - - explicit CFGAS_FontMgr(FX_LPEnumAllFonts pEnumerator); + CFGAS_FontMgr(); ~CFGAS_FontMgr(); RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage, @@ -99,6 +97,8 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { uint16_t wCodePage); void RemoveFont(const RetainPtr<CFGAS_GEFont>& pFont); + bool EnumFonts() { return true; } + private: RetainPtr<CFGAS_GEFont> LoadFont(const RetainPtr<CFGAS_GEFont>& pSrcFont, uint32_t dwFontStyles, @@ -181,10 +181,7 @@ class CFX_FontSourceEnum_File { class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { public: - static std::unique_ptr<CFGAS_FontMgr> Create( - CFX_FontSourceEnum_File* pFontEnum); - - explicit CFGAS_FontMgr(CFX_FontSourceEnum_File* pFontEnum); + CFGAS_FontMgr(); ~CFGAS_FontMgr(); RetainPtr<CFGAS_GEFont> GetFontByCodePage(uint16_t wCodePage, @@ -198,8 +195,9 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { uint16_t wCodePage); void RemoveFont(const RetainPtr<CFGAS_GEFont>& pFont); - private: bool EnumFonts(); + + private: bool EnumFontsFromFontMapper(); bool EnumFontsFromFiles(); void RegisterFace(FXFT_Face pFace, const WideString* pFaceName); @@ -234,7 +232,7 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { RetainPtr<IFX_SeekableReadStream> CreateFontStream( const ByteString& bsFaceName); - CFX_FontSourceEnum_File* const m_pFontSource; + std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource; std::vector<std::unique_ptr<CFX_FontDescriptor>> m_InstalledFonts; std::map<uint32_t, std::unique_ptr<std::vector<CFX_FontDescriptorInfo>>> m_Hash2CandidateList; |