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* pExtFont, IFGAS_FontMgr* pFontMgr); | 27 static CFGAS_GEFont* LoadFont(CFX_Font* pSrcFont, |
28 bool bExternalFont, | |
Lei Zhang
2016/09/01 22:55:42
Can we add a separate LoadInternalFont(CFX_Font* p
Wei Li
2016/09/01 23:43:30
Done.
| |
29 IFGAS_FontMgr* pFontMgr); | |
28 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 30 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
29 static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, | 31 static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, |
30 int32_t iLength, | 32 int32_t iLength, |
31 IFGAS_FontMgr* pFontMgr); | 33 IFGAS_FontMgr* pFontMgr); |
32 static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, | 34 static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, |
33 IFGAS_FontMgr* pFontMgr, | 35 IFGAS_FontMgr* pFontMgr, |
34 FX_BOOL bSaveStream); | 36 FX_BOOL bSaveStream); |
35 #endif | 37 #endif |
36 | 38 |
37 ~CFGAS_GEFont(); | 39 ~CFGAS_GEFont(); |
(...skipping 29 matching lines...) Expand all Loading... | |
67 explicit CFGAS_GEFont(IFGAS_FontMgr* pFontMgr); | 69 explicit CFGAS_GEFont(IFGAS_FontMgr* pFontMgr); |
68 CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles); | 70 CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles); |
69 | 71 |
70 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 72 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
71 FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, | 73 FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, |
72 uint32_t dwFontStyles, | 74 uint32_t dwFontStyles, |
73 uint16_t wCodePage); | 75 uint16_t wCodePage); |
74 FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); | 76 FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); |
75 FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); | 77 FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); |
76 #endif | 78 #endif |
77 FX_BOOL LoadFontInternal(CFX_Font* pExtFont); | 79 FX_BOOL LoadFontInternal(CFX_Font* pFont, bool bExternalFont); |
78 FX_BOOL InitFont(); | 80 FX_BOOL InitFont(); |
79 FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, | 81 FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, |
80 CFX_Rect& bbox, | 82 CFX_Rect& bbox, |
81 FX_BOOL bRecursive, | 83 FX_BOOL bRecursive, |
82 FX_BOOL bCharCode = FALSE); | 84 FX_BOOL bCharCode = FALSE); |
83 FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, | 85 FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, |
84 int32_t& iWidth, | 86 int32_t& iWidth, |
85 FX_BOOL bRecursive, | 87 FX_BOOL bRecursive, |
86 FX_BOOL bCharCode = FALSE); | 88 FX_BOOL bCharCode = FALSE); |
87 int32_t GetGlyphIndex(FX_WCHAR wUnicode, | 89 int32_t GetGlyphIndex(FX_WCHAR wUnicode, |
(...skipping 14 matching lines...) Expand all Loading... | |
102 std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; | 104 std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; |
103 std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap; | 105 std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap; |
104 std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray; | 106 std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray; |
105 std::unique_ptr<CFX_MapPtrToPtr> m_pBBoxMap; | 107 std::unique_ptr<CFX_MapPtrToPtr> m_pBBoxMap; |
106 CXFA_PDFFontMgr* m_pProvider; // not owned. | 108 CXFA_PDFFontMgr* m_pProvider; // not owned. |
107 CFX_ArrayTemplate<CFGAS_GEFont*> m_SubstFonts; | 109 CFX_ArrayTemplate<CFGAS_GEFont*> m_SubstFonts; |
108 std::map<FX_WCHAR, CFGAS_GEFont*> m_FontMapper; | 110 std::map<FX_WCHAR, CFGAS_GEFont*> m_FontMapper; |
109 }; | 111 }; |
110 | 112 |
111 #endif // XFA_FGAS_FONT_FGAS_GEFONT_H_ | 113 #endif // XFA_FGAS_FONT_FGAS_GEFONT_H_ |
OLD | NEW |