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 12 matching lines...) Expand all Loading... |
23 const FX_WCHAR* pReplaceFont; | 23 const FX_WCHAR* pReplaceFont; |
24 uint16_t dwStyles; | 24 uint16_t dwStyles; |
25 uint16_t wCodePage; | 25 uint16_t wCodePage; |
26 }; | 26 }; |
27 | 27 |
28 class CXFA_DefFontMgr { | 28 class CXFA_DefFontMgr { |
29 public: | 29 public: |
30 CXFA_DefFontMgr() {} | 30 CXFA_DefFontMgr() {} |
31 ~CXFA_DefFontMgr(); | 31 ~CXFA_DefFontMgr(); |
32 | 32 |
33 IFGAS_Font* GetFont(CXFA_FFDoc* hDoc, | 33 CFGAS_GEFont* GetFont(CXFA_FFDoc* hDoc, |
34 const CFX_WideStringC& wsFontFamily, | 34 const CFX_WideStringC& wsFontFamily, |
35 uint32_t dwFontStyles, | 35 uint32_t dwFontStyles, |
36 uint16_t wCodePage = 0xFFFF); | 36 uint16_t wCodePage = 0xFFFF); |
37 IFGAS_Font* GetDefaultFont(CXFA_FFDoc* hDoc, | 37 CFGAS_GEFont* GetDefaultFont(CXFA_FFDoc* hDoc, |
38 const CFX_WideStringC& wsFontFamily, | 38 const CFX_WideStringC& wsFontFamily, |
39 uint32_t dwFontStyles, | 39 uint32_t dwFontStyles, |
40 uint16_t wCodePage = 0xFFFF); | 40 uint16_t wCodePage = 0xFFFF); |
41 | 41 |
42 protected: | 42 protected: |
43 CFX_ArrayTemplate<IFGAS_Font*> m_CacheFonts; | 43 CFX_ArrayTemplate<CFGAS_GEFont*> m_CacheFonts; |
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 IFGAS_Font* 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 FX_BOOL bStrictMatch = TRUE); |
55 FX_BOOL GetCharWidth(IFGAS_Font* pFont, | 55 FX_BOOL GetCharWidth(CFGAS_GEFont* pFont, |
56 FX_WCHAR wUnicode, | 56 FX_WCHAR wUnicode, |
57 int32_t& iWidth, | 57 int32_t& iWidth, |
58 FX_BOOL bCharCode); | 58 FX_BOOL bCharCode); |
59 std::map<IFGAS_Font*, CPDF_Font*> m_FDE2PDFFont; | 59 std::map<CFGAS_GEFont*, CPDF_Font*> m_FDE2PDFFont; |
60 | 60 |
61 protected: | 61 protected: |
62 IFGAS_Font* FindFont(CFX_ByteString strFamilyName, | 62 CFGAS_GEFont* FindFont(CFX_ByteString strFamilyName, |
63 FX_BOOL bBold, | 63 FX_BOOL bBold, |
64 FX_BOOL bItalic, | 64 FX_BOOL bItalic, |
65 CPDF_Font** pPDFFont, | 65 CPDF_Font** pPDFFont, |
66 FX_BOOL bStrictMatch = TRUE); | 66 FX_BOOL bStrictMatch = TRUE); |
67 CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, | 67 CFX_ByteString PsNameToFontName(const CFX_ByteString& strPsName, |
68 FX_BOOL bBold, | 68 FX_BOOL bBold, |
69 FX_BOOL bItalic); | 69 FX_BOOL bItalic); |
70 FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, | 70 FX_BOOL PsNameMatchDRFontName(const CFX_ByteStringC& bsPsName, |
71 FX_BOOL bBold, | 71 FX_BOOL bBold, |
72 FX_BOOL bItalic, | 72 FX_BOOL bItalic, |
73 const CFX_ByteString& bsDRFontName, | 73 const CFX_ByteString& bsDRFontName, |
74 FX_BOOL bStrictMatch = TRUE); | 74 FX_BOOL bStrictMatch = TRUE); |
75 | 75 |
76 CXFA_FFDoc* m_pDoc; | 76 CXFA_FFDoc* m_pDoc; |
77 std::map<CFX_ByteString, IFGAS_Font*> m_FontMap; | 77 std::map<CFX_ByteString, CFGAS_GEFont*> m_FontMap; |
78 }; | 78 }; |
79 | 79 |
80 class CXFA_FontMgr { | 80 class CXFA_FontMgr { |
81 public: | 81 public: |
82 CXFA_FontMgr(); | 82 CXFA_FontMgr(); |
83 ~CXFA_FontMgr(); | 83 ~CXFA_FontMgr(); |
84 | 84 |
85 IFGAS_Font* GetFont(CXFA_FFDoc* hDoc, | 85 CFGAS_GEFont* GetFont(CXFA_FFDoc* hDoc, |
86 const CFX_WideStringC& wsFontFamily, | 86 const CFX_WideStringC& wsFontFamily, |
87 uint32_t dwFontStyles, | 87 uint32_t dwFontStyles, |
88 uint16_t wCodePage = 0xFFFF); | 88 uint16_t wCodePage = 0xFFFF); |
89 void LoadDocFonts(CXFA_FFDoc* hDoc); | 89 void LoadDocFonts(CXFA_FFDoc* hDoc); |
90 void ReleaseDocFonts(CXFA_FFDoc* hDoc); | 90 void ReleaseDocFonts(CXFA_FFDoc* hDoc); |
91 void SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr); | 91 void SetDefFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr); |
92 | 92 |
93 protected: | 93 protected: |
94 std::unique_ptr<CXFA_DefFontMgr> m_pDefFontMgr; | 94 std::unique_ptr<CXFA_DefFontMgr> m_pDefFontMgr; |
95 std::map<CXFA_FFDoc*, std::unique_ptr<CXFA_PDFFontMgr>> m_PDFFontMgrMap; | 95 std::map<CXFA_FFDoc*, std::unique_ptr<CXFA_PDFFontMgr>> m_PDFFontMgrMap; |
96 std::map<CFX_ByteString, IFGAS_Font*> m_FontMap; | 96 std::map<CFX_ByteString, CFGAS_GEFont*> m_FontMap; |
97 }; | 97 }; |
98 | 98 |
99 #endif // XFA_FXFA_INCLUDE_XFA_FONTMGR_H_ | 99 #endif // XFA_FXFA_INCLUDE_XFA_FONTMGR_H_ |
OLD | NEW |