diff options
author | Nicolas Pena <npm@chromium.org> | 2017-11-16 21:41:47 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-16 21:41:47 +0000 |
commit | 40d522134a11867adb95f77c0b7891932e0739a2 (patch) | |
tree | 07164d786b15348783d10cccc9babb9427ff1abe /xfa/fgas/font/cfgas_fontmgr.h | |
parent | 3f9549e7f00b649471c4d658bbfb6bf031b8f53e (diff) | |
download | pdfium-40d522134a11867adb95f77c0b7891932e0739a2.tar.xz |
Refactor CFGAS_FontMgr's Windows implementation
This CL unifies a bit the public methods of CFGAS_FontMgr. It does so by
replacing the multiple maps on the Windows implementation to a single
map from hash to font. Also, cloning CFX_Fonts is avoided with the use
of SetLogicalFontStyle. These Windows changes are just mimicking other
OS's. As a side-effect, some members of CFX_Fonts are now owned so the
raw pointers are replaced with unique_ptrs.
Change-Id: I576d438572ccbe6c48f8f5cc434d66fc6adba372
Reviewed-on: https://pdfium-review.googlesource.com/18131
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'xfa/fgas/font/cfgas_fontmgr.h')
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.h | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 351b5d624c..42171de804 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -146,11 +146,6 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { private: #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ - RetainPtr<CFGAS_GEFont> LoadFont(const RetainPtr<CFGAS_GEFont>& pSrcFont, - uint32_t dwFontStyles, - uint16_t wCodePage); - void RemoveFont(std::map<uint32_t, RetainPtr<CFGAS_GEFont>>* pFontMap, - const RetainPtr<CFGAS_GEFont>& pFont); const FX_FONTDESCRIPTOR* FindFont(const wchar_t* pszFontFamily, uint32_t dwFontStyles, bool matchParagraphStyle, @@ -160,13 +155,6 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { FX_LPEnumAllFonts m_pEnumerator; std::deque<FX_FONTDESCRIPTOR> m_FontFaces; - std::vector<RetainPtr<CFGAS_GEFont>> m_Fonts; - std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_CPFonts; - std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_FamilyFonts; - std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_UnicodeFonts; - std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_BufferFonts; - std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_StreamFonts; - std::map<uint32_t, RetainPtr<CFGAS_GEFont>> m_DeriveFonts; #else // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ bool EnumFontsFromFontMapper(); bool EnumFontsFromFiles(); @@ -178,7 +166,6 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); uint32_t GetFlags(FXFT_Face pFace); bool VerifyUnicode(CFX_FontDescriptor* pDesc, wchar_t wcUnicode); - bool VerifyUnicode(const RetainPtr<CFGAS_GEFont>& pFont, wchar_t wcUnicode); int32_t IsPartName(const WideString& Name1, const WideString& Name2); void MatchFonts(std::vector<CFX_FontDescriptorInfo>* MatchedFonts, uint16_t wCodePage, @@ -206,11 +193,14 @@ class CFGAS_FontMgr : public Observable<CFGAS_FontMgr> { std::vector<std::unique_ptr<CFX_FontDescriptor>> m_InstalledFonts; std::map<uint32_t, std::unique_ptr<std::vector<CFX_FontDescriptorInfo>>> m_Hash2CandidateList; - std::map<uint32_t, std::vector<RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts; std::map<RetainPtr<CFGAS_GEFont>, RetainPtr<IFX_SeekableReadStream>> m_IFXFont2FileRead; std::set<wchar_t> m_FailedUnicodesSet; #endif // _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ + + bool VerifyUnicode(const RetainPtr<CFGAS_GEFont>& pFont, wchar_t wcUnicode); + + std::map<uint32_t, std::vector<RetainPtr<CFGAS_GEFont>>> m_Hash2Fonts; }; #endif // XFA_FGAS_FONT_CFGAS_FONTMGR_H_ |