Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: xfa/fgas/font/fgas_gefont.h

Issue 2297303004: Fix leaked internal font (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | xfa/fgas/font/fgas_gefont.cpp » ('j') | xfa/fgas/font/fgas_gefont.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | xfa/fgas/font/fgas_gefont.cpp » ('j') | xfa/fgas/font/fgas_gefont.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698