diff options
author | dsinclair <dsinclair@chromium.org> | 2016-03-31 20:34:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-31 20:34:43 -0700 |
commit | df4bc596c64fb848647c670be66a29ea0861b4f4 (patch) | |
tree | 096f18bc5903e45982291daf81424d0d4954d158 /xfa/include/fxfa/xfa_fontmgr.h | |
parent | 64376be4aac4710848b36b823fd98aae75095336 (diff) | |
download | pdfium-df4bc596c64fb848647c670be66a29ea0861b4f4.tar.xz |
Remove IXFA_* interfaces.
This CL removes the IXFA_* interfaces which are:
- Implemented once.
- Not implemented by an fpdfsdk class.
This requires making a few classes visible to fpdfsdk so we can have the
correct instances available instead of the IXFA types.
Review URL: https://codereview.chromium.org/1846993002
Diffstat (limited to 'xfa/include/fxfa/xfa_fontmgr.h')
-rw-r--r-- | xfa/include/fxfa/xfa_fontmgr.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/xfa/include/fxfa/xfa_fontmgr.h b/xfa/include/fxfa/xfa_fontmgr.h new file mode 100644 index 0000000000..082c672805 --- /dev/null +++ b/xfa/include/fxfa/xfa_fontmgr.h @@ -0,0 +1,99 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_INCLUDE_FXFA_XFA_FONTMGR_H_ +#define XFA_INCLUDE_FXFA_XFA_FONTMGR_H_ + +#include <map> + +#include "core/fxcrt/include/fx_ext.h" +#include "core/fxcrt/include/fx_system.h" +#include "xfa/fgas/font/fgas_font.h" +#include "xfa/include/fxfa/fxfa.h" + +class CPDF_Font; + +struct XFA_FONTINFO { + uint32_t dwFontNameHash; + const FX_WCHAR* pPsName; + const FX_WCHAR* pReplaceFont; + uint16_t dwStyles; + uint16_t wCodePage; +}; + +class CXFA_DefFontMgr { + public: + CXFA_DefFontMgr() {} + ~CXFA_DefFontMgr(); + + IFX_Font* GetFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); + IFX_Font* GetDefaultFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); + + protected: + CFX_PtrArray m_CacheFonts; +}; + +class CXFA_PDFFontMgr : public IFX_FontProvider { + public: + CXFA_PDFFontMgr(CXFA_FFDoc* pDoc); + ~CXFA_PDFFontMgr(); + IFX_Font* GetFont(const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + CPDF_Font** pPDFFont, + FX_BOOL bStrictMatch = TRUE); + FX_BOOL GetCharWidth(IFX_Font* pFont, + FX_WCHAR wUnicode, + int32_t& iWidth, + FX_BOOL bCharCode); + CFX_MapPtrToPtr m_FDE2PDFFont; + + protected: + IFX_Font* FindFont(CFX_ByteString strFamilyName, + FX_BOOL bBold, + FX_BOOL bItalic, + CPDF_Font** pPDFFont, + FX_BOOL bStrictMatch = TRUE); + CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, + FX_BOOL bBold, + FX_BOOL bItalic); + FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, + FX_BOOL bBold, + FX_BOOL bItalic, + const CFX_ByteString& bsDRFontName, + FX_BOOL bStrictMatch = TRUE); + + CXFA_FFDoc* m_pDoc; + std::map<CFX_ByteString, IFX_Font*> m_FontMap; +}; + +class CXFA_FontMgr { + public: + CXFA_FontMgr(); + ~CXFA_FontMgr(); + IFX_Font* GetFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF); + void LoadDocFonts(CXFA_FFDoc* hDoc); + void ReleaseDocFonts(CXFA_FFDoc* hDoc); + + void SetDefFontMgr(CXFA_DefFontMgr* pFontMgr); + + protected: + void DelAllMgrMap(); + + CFX_MapPtrToPtr m_PDFFontMgrArray; + CXFA_DefFontMgr* m_pDefFontMgr; + std::map<CFX_ByteString, IFX_Font*> m_FontMap; +}; + +#endif // XFA_INCLUDE_FXFA_XFA_FONTMGR_H_ |