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> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 void SetFontProvider(CXFA_PDFFontMgr* pProvider) { m_pProvider = pProvider; } | 58 void SetFontProvider(CXFA_PDFFontMgr* pProvider) { m_pProvider = pProvider; } |
59 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 59 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
60 void SetLogicalFontStyle(uint32_t dwLogFontStyle) { | 60 void SetLogicalFontStyle(uint32_t dwLogFontStyle) { |
61 m_bUseLogFontStyle = TRUE; | 61 m_bUseLogFontStyle = TRUE; |
62 m_dwLogFontStyle = dwLogFontStyle; | 62 m_dwLogFontStyle = dwLogFontStyle; |
63 } | 63 } |
64 #endif | 64 #endif |
65 | 65 |
66 protected: | 66 protected: |
67 explicit CFGAS_GEFont(IFGAS_FontMgr* pFontMgr); | 67 explicit CFGAS_GEFont(IFGAS_FontMgr* pFontMgr); |
68 CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles); | 68 CFGAS_GEFont(CFGAS_GEFont* src, uint32_t dwFontStyles); |
69 | 69 |
70 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 70 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
71 FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, | 71 FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, |
72 uint32_t dwFontStyles, | 72 uint32_t dwFontStyles, |
73 uint16_t wCodePage); | 73 uint16_t wCodePage); |
74 FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); | 74 FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); |
75 FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); | 75 FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); |
76 #endif | 76 #endif |
77 FX_BOOL LoadFontInternal(CFX_Font* pExtFont); | 77 FX_BOOL LoadFontInternal(CFX_Font* pExtFont); |
78 FX_BOOL InitFont(); | 78 FX_BOOL InitFont(); |
79 FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, | 79 FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, |
80 CFX_Rect& bbox, | 80 CFX_Rect& bbox, |
81 FX_BOOL bRecursive, | 81 FX_BOOL bRecursive, |
82 FX_BOOL bCharCode = FALSE); | 82 FX_BOOL bCharCode = FALSE); |
83 FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, | 83 FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, |
84 int32_t& iWidth, | 84 int32_t& iWidth, |
85 FX_BOOL bRecursive, | 85 FX_BOOL bRecursive, |
86 FX_BOOL bCharCode = FALSE); | 86 FX_BOOL bCharCode = FALSE); |
87 int32_t GetGlyphIndex(FX_WCHAR wUnicode, | 87 int32_t GetGlyphIndex(FX_WCHAR wUnicode, |
88 FX_BOOL bRecursive, | 88 FX_BOOL bRecursive, |
89 CFGAS_GEFont** ppFont, | 89 CFGAS_GEFont** ppFont, |
90 FX_BOOL bCharCode = FALSE); | 90 FX_BOOL bCharCode = FALSE); |
91 | 91 |
92 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 92 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
93 FX_BOOL m_bUseLogFontStyle; | 93 FX_BOOL m_bUseLogFontStyle; |
94 uint32_t m_dwLogFontStyle; | 94 uint32_t m_dwLogFontStyle; |
95 #endif | 95 #endif |
96 CFX_Font* m_pFont; | 96 CFX_Font* m_pFont; |
| 97 CFGAS_GEFont* const m_pSrcFont; |
97 IFGAS_FontMgr* const m_pFontMgr; | 98 IFGAS_FontMgr* const m_pFontMgr; |
98 int32_t m_iRefCount; | 99 int32_t m_iRefCount; |
99 FX_BOOL m_bExtFont; | 100 FX_BOOL m_bExtFont; |
100 std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream; | 101 std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream; |
101 std::unique_ptr<IFX_FileRead, ReleaseDeleter<IFX_FileRead>> m_pFileRead; | 102 std::unique_ptr<IFX_FileRead, ReleaseDeleter<IFX_FileRead>> 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_FGAS_GEFONT_H_ | 112 #endif // XFA_FGAS_FONT_FGAS_GEFONT_H_ |
OLD | NEW |