diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-27 12:47:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-27 12:47:01 -0700 |
commit | 303e525325904cd9b6a847f48951510e7dd8a45e (patch) | |
tree | dab3ff0e3bda317dc51ef0caf8d15daf88e7e6b8 /xfa/fgas/font | |
parent | 43854a5073602a4613131aa6dbac5f7b9a095bcd (diff) | |
download | pdfium-303e525325904cd9b6a847f48951510e7dd8a45e.tar.xz |
More IFX_ interface cleanup.
Remove IFX_FontProvider, IFX_FontSourceEnum, IFX_SAXReader and
IFX_SAXReaderHandler.
Review-Url: https://codereview.chromium.org/1930533002
Diffstat (limited to 'xfa/fgas/font')
-rw-r--r-- | xfa/fgas/font/fgas_font.h | 23 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_gefont.cpp | 1 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_gefont.h | 6 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.cpp | 20 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.h | 16 |
5 files changed, 28 insertions, 38 deletions
diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h index db964b06ca..406c6f96a8 100644 --- a/xfa/fgas/font/fgas_font.h +++ b/xfa/fgas/font/fgas_font.h @@ -15,6 +15,8 @@ #include "xfa/fgas/crt/fgas_utils.h" #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ +class CFX_FontSourceEnum_File; +class CXFA_PDFFontMgr; class IFX_Font; class IFX_FontMgr; @@ -48,15 +50,6 @@ class IFX_FontMgr; #define FX_BOUNDINGSHAPE_Triangle 3 #define FX_BOUNDINGSHAPE_Diamond 4 -class IFX_FontProvider { - public: - virtual ~IFX_FontProvider() {} - virtual FX_BOOL GetCharWidth(IFX_Font* pFont, - FX_WCHAR wUnicode, - int32_t& iWidth, - FX_BOOL bCharCode = FALSE) = 0; -}; - class IFX_Font { public: static IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, @@ -96,7 +89,7 @@ class IFX_Font { virtual void Reset() = 0; virtual IFX_Font* GetSubstFont(int32_t iGlyphIndex) const = 0; virtual void* GetDevFont() const = 0; - virtual void SetFontProvider(IFX_FontProvider* pProvider) = 0; + virtual void SetFontProvider(CXFA_PDFFontMgr* pProvider) = 0; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ virtual void SetLogicalFontStyle(uint32_t dwLogFontStyle) = 0; #endif @@ -192,17 +185,9 @@ class IFX_FontMgr { #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -class IFX_FontSourceEnum { - public: - virtual ~IFX_FontSourceEnum() {} - virtual void Release() = 0; - virtual FX_POSITION GetStartPosition() = 0; - virtual IFX_FileAccess* GetNext(FX_POSITION& pos) = 0; -}; -IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum(); class IFX_FontMgr { public: - static IFX_FontMgr* Create(IFX_FontSourceEnum* pFontEnum); + static IFX_FontMgr* Create(CFX_FontSourceEnum_File* pFontEnum); virtual ~IFX_FontMgr() {} virtual void Release() = 0; virtual IFX_Font* GetDefFontByCodePage( diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index 7bf877f8c2..495ac7d69d 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -8,6 +8,7 @@ #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/font/fgas_fontutils.h" +#include "xfa/fxfa/include/xfa_fontmgr.h" IFX_Font* IFX_Font::LoadFont(const FX_WCHAR* pszFontFamily, uint32_t dwFontStyles, diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h index 044acdeb7f..43b5c5876e 100644 --- a/xfa/fgas/font/fgas_gefont.h +++ b/xfa/fgas/font/fgas_gefont.h @@ -12,6 +12,8 @@ #define FXFONT_SUBST_ITALIC 0x02 +class CXFA_PDFFontMgr; + class CFX_GEFont : public IFX_Font { public: CFX_GEFont(const CFX_GEFont& src, uint32_t dwFontStyles); @@ -45,7 +47,7 @@ class CFX_GEFont : public IFX_Font { virtual void Reset(); virtual IFX_Font* GetSubstFont(int32_t iGlyphIndex) const; virtual void* GetDevFont() const { return (void*)m_pFont; } - virtual void SetFontProvider(IFX_FontProvider* pProvider) { + virtual void SetFontProvider(CXFA_PDFFontMgr* pProvider) { m_pProvider = pProvider; } #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ @@ -70,7 +72,7 @@ class CFX_GEFont : public IFX_Font { CFX_WordDiscreteArray* m_pCharWidthMap; CFX_RectMassArray* m_pRectArray; CFX_MapPtrToPtr* m_pBBoxMap; - IFX_FontProvider* m_pProvider; + CXFA_PDFFontMgr* m_pProvider; uint16_t m_wCharSet; CFX_PtrArray m_SubstFonts; CFX_MapPtrToPtr m_FontMapper; diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index dedc8b0ad2..a3964d2bb8 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -555,21 +555,19 @@ IFX_FileAccess* CFX_FontSourceEnum_File::GetNext(FX_POSITION& pos) { pos = 0 != m_wsNext.GetLength() ? pAccess : NULL; return (IFX_FileAccess*)pAccess; } -IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum() { - return (IFX_FontSourceEnum*)new CFX_FontSourceEnum_File; -} -IFX_FontMgr* IFX_FontMgr::Create(IFX_FontSourceEnum* pFontEnum) { - if (NULL == pFontEnum) { - return NULL; - } + +IFX_FontMgr* IFX_FontMgr::Create(CFX_FontSourceEnum_File* pFontEnum) { + if (!pFontEnum) + return nullptr; + CFX_FontMgrImp* pFontMgr = new CFX_FontMgrImp(pFontEnum); - if (pFontMgr->EnumFonts()) { + if (pFontMgr->EnumFonts()) return pFontMgr; - } + delete pFontMgr; - return NULL; + return nullptr; } -CFX_FontMgrImp::CFX_FontMgrImp(IFX_FontSourceEnum* pFontEnum) +CFX_FontMgrImp::CFX_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum) : m_pFontSource(pFontEnum) {} FX_BOOL CFX_FontMgrImp::EnumFontsFromFontMapper() { diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index 6b1f9c8a8f..cc11517e34 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -126,19 +126,22 @@ struct FX_HandleParentPath { CFX_ByteString bsParentPath; }; -class CFX_FontSourceEnum_File : public IFX_FontSourceEnum { +class CFX_FontSourceEnum_File { public: CFX_FontSourceEnum_File(); - virtual void Release() { delete this; } - virtual FX_POSITION GetStartPosition(); - virtual IFX_FileAccess* GetNext(FX_POSITION& pos); + + void Release() { delete this; } + FX_POSITION GetStartPosition(); + IFX_FileAccess* GetNext(FX_POSITION& pos); private: CFX_ByteString GetNextFile(); + CFX_WideString m_wsNext; CFX_ObjectArray<FX_HandleParentPath> m_FolderQueue; CFX_ByteStringArray m_FolderPaths; }; + typedef CFX_MapPtrTemplate<uint32_t, IFX_FileAccess*> CFX_HashFileMap; typedef CFX_MapPtrTemplate<uint32_t, IFX_Font*> CFX_HashFontMap; typedef CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> @@ -152,7 +155,8 @@ typedef CFX_MapPtrTemplate<IFX_Font*, IFX_FileRead*> CFX_FonStreamtMap; class CFX_FontMgrImp : public IFX_FontMgr { public: - CFX_FontMgrImp(IFX_FontSourceEnum* pFontEnum); + CFX_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum); + virtual void Release(); virtual IFX_Font* GetDefFontByCodePage(uint16_t wCodePage, uint32_t dwFontStyles, @@ -239,7 +243,7 @@ class CFX_FontMgrImp : public IFX_FontMgr { CFX_HashFontMap m_FileAccess2IFXFont; CFX_FonStreamtMap m_IFXFont2FileRead; CFX_UnicodeFontMap m_FailedUnicodes2NULL; - IFX_FontSourceEnum* m_pFontSource; + CFX_FontSourceEnum_File* m_pFontSource; }; #endif |