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 "core/fxcrt/include/fx_memory.h" | 12 #include "core/fxcrt/include/fx_memory.h" |
13 #include "xfa/fgas/crt/fgas_utils.h" | 13 #include "xfa/fgas/crt/fgas_utils.h" |
14 #include "xfa/fgas/font/fgas_font.h" | 14 #include "xfa/fgas/font/fgas_font.h" |
15 | 15 |
16 #define FXFONT_SUBST_ITALIC 0x02 | 16 #define FXFONT_SUBST_ITALIC 0x02 |
17 | 17 |
18 class CFX_UnicodeEncoding; | 18 class CFX_UnicodeEncoding; |
19 class CXFA_PDFFontMgr; | 19 class CXFA_PDFFontMgr; |
20 | 20 |
21 class CFGAS_GEFont { | 21 class CFGAS_GEFont { |
22 public: | 22 public: |
23 static CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily, | 23 static CFGAS_GEFont* LoadFont(const FX_WCHAR* pszFontFamily, |
24 uint32_t dwFontStyles, | 24 uint32_t dwFontStyles, |
25 uint16_t wCodePage, | 25 uint16_t wCodePage, |
26 IFGAS_FontMgr* pFontMgr); | 26 IFGAS_FontMgr* pFontMgr); |
27 static CFGAS_GEFont* LoadFont(CFX_Font* pExternalFont, | 27 static CFGAS_GEFont* LoadFont(CFX_Font* pExtFont, IFGAS_FontMgr* pFontMgr); |
28 IFGAS_FontMgr* pFontMgr); | |
29 static CFGAS_GEFont* LoadFont(std::unique_ptr<CFX_Font> pInternalFont, | |
30 IFGAS_FontMgr* pFontMgr); | |
31 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 28 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
32 static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, | 29 static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, |
33 int32_t iLength, | 30 int32_t iLength, |
34 IFGAS_FontMgr* pFontMgr); | 31 IFGAS_FontMgr* pFontMgr); |
35 static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, | 32 static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, |
36 IFGAS_FontMgr* pFontMgr, | 33 IFGAS_FontMgr* pFontMgr, |
37 FX_BOOL bSaveStream); | 34 FX_BOOL bSaveStream); |
38 #endif | 35 #endif |
39 | 36 |
40 ~CFGAS_GEFont(); | 37 ~CFGAS_GEFont(); |
(...skipping 29 matching lines...) Expand all Loading... |
70 explicit CFGAS_GEFont(IFGAS_FontMgr* pFontMgr); | 67 explicit CFGAS_GEFont(IFGAS_FontMgr* pFontMgr); |
71 CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles); | 68 CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles); |
72 | 69 |
73 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 70 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
74 FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, | 71 FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, |
75 uint32_t dwFontStyles, | 72 uint32_t dwFontStyles, |
76 uint16_t wCodePage); | 73 uint16_t wCodePage); |
77 FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); | 74 FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); |
78 FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); | 75 FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); |
79 #endif | 76 #endif |
80 FX_BOOL LoadFontInternal(CFX_Font* pExternalFont); | 77 FX_BOOL LoadFontInternal(CFX_Font* pExtFont); |
81 FX_BOOL LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont); | |
82 FX_BOOL InitFont(); | 78 FX_BOOL InitFont(); |
83 FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, | 79 FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, |
84 CFX_Rect& bbox, | 80 CFX_Rect& bbox, |
85 FX_BOOL bRecursive, | 81 FX_BOOL bRecursive, |
86 FX_BOOL bCharCode = FALSE); | 82 FX_BOOL bCharCode = FALSE); |
87 FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, | 83 FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, |
88 int32_t& iWidth, | 84 int32_t& iWidth, |
89 FX_BOOL bRecursive, | 85 FX_BOOL bRecursive, |
90 FX_BOOL bCharCode = FALSE); | 86 FX_BOOL bCharCode = FALSE); |
91 int32_t GetGlyphIndex(FX_WCHAR wUnicode, | 87 int32_t GetGlyphIndex(FX_WCHAR wUnicode, |
92 FX_BOOL bRecursive, | 88 FX_BOOL bRecursive, |
93 CFGAS_GEFont** ppFont, | 89 CFGAS_GEFont** ppFont, |
94 FX_BOOL bCharCode = FALSE); | 90 FX_BOOL bCharCode = FALSE); |
95 | 91 |
96 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 92 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
97 FX_BOOL m_bUseLogFontStyle; | 93 FX_BOOL m_bUseLogFontStyle; |
98 uint32_t m_dwLogFontStyle; | 94 uint32_t m_dwLogFontStyle; |
99 #endif | 95 #endif |
100 CFX_Font* m_pFont; | 96 CFX_Font* m_pFont; |
101 IFGAS_FontMgr* const m_pFontMgr; | 97 IFGAS_FontMgr* const m_pFontMgr; |
102 int32_t m_iRefCount; | 98 int32_t m_iRefCount; |
103 bool m_bExternalFont; | 99 FX_BOOL m_bExtFont; |
104 std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream; | 100 std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream; |
105 std::unique_ptr<IFX_FileRead, ReleaseDeleter<IFX_FileRead>> m_pFileRead; | 101 std::unique_ptr<IFX_FileRead, ReleaseDeleter<IFX_FileRead>> m_pFileRead; |
106 std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; | 102 std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; |
107 std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap; | 103 std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap; |
108 std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray; | 104 std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray; |
109 std::unique_ptr<CFX_MapPtrToPtr> m_pBBoxMap; | 105 std::unique_ptr<CFX_MapPtrToPtr> m_pBBoxMap; |
110 CXFA_PDFFontMgr* m_pProvider; // not owned. | 106 CXFA_PDFFontMgr* m_pProvider; // not owned. |
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 |