From 5037839bb0b91792b81a3e455dead1314fcc7a6d Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 9 Jan 2017 06:54:27 -0800 Subject: Tidy cfgas_fontmgr, remove custom sorting code. Review-Url: https://codereview.chromium.org/2610813010 --- xfa/fgas/font/cfgas_fontmgr.h | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'xfa/fgas/font/cfgas_fontmgr.h') diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index 20efa3296b..303d73404b 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -146,26 +146,22 @@ class CFX_FontDescriptor { uint32_t m_dwCsb[2]; }; -typedef CFX_ArrayTemplate CFX_FontDescriptors; - -struct FX_FontDescriptorInfo { +class CFX_FontDescriptorInfo { public: CFX_FontDescriptor* pFont; int32_t nPenalty; - bool operator>(const FX_FontDescriptorInfo& other) const { + bool operator>(const CFX_FontDescriptorInfo& other) const { return nPenalty > other.nPenalty; } - bool operator<(const FX_FontDescriptorInfo& other) const { + bool operator<(const CFX_FontDescriptorInfo& other) const { return nPenalty < other.nPenalty; } - bool operator==(const FX_FontDescriptorInfo& other) const { + bool operator==(const CFX_FontDescriptorInfo& other) const { return nPenalty == other.nPenalty; } }; -typedef CFX_ArrayTemplate CFX_FontDescriptorInfos; - struct FX_HandleParentPath { FX_HandleParentPath() {} FX_HandleParentPath(const FX_HandleParentPath& x) { @@ -226,11 +222,11 @@ class CFGAS_FontMgr { bool VerifyUnicode(const CFX_RetainPtr& pFont, FX_WCHAR wcUnicode); int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); - int32_t MatchFonts(CFX_FontDescriptorInfos& MatchedFonts, - uint16_t wCodePage, - uint32_t dwFontStyles, - const CFX_WideString& FontName, - FX_WCHAR wcUnicode = 0xFFFE); + void MatchFonts(std::vector* MatchedFonts, + uint16_t wCodePage, + uint32_t dwFontStyles, + const CFX_WideString& FontName, + FX_WCHAR wcUnicode = 0xFFFE); int32_t CalcPenalty(CFX_FontDescriptor* pInstalled, uint16_t wCodePage, uint32_t dwFontStyles, @@ -248,14 +244,14 @@ class CFGAS_FontMgr { CFX_RetainPtr CreateFontStream( const CFX_ByteString& bsFaceName); - CFX_FontDescriptors m_InstalledFonts; - std::map> + CFX_FontSourceEnum_File* const m_pFontSource; + std::vector> m_InstalledFonts; + std::map>> m_Hash2CandidateList; std::map>> m_Hash2Fonts; std::map, CFX_RetainPtr> m_IFXFont2FileRead; std::set m_FailedUnicodesSet; - CFX_FontSourceEnum_File* const m_pFontSource; }; #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -- cgit v1.2.3