| 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_INCLUDE_XFA_FONTMGR_H_ | 7 #ifndef XFA_FXFA_INCLUDE_XFA_FONTMGR_H_ |
| 8 #define XFA_FXFA_INCLUDE_XFA_FONTMGR_H_ | 8 #define XFA_FXFA_INCLUDE_XFA_FONTMGR_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 class CXFA_PDFFontMgr { | 46 class CXFA_PDFFontMgr { |
| 47 public: | 47 public: |
| 48 explicit CXFA_PDFFontMgr(CXFA_FFDoc* pDoc); | 48 explicit CXFA_PDFFontMgr(CXFA_FFDoc* pDoc); |
| 49 ~CXFA_PDFFontMgr(); | 49 ~CXFA_PDFFontMgr(); |
| 50 | 50 |
| 51 CFGAS_GEFont* GetFont(const CFX_WideStringC& wsFontFamily, | 51 CFGAS_GEFont* GetFont(const CFX_WideStringC& wsFontFamily, |
| 52 uint32_t dwFontStyles, | 52 uint32_t dwFontStyles, |
| 53 CPDF_Font** pPDFFont, | 53 CPDF_Font** pPDFFont, |
| 54 FX_BOOL bStrictMatch = TRUE); | 54 bool bStrictMatch); |
| 55 FX_BOOL GetCharWidth(CFGAS_GEFont* pFont, | 55 bool GetCharWidth(const CFGAS_GEFont* pFont, |
| 56 FX_WCHAR wUnicode, | 56 FX_WCHAR wUnicode, |
| 57 int32_t& iWidth, | 57 bool bCharCode, |
| 58 FX_BOOL bCharCode); | 58 int32_t* pWidth); |
| 59 std::map<CFGAS_GEFont*, CPDF_Font*> m_FDE2PDFFont; | 59 void SetFont(const CFGAS_GEFont* pFont, CPDF_Font* pPDFFont); |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 CFGAS_GEFont* FindFont(CFX_ByteString strFamilyName, | 62 CFGAS_GEFont* FindFont(const CFX_ByteString& strFamilyName, |
| 63 FX_BOOL bBold, | 63 bool bBold, |
| 64 FX_BOOL bItalic, | 64 bool bItalic, |
| 65 CPDF_Font** pPDFFont, | 65 CPDF_Font** pPDFFont, |
| 66 FX_BOOL bStrictMatch = TRUE); | 66 bool bStrictMatch); |
| 67 CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, | 67 CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, |
| 68 FX_BOOL bBold, | 68 bool bBold, |
| 69 FX_BOOL bItalic); | 69 bool bItalic); |
| 70 FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, | 70 bool PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, |
| 71 FX_BOOL bBold, | 71 bool bBold, |
| 72 FX_BOOL bItalic, | 72 bool bItalic, |
| 73 const CFX_ByteString& bsDRFontName, | 73 const CFX_ByteString& bsDRFontName, |
| 74 FX_BOOL bStrictMatch = TRUE); | 74 bool bStrictMatch); |
| 75 | 75 |
| 76 CXFA_FFDoc* m_pDoc; | 76 CXFA_FFDoc* const m_pDoc; |
| 77 std::map<const CFGAS_GEFont*, CPDF_Font*> m_FDE2PDFFont; |
| 77 std::map<CFX_ByteString, CFGAS_GEFont*> m_FontMap; | 78 std::map<CFX_ByteString, CFGAS_GEFont*> m_FontMap; |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 class CXFA_FontMgr { | 81 class CXFA_FontMgr { |
| 81 public: | 82 public: |
| 82 CXFA_FontMgr(); | 83 CXFA_FontMgr(); |
| 83 ~CXFA_FontMgr(); | 84 ~CXFA_FontMgr(); |
| 84 | 85 |
| 85 CFGAS_GEFont* GetFont(CXFA_FFDoc* hDoc, | 86 CFGAS_GEFont* GetFont(CXFA_FFDoc* hDoc, |
| 86 const CFX_WideStringC& wsFontFamily, | 87 const CFX_WideStringC& wsFontFamily, |
| 87 uint32_t dwFontStyles, | 88 uint32_t dwFontStyles, |
| 88 uint16_t wCodePage = 0xFFFF); | 89 uint16_t wCodePage = 0xFFFF); |
| 89 void LoadDocFonts(CXFA_FFDoc* hDoc); | 90 void LoadDocFonts(CXFA_FFDoc* hDoc); |
| 90 void ReleaseDocFonts(CXFA_FFDoc* hDoc); | 91 void ReleaseDocFonts(CXFA_FFDoc* hDoc); |
| 91 void SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr); | 92 void SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr); |
| 92 | 93 |
| 93 protected: | 94 protected: |
| 94 std::unique_ptr<CXFA_DefFontMgr> m_pDefFontMgr; | 95 std::unique_ptr<CXFA_DefFontMgr> m_pDefFontMgr; |
| 95 std::map<CXFA_FFDoc*, std::unique_ptr<CXFA_PDFFontMgr>> m_PDFFontMgrMap; | 96 std::map<CXFA_FFDoc*, std::unique_ptr<CXFA_PDFFontMgr>> m_PDFFontMgrMap; |
| 96 std::map<CFX_ByteString, CFGAS_GEFont*> m_FontMap; | 97 std::map<CFX_ByteString, CFGAS_GEFont*> m_FontMap; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 #endif // XFA_FXFA_INCLUDE_XFA_FONTMGR_H_ | 100 #endif // XFA_FXFA_INCLUDE_XFA_FONTMGR_H_ |
| OLD | NEW |