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_CFGAS_GEFONT_H_ | 7 #ifndef XFA_FGAS_FONT_CFGAS_GEFONT_H_ |
8 #define XFA_FGAS_FONT_CFGAS_GEFONT_H_ | 8 #define XFA_FGAS_FONT_CFGAS_GEFONT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 15 matching lines...) Expand all Loading... |
26 uint16_t wCodePage, | 26 uint16_t wCodePage, |
27 CFGAS_FontMgr* pFontMgr); | 27 CFGAS_FontMgr* pFontMgr); |
28 static CFGAS_GEFont* LoadFont(CFX_Font* pExternalFont, | 28 static CFGAS_GEFont* LoadFont(CFX_Font* pExternalFont, |
29 CFGAS_FontMgr* pFontMgr); | 29 CFGAS_FontMgr* pFontMgr); |
30 static CFGAS_GEFont* LoadFont(std::unique_ptr<CFX_Font> pInternalFont, | 30 static CFGAS_GEFont* LoadFont(std::unique_ptr<CFX_Font> pInternalFont, |
31 CFGAS_FontMgr* pFontMgr); | 31 CFGAS_FontMgr* pFontMgr); |
32 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 32 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
33 static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, | 33 static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer, |
34 int32_t iLength, | 34 int32_t iLength, |
35 CFGAS_FontMgr* pFontMgr); | 35 CFGAS_FontMgr* pFontMgr); |
36 static CFGAS_GEFont* LoadFont(IFGAS_Stream* pFontStream, | 36 static CFGAS_GEFont* LoadFont(const CFX_RetainPtr<IFGAS_Stream>& pFontStream, |
37 CFGAS_FontMgr* pFontMgr, | 37 CFGAS_FontMgr* pFontMgr, |
38 bool bSaveStream); | 38 bool bSaveStream); |
39 #endif | 39 #endif |
40 | 40 |
41 ~CFGAS_GEFont(); | 41 ~CFGAS_GEFont(); |
42 | 42 |
43 void Release(); | 43 void Release(); |
44 CFGAS_GEFont* Retain(); | 44 CFGAS_GEFont* Retain(); |
45 CFGAS_GEFont* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); | 45 CFGAS_GEFont* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); |
46 uint32_t GetFontStyles() const; | 46 uint32_t GetFontStyles() const; |
(...skipping 15 matching lines...) Expand all Loading... |
62 | 62 |
63 private: | 63 private: |
64 explicit CFGAS_GEFont(CFGAS_FontMgr* pFontMgr); | 64 explicit CFGAS_GEFont(CFGAS_FontMgr* pFontMgr); |
65 CFGAS_GEFont(CFGAS_GEFont* src, uint32_t dwFontStyles); | 65 CFGAS_GEFont(CFGAS_GEFont* src, uint32_t dwFontStyles); |
66 | 66 |
67 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 67 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
68 bool LoadFontInternal(const FX_WCHAR* pszFontFamily, | 68 bool LoadFontInternal(const FX_WCHAR* pszFontFamily, |
69 uint32_t dwFontStyles, | 69 uint32_t dwFontStyles, |
70 uint16_t wCodePage); | 70 uint16_t wCodePage); |
71 bool LoadFontInternal(const uint8_t* pBuffer, int32_t length); | 71 bool LoadFontInternal(const uint8_t* pBuffer, int32_t length); |
72 bool LoadFontInternal(IFGAS_Stream* pFontStream, bool bSaveStream); | 72 bool LoadFontInternal(const CFX_RetainPtr<IFGAS_Stream>& pFontStream, |
| 73 bool bSaveStream); |
73 #endif | 74 #endif |
74 bool LoadFontInternal(CFX_Font* pExternalFont); | 75 bool LoadFontInternal(CFX_Font* pExternalFont); |
75 bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont); | 76 bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont); |
76 bool InitFont(); | 77 bool InitFont(); |
77 bool GetCharBBoxInternal(FX_WCHAR wUnicode, | 78 bool GetCharBBoxInternal(FX_WCHAR wUnicode, |
78 CFX_Rect& bbox, | 79 CFX_Rect& bbox, |
79 bool bRecursive, | 80 bool bRecursive, |
80 bool bCharCode = false); | 81 bool bCharCode = false); |
81 bool GetCharWidthInternal(FX_WCHAR wUnicode, | 82 bool GetCharWidthInternal(FX_WCHAR wUnicode, |
82 int32_t& iWidth, | 83 int32_t& iWidth, |
83 bool bRecursive, | 84 bool bRecursive, |
84 bool bCharCode); | 85 bool bCharCode); |
85 int32_t GetGlyphIndex(FX_WCHAR wUnicode, | 86 int32_t GetGlyphIndex(FX_WCHAR wUnicode, |
86 bool bRecursive, | 87 bool bRecursive, |
87 CFGAS_GEFont** ppFont, | 88 CFGAS_GEFont** ppFont, |
88 bool bCharCode = false); | 89 bool bCharCode = false); |
89 CFX_WideString GetFamilyName() const; | 90 CFX_WideString GetFamilyName() const; |
90 | 91 |
91 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 92 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
92 bool m_bUseLogFontStyle; | 93 bool m_bUseLogFontStyle; |
93 uint32_t m_dwLogFontStyle; | 94 uint32_t m_dwLogFontStyle; |
94 #endif | 95 #endif |
95 CFX_Font* m_pFont; | 96 CFX_Font* m_pFont; |
96 CFGAS_GEFont* const m_pSrcFont; | 97 CFGAS_GEFont* const m_pSrcFont; |
97 CFGAS_FontMgr* const m_pFontMgr; | 98 CFGAS_FontMgr* const m_pFontMgr; |
98 int32_t m_iRefCount; | 99 int32_t m_iRefCount; |
99 bool m_bExternalFont; | 100 bool m_bExternalFont; |
100 std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> m_pStream; | 101 CFX_RetainPtr<IFGAS_Stream> m_pStream; |
101 CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead; | 102 CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead; |
102 std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; | 103 std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; |
103 std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap; | 104 std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap; |
104 std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray; | 105 std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray; |
105 std::unique_ptr<CFX_MapPtrToPtr> m_pBBoxMap; | 106 std::unique_ptr<CFX_MapPtrToPtr> m_pBBoxMap; |
106 CXFA_PDFFontMgr* m_pProvider; // not owned. | 107 CXFA_PDFFontMgr* m_pProvider; // not owned. |
107 CFX_ArrayTemplate<CFGAS_GEFont*> m_SubstFonts; | 108 CFX_ArrayTemplate<CFGAS_GEFont*> m_SubstFonts; |
108 std::map<FX_WCHAR, CFGAS_GEFont*> m_FontMapper; | 109 std::map<FX_WCHAR, CFGAS_GEFont*> m_FontMapper; |
109 }; | 110 }; |
110 | 111 |
111 #endif // XFA_FGAS_FONT_CFGAS_GEFONT_H_ | 112 #endif // XFA_FGAS_FONT_CFGAS_GEFONT_H_ |
OLD | NEW |