| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef XFA_INCLUDE_FXFA_XFA_FONTMGR_H_ | |
| 8 #define XFA_INCLUDE_FXFA_XFA_FONTMGR_H_ | |
| 9 | |
| 10 #include <map> | |
| 11 | |
| 12 #include "core/fxcrt/include/fx_ext.h" | |
| 13 #include "core/fxcrt/include/fx_system.h" | |
| 14 #include "xfa/fgas/font/fgas_font.h" | |
| 15 #include "xfa/include/fxfa/fxfa.h" | |
| 16 | |
| 17 class CPDF_Font; | |
| 18 | |
| 19 struct XFA_FONTINFO { | |
| 20 uint32_t dwFontNameHash; | |
| 21 const FX_WCHAR* pPsName; | |
| 22 const FX_WCHAR* pReplaceFont; | |
| 23 uint16_t dwStyles; | |
| 24 uint16_t wCodePage; | |
| 25 }; | |
| 26 | |
| 27 class CXFA_DefFontMgr { | |
| 28 public: | |
| 29 CXFA_DefFontMgr() {} | |
| 30 ~CXFA_DefFontMgr(); | |
| 31 | |
| 32 IFX_Font* GetFont(CXFA_FFDoc* hDoc, | |
| 33 const CFX_WideStringC& wsFontFamily, | |
| 34 uint32_t dwFontStyles, | |
| 35 uint16_t wCodePage = 0xFFFF); | |
| 36 IFX_Font* GetDefaultFont(CXFA_FFDoc* hDoc, | |
| 37 const CFX_WideStringC& wsFontFamily, | |
| 38 uint32_t dwFontStyles, | |
| 39 uint16_t wCodePage = 0xFFFF); | |
| 40 | |
| 41 protected: | |
| 42 CFX_PtrArray m_CacheFonts; | |
| 43 }; | |
| 44 | |
| 45 class CXFA_PDFFontMgr : public IFX_FontProvider { | |
| 46 public: | |
| 47 CXFA_PDFFontMgr(CXFA_FFDoc* pDoc); | |
| 48 ~CXFA_PDFFontMgr(); | |
| 49 IFX_Font* GetFont(const CFX_WideStringC& wsFontFamily, | |
| 50 uint32_t dwFontStyles, | |
| 51 CPDF_Font** pPDFFont, | |
| 52 FX_BOOL bStrictMatch = TRUE); | |
| 53 FX_BOOL GetCharWidth(IFX_Font* pFont, | |
| 54 FX_WCHAR wUnicode, | |
| 55 int32_t& iWidth, | |
| 56 FX_BOOL bCharCode); | |
| 57 CFX_MapPtrToPtr m_FDE2PDFFont; | |
| 58 | |
| 59 protected: | |
| 60 IFX_Font* FindFont(CFX_ByteString strFamilyName, | |
| 61 FX_BOOL bBold, | |
| 62 FX_BOOL bItalic, | |
| 63 CPDF_Font** pPDFFont, | |
| 64 FX_BOOL bStrictMatch = TRUE); | |
| 65 CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, | |
| 66 FX_BOOL bBold, | |
| 67 FX_BOOL bItalic); | |
| 68 FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, | |
| 69 FX_BOOL bBold, | |
| 70 FX_BOOL bItalic, | |
| 71 const CFX_ByteString& bsDRFontName, | |
| 72 FX_BOOL bStrictMatch = TRUE); | |
| 73 | |
| 74 CXFA_FFDoc* m_pDoc; | |
| 75 std::map<CFX_ByteString, IFX_Font*> m_FontMap; | |
| 76 }; | |
| 77 | |
| 78 class CXFA_FontMgr { | |
| 79 public: | |
| 80 CXFA_FontMgr(); | |
| 81 ~CXFA_FontMgr(); | |
| 82 IFX_Font* GetFont(CXFA_FFDoc* hDoc, | |
| 83 const CFX_WideStringC& wsFontFamily, | |
| 84 uint32_t dwFontStyles, | |
| 85 uint16_t wCodePage = 0xFFFF); | |
| 86 void LoadDocFonts(CXFA_FFDoc* hDoc); | |
| 87 void ReleaseDocFonts(CXFA_FFDoc* hDoc); | |
| 88 | |
| 89 void SetDefFontMgr(CXFA_DefFontMgr* pFontMgr); | |
| 90 | |
| 91 protected: | |
| 92 void DelAllMgrMap(); | |
| 93 | |
| 94 CFX_MapPtrToPtr m_PDFFontMgrArray; | |
| 95 CXFA_DefFontMgr* m_pDefFontMgr; | |
| 96 std::map<CFX_ByteString, IFX_Font*> m_FontMap; | |
| 97 }; | |
| 98 | |
| 99 #endif // XFA_INCLUDE_FXFA_XFA_FONTMGR_H_ | |
| OLD | NEW |