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_FGAS_FONT_FGAS_GEFONT_H_ | 7 #ifndef XFA_FGAS_FONT_FGAS_GEFONT_H_ |
8 #define XFA_FGAS_FONT_FGAS_GEFONT_H_ | 8 #define XFA_FGAS_FONT_FGAS_GEFONT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "xfa/fgas/crt/fgas_utils.h" | 12 #include "xfa/fgas/crt/fgas_utils.h" |
13 #include "xfa/fgas/font/fgas_font.h" | 13 #include "xfa/fgas/font/fgas_font.h" |
14 | 14 |
15 #define FXFONT_SUBST_ITALIC 0x02 | 15 #define FXFONT_SUBST_ITALIC 0x02 |
16 | 16 |
17 class CXFA_PDFFontMgr; | 17 class CXFA_PDFFontMgr; |
18 | 18 |
19 class CFGAS_GEFont { | 19 class CFGAS_GEFont { |
20 public: | 20 public: |
21 static CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily, | 21 static CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily, |
22 uint32_t dwFontStyles, | 22 uint32_t dwFontStyles, |
23 uint16_t wCodePage, | 23 uint16_t wCodePage, |
24 IFGAS_FontMgr* pFontMgr); | 24 IFGAS_FontMgr* pFontMgr); |
25 static CFGAS_GEFont* LoadFont(CFX_Font* pExtFont, | 25 static CFGAS_GEFont* LoadFont(CFX_Font* pExtFont, IFGAS_FontMgr* pFontMgr); |
26 IFGAS_FontMgr* pFontMgr, | |
27 FX_BOOL bTakeOver); | |
28 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 26 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
29 static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, | 27 static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, |
30 int32_t iLength, | 28 int32_t iLength, |
31 IFGAS_FontMgr* pFontMgr); | 29 IFGAS_FontMgr* pFontMgr); |
32 static CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFileName); | |
33 static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, | 30 static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, |
34 IFGAS_FontMgr* pFontMgr, | 31 IFGAS_FontMgr* pFontMgr, |
35 FX_BOOL bSaveStream); | 32 FX_BOOL bSaveStream); |
36 #endif | 33 #endif |
37 | 34 |
38 ~CFGAS_GEFont(); | 35 ~CFGAS_GEFont(); |
39 | 36 |
40 void Release(); | 37 void Release(); |
41 CFGAS_GEFont* Retain(); | 38 CFGAS_GEFont* Retain(); |
42 CFGAS_GEFont* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); | 39 CFGAS_GEFont* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); |
(...skipping 20 matching lines...) Expand all Loading... |
63 m_bUseLogFontStyle = TRUE; | 60 m_bUseLogFontStyle = TRUE; |
64 m_dwLogFontStyle = dwLogFontStyle; | 61 m_dwLogFontStyle = dwLogFontStyle; |
65 } | 62 } |
66 #endif | 63 #endif |
67 | 64 |
68 protected: | 65 protected: |
69 explicit CFGAS_GEFont(IFGAS_FontMgr* pFontMgr); | 66 explicit CFGAS_GEFont(IFGAS_FontMgr* pFontMgr); |
70 CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles); | 67 CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles); |
71 | 68 |
72 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 69 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
73 FX_BOOL LoadFont(const FX_WCHAR* pszFontFamily, | 70 FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, |
74 uint32_t dwFontStyles, | 71 uint32_t dwFontStyles, |
75 uint16_t wCodePage); | 72 uint16_t wCodePage); |
76 FX_BOOL LoadFont(const uint8_t* pBuffer, int32_t length); | 73 FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); |
77 FX_BOOL LoadFontInternal(const FX_WCHAR* pszFileName); | 74 FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); |
78 FX_BOOL LoadFont(IFX_Stream* pFontStream, FX_BOOL bSaveStream); | |
79 #endif | 75 #endif |
80 FX_BOOL LoadFont(CFX_Font* pExtFont, FX_BOOL bTakeOver); | 76 FX_BOOL LoadFontInternal(CFX_Font* pExtFont); |
81 FX_BOOL InitFont(); | 77 FX_BOOL InitFont(); |
82 FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, | 78 FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, |
83 CFX_Rect& bbox, | 79 CFX_Rect& bbox, |
84 FX_BOOL bRecursive, | 80 FX_BOOL bRecursive, |
85 FX_BOOL bCharCode = FALSE); | 81 FX_BOOL bCharCode = FALSE); |
86 FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, | 82 FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, |
87 int32_t& iWidth, | 83 int32_t& iWidth, |
88 FX_BOOL bRecursive, | 84 FX_BOOL bRecursive, |
89 FX_BOOL bCharCode = FALSE); | 85 FX_BOOL bCharCode = FALSE); |
90 int32_t GetGlyphIndex(FX_WCHAR wUnicode, | 86 int32_t GetGlyphIndex(FX_WCHAR wUnicode, |
(...skipping 15 matching lines...) Expand all Loading... |
106 CFX_WordDiscreteArray* m_pCharWidthMap; | 102 CFX_WordDiscreteArray* m_pCharWidthMap; |
107 CFX_MassArrayTemplate<CFX_Rect>* m_pRectArray; | 103 CFX_MassArrayTemplate<CFX_Rect>* m_pRectArray; |
108 CFX_MapPtrToPtr* m_pBBoxMap; | 104 CFX_MapPtrToPtr* m_pBBoxMap; |
109 CXFA_PDFFontMgr* m_pProvider; | 105 CXFA_PDFFontMgr* m_pProvider; |
110 uint16_t m_wCharSet; | 106 uint16_t m_wCharSet; |
111 CFX_ArrayTemplate<CFGAS_GEFont*> m_SubstFonts; | 107 CFX_ArrayTemplate<CFGAS_GEFont*> m_SubstFonts; |
112 std::map<FX_WCHAR, CFGAS_GEFont*> m_FontMapper; | 108 std::map<FX_WCHAR, CFGAS_GEFont*> m_FontMapper; |
113 }; | 109 }; |
114 | 110 |
115 #endif // XFA_FGAS_FONT_FGAS_GEFONT_H_ | 111 #endif // XFA_FGAS_FONT_FGAS_GEFONT_H_ |
OLD | NEW |