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

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

Issue 2524493002: Clean up CFGAS_GEFont (Closed)
Patch Set: Rebase? Created 4 years 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 | « xfa/fgas/font/cfgas_fontmgr.cpp ('k') | xfa/fgas/font/cfgas_gefont.cpp » ('j') | no next file with comments »
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_CFGAS_GEFONT_H_
8 #define XFA_FGAS_FONT_FGAS_GEFONT_H_ 8 #define XFA_FGAS_FONT_CFGAS_GEFONT_H_
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 12
13 #include "core/fxcrt/fx_memory.h" 13 #include "core/fxcrt/fx_memory.h"
14 #include "xfa/fgas/crt/fgas_utils.h" 14 #include "xfa/fgas/crt/fgas_utils.h"
15 #include "xfa/fgas/font/cfgas_fontmgr.h" 15 #include "xfa/fgas/font/cfgas_fontmgr.h"
16 16
17 #define FXFONT_SUBST_ITALIC 0x02 17 #define FXFONT_SUBST_ITALIC 0x02
18 18
(...skipping 17 matching lines...) Expand all
36 static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, 36 static CFGAS_GEFont* LoadFont(IFX_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 void GetFamilyName(CFX_WideString& wsFamily) const;
47 uint32_t GetFontStyles() const; 46 uint32_t GetFontStyles() const;
48 bool GetCharWidth(FX_WCHAR wUnicode, int32_t& iWidth, bool bCharCode); 47 bool GetCharWidth(FX_WCHAR wUnicode, int32_t& iWidth, bool bCharCode);
49 int32_t GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode = false); 48 int32_t GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode = false);
50 int32_t GetAscent() const; 49 int32_t GetAscent() const;
51 int32_t GetDescent() const; 50 int32_t GetDescent() const;
52 bool GetCharBBox(FX_WCHAR wUnicode, CFX_Rect& bbox, bool bCharCode = false); 51 bool GetCharBBox(FX_WCHAR wUnicode, CFX_Rect& bbox, bool bCharCode = false);
53 bool GetBBox(CFX_Rect& bbox); 52 bool GetBBox(CFX_Rect& bbox);
54 int32_t GetItalicAngle() const;
55 void Reset();
56 CFGAS_GEFont* GetSubstFont(int32_t iGlyphIndex) const; 53 CFGAS_GEFont* GetSubstFont(int32_t iGlyphIndex) const;
57 CFX_Font* GetDevFont() const { return m_pFont; } 54 CFX_Font* GetDevFont() const { return m_pFont; }
58 void SetFontProvider(CXFA_PDFFontMgr* pProvider) { m_pProvider = pProvider; } 55 void SetFontProvider(CXFA_PDFFontMgr* pProvider) { m_pProvider = pProvider; }
59 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 56 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
60 void SetLogicalFontStyle(uint32_t dwLogFontStyle) { 57 void SetLogicalFontStyle(uint32_t dwLogFontStyle) {
61 m_bUseLogFontStyle = true; 58 m_bUseLogFontStyle = true;
62 m_dwLogFontStyle = dwLogFontStyle; 59 m_dwLogFontStyle = dwLogFontStyle;
63 } 60 }
64 #endif 61 #endif
65 62
66 protected: 63 private:
67 explicit CFGAS_GEFont(CFGAS_FontMgr* pFontMgr); 64 explicit CFGAS_GEFont(CFGAS_FontMgr* pFontMgr);
68 CFGAS_GEFont(CFGAS_GEFont* src, uint32_t dwFontStyles); 65 CFGAS_GEFont(CFGAS_GEFont* src, uint32_t dwFontStyles);
69 66
70 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 67 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
71 bool LoadFontInternal(const FX_WCHAR* pszFontFamily, 68 bool LoadFontInternal(const FX_WCHAR* pszFontFamily,
72 uint32_t dwFontStyles, 69 uint32_t dwFontStyles,
73 uint16_t wCodePage); 70 uint16_t wCodePage);
74 bool LoadFontInternal(const uint8_t* pBuffer, int32_t length); 71 bool LoadFontInternal(const uint8_t* pBuffer, int32_t length);
75 bool LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream); 72 bool LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream);
76 #endif 73 #endif
77 bool LoadFontInternal(CFX_Font* pExternalFont); 74 bool LoadFontInternal(CFX_Font* pExternalFont);
78 bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont); 75 bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont);
79 bool InitFont(); 76 bool InitFont();
80 bool GetCharBBoxInternal(FX_WCHAR wUnicode, 77 bool GetCharBBoxInternal(FX_WCHAR wUnicode,
81 CFX_Rect& bbox, 78 CFX_Rect& bbox,
82 bool bRecursive, 79 bool bRecursive,
83 bool bCharCode = false); 80 bool bCharCode = false);
84 bool GetCharWidthInternal(FX_WCHAR wUnicode, 81 bool GetCharWidthInternal(FX_WCHAR wUnicode,
85 int32_t& iWidth, 82 int32_t& iWidth,
86 bool bRecursive, 83 bool bRecursive,
87 bool bCharCode); 84 bool bCharCode);
88 int32_t GetGlyphIndex(FX_WCHAR wUnicode, 85 int32_t GetGlyphIndex(FX_WCHAR wUnicode,
89 bool bRecursive, 86 bool bRecursive,
90 CFGAS_GEFont** ppFont, 87 CFGAS_GEFont** ppFont,
91 bool bCharCode = false); 88 bool bCharCode = false);
89 CFX_WideString GetFamilyName() const;
92 90
93 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 91 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
94 bool m_bUseLogFontStyle; 92 bool m_bUseLogFontStyle;
95 uint32_t m_dwLogFontStyle; 93 uint32_t m_dwLogFontStyle;
96 #endif 94 #endif
97 CFX_Font* m_pFont; 95 CFX_Font* m_pFont;
98 CFGAS_GEFont* const m_pSrcFont; 96 CFGAS_GEFont* const m_pSrcFont;
99 CFGAS_FontMgr* const m_pFontMgr; 97 CFGAS_FontMgr* const m_pFontMgr;
100 int32_t m_iRefCount; 98 int32_t m_iRefCount;
101 bool m_bExternalFont; 99 bool m_bExternalFont;
102 std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream; 100 std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream;
103 std::unique_ptr<IFX_SeekableReadStream, 101 std::unique_ptr<IFX_SeekableReadStream,
104 ReleaseDeleter<IFX_SeekableReadStream>> 102 ReleaseDeleter<IFX_SeekableReadStream>>
105 m_pFileRead; 103 m_pFileRead;
106 std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; 104 std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding;
107 std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap; 105 std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap;
108 std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray; 106 std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray;
109 std::unique_ptr<CFX_MapPtrToPtr> m_pBBoxMap; 107 std::unique_ptr<CFX_MapPtrToPtr> m_pBBoxMap;
110 CXFA_PDFFontMgr* m_pProvider; // not owned. 108 CXFA_PDFFontMgr* m_pProvider; // not owned.
111 CFX_ArrayTemplate<CFGAS_GEFont*> m_SubstFonts; 109 CFX_ArrayTemplate<CFGAS_GEFont*> m_SubstFonts;
112 std::map<FX_WCHAR, CFGAS_GEFont*> m_FontMapper; 110 std::map<FX_WCHAR, CFGAS_GEFont*> m_FontMapper;
113 }; 111 };
114 112
115 #endif // XFA_FGAS_FONT_FGAS_GEFONT_H_ 113 #endif // XFA_FGAS_FONT_CFGAS_GEFONT_H_
OLDNEW
« no previous file with comments | « xfa/fgas/font/cfgas_fontmgr.cpp ('k') | xfa/fgas/font/cfgas_gefont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698