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