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

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

Issue 2009253003: Clean up fx_ge.h and IWYU. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 4 years, 7 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 | « xfa/fde/tto/fde_textout.h ('k') | xfa/fgas/font/fgas_stdfontmgr.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_STDFONTMGR_H_ 7 #ifndef XFA_FGAS_FONT_FGAS_STDFONTMGR_H_
8 #define XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ 8 #define XFA_FGAS_FONT_FGAS_STDFONTMGR_H_
9 9
10 #include "core/fxcrt/include/fx_ext.h" 10 #include "core/fxcrt/include/fx_ext.h"
11 #include "core/fxge/include/fx_freetype.h" 11 #include "core/fxge/include/fx_freetype.h"
12 #include "core/fxge/include/fx_ge.h"
13 #include "third_party/freetype/include/freetype/fttypes.h" 12 #include "third_party/freetype/include/freetype/fttypes.h"
14 #include "xfa/fgas/font/fgas_font.h" 13 #include "xfa/fgas/font/fgas_font.h"
15 14
16 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 15 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
17 int32_t FX_GetSimilarValue(FX_FONTDESCRIPTOR const* pFont, 16 int32_t FX_GetSimilarValue(FX_FONTDESCRIPTOR const* pFont,
18 uint32_t dwFontStyles); 17 uint32_t dwFontStyles);
19 FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, 18 FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams,
20 const CFX_FontDescriptors& fonts); 19 const CFX_FontDescriptors& fonts);
21 20
22 class CFX_StdFontMgrImp : public IFX_FontMgr { 21 class CFX_StdFontMgrImp : public IFX_FontMgr {
23 public: 22 public:
24 CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator); 23 explicit CFX_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator);
25 ~CFX_StdFontMgrImp(); 24 ~CFX_StdFontMgrImp() override;
26 virtual void Release() { delete this; } 25
27 virtual IFX_Font* GetDefFontByCodePage(uint16_t wCodePage, 26 // IFX_FontMgr:
28 uint32_t dwFontStyles, 27 void Release() override { delete this; }
29 const FX_WCHAR* pszFontFamily = NULL); 28 IFX_Font* GetDefFontByCodePage(uint16_t wCodePage,
30 virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, 29 uint32_t dwFontStyles,
31 uint32_t dwFontStyles, 30 const FX_WCHAR* pszFontFamily = NULL) override;
32 const FX_WCHAR* pszFontFamily = NULL); 31 IFX_Font* GetDefFontByCharset(uint8_t nCharset,
33 virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, 32 uint32_t dwFontStyles,
34 uint32_t dwFontStyles, 33 const FX_WCHAR* pszFontFamily = NULL) override;
35 const FX_WCHAR* pszFontFamily = NULL); 34 IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode,
36 virtual IFX_Font* GetDefFontByLanguage(uint16_t wLanguage, 35 uint32_t dwFontStyles,
37 uint32_t dwFontStyles, 36 const FX_WCHAR* pszFontFamily = NULL) override;
38 const FX_WCHAR* pszFontFamily = NULL); 37 IFX_Font* GetDefFontByLanguage(uint16_t wLanguage,
39 virtual IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, 38 uint32_t dwFontStyles,
40 uint32_t dwFontStyles, 39 const FX_WCHAR* pszFontFamily = NULL) override;
41 uint16_t wCodePage = 0xFFFF); 40 IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily,
42 virtual IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength); 41 uint32_t dwFontStyles,
43 virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName); 42 uint16_t wCodePage = 0xFFFF) override;
44 virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, 43 IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) override;
45 const FX_WCHAR* pszFontAlias = NULL, 44 IFX_Font* LoadFont(const FX_WCHAR* pszFileName) override;
46 uint32_t dwFontStyles = 0, 45 IFX_Font* LoadFont(IFX_Stream* pFontStream,
47 uint16_t wCodePage = 0, 46 const FX_WCHAR* pszFontAlias = NULL,
48 FX_BOOL bSaveStream = FALSE); 47 uint32_t dwFontStyles = 0,
49 virtual IFX_Font* LoadFont(IFX_Font* pSrcFont, 48 uint16_t wCodePage = 0,
50 uint32_t dwFontStyles, 49 FX_BOOL bSaveStream = FALSE) override;
51 uint16_t wCodePage = 0xFFFF); 50 IFX_Font* LoadFont(IFX_Font* pSrcFont,
52 virtual void ClearFontCache(); 51 uint32_t dwFontStyles,
53 virtual void RemoveFont(IFX_Font* pFont); 52 uint16_t wCodePage = 0xFFFF) override;
53
54 void ClearFontCache();
55 void RemoveFont(IFX_Font* pFont);
54 56
55 protected: 57 protected:
56 void RemoveFont(CFX_MapPtrToPtr& fontMap, IFX_Font* pFont); 58 void RemoveFont(CFX_MapPtrToPtr& fontMap, IFX_Font* pFont);
57 FX_FONTDESCRIPTOR const* FindFont(const FX_WCHAR* pszFontFamily, 59 FX_FONTDESCRIPTOR const* FindFont(const FX_WCHAR* pszFontFamily,
58 uint32_t dwFontStyles, 60 uint32_t dwFontStyles,
59 uint32_t dwMatchFlags, 61 uint32_t dwMatchFlags,
60 uint16_t wCodePage, 62 uint16_t wCodePage,
61 uint32_t dwUSB = 999, 63 uint32_t dwUSB = 999,
62 FX_WCHAR wUnicode = 0); 64 FX_WCHAR wUnicode = 0);
63 IFX_Font* GetFont(FX_FONTDESCRIPTOR const* pFD, uint32_t dwFontStyles); 65 IFX_Font* GetFont(FX_FONTDESCRIPTOR const* pFD, uint32_t dwFontStyles);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 private: 139 private:
138 CFX_ByteString GetNextFile(); 140 CFX_ByteString GetNextFile();
139 141
140 CFX_WideString m_wsNext; 142 CFX_WideString m_wsNext;
141 CFX_ObjectArray<FX_HandleParentPath> m_FolderQueue; 143 CFX_ObjectArray<FX_HandleParentPath> m_FolderQueue;
142 CFX_ByteStringArray m_FolderPaths; 144 CFX_ByteStringArray m_FolderPaths;
143 }; 145 };
144 146
145 class CFX_FontMgrImp : public IFX_FontMgr { 147 class CFX_FontMgrImp : public IFX_FontMgr {
146 public: 148 public:
147 CFX_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum); 149 explicit CFX_FontMgrImp(CFX_FontSourceEnum_File* pFontEnum);
150 ~CFX_FontMgrImp() override;
148 151
149 virtual void Release(); 152 // IFX_FontMgr:
150 virtual IFX_Font* GetDefFontByCodePage(uint16_t wCodePage, 153 void Release() override;
151 uint32_t dwFontStyles, 154 IFX_Font* GetDefFontByCodePage(uint16_t wCodePage,
152 const FX_WCHAR* pszFontFamily = NULL); 155 uint32_t dwFontStyles,
153 virtual IFX_Font* GetDefFontByCharset(uint8_t nCharset, 156 const FX_WCHAR* pszFontFamily = NULL) override;
154 uint32_t dwFontStyles, 157 IFX_Font* GetDefFontByCharset(uint8_t nCharset,
155 const FX_WCHAR* pszFontFamily = NULL); 158 uint32_t dwFontStyles,
156 virtual IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, 159 const FX_WCHAR* pszFontFamily = NULL) override;
157 uint32_t dwFontStyles, 160 IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode,
158 const FX_WCHAR* pszFontFamily = NULL); 161 uint32_t dwFontStyles,
159 virtual IFX_Font* GetDefFontByLanguage(uint16_t wLanguage, 162 const FX_WCHAR* pszFontFamily = NULL) override;
160 uint32_t dwFontStyles, 163 IFX_Font* GetDefFontByLanguage(uint16_t wLanguage,
161 const FX_WCHAR* pszFontFamily = NULL); 164 uint32_t dwFontStyles,
162 virtual IFX_Font* GetFontByCodePage(uint16_t wCodePage, 165 const FX_WCHAR* pszFontFamily = NULL) override;
163 uint32_t dwFontStyles, 166 IFX_Font* GetFontByCodePage(uint16_t wCodePage,
164 const FX_WCHAR* pszFontFamily = NULL); 167 uint32_t dwFontStyles,
165 virtual IFX_Font* GetFontByCharset(uint8_t nCharset, 168 const FX_WCHAR* pszFontFamily = NULL) override;
166 uint32_t dwFontStyles, 169 IFX_Font* GetFontByCharset(uint8_t nCharset,
167 const FX_WCHAR* pszFontFamily = NULL); 170 uint32_t dwFontStyles,
168 virtual IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode, 171 const FX_WCHAR* pszFontFamily = NULL) override;
169 uint32_t dwFontStyles, 172 IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode,
170 const FX_WCHAR* pszFontFamily = NULL); 173 uint32_t dwFontStyles,
171 virtual IFX_Font* GetFontByLanguage(uint16_t wLanguage, 174 const FX_WCHAR* pszFontFamily = NULL) override;
172 uint32_t dwFontStyles, 175 IFX_Font* GetFontByLanguage(uint16_t wLanguage,
173 const FX_WCHAR* pszFontFamily = NULL); 176 uint32_t dwFontStyles,
174 virtual IFX_Font* LoadFont(const uint8_t* pBuffer, 177 const FX_WCHAR* pszFontFamily = NULL) override;
175 int32_t iLength, 178 IFX_Font* LoadFont(const uint8_t* pBuffer,
176 int32_t iFaceIndex, 179 int32_t iLength,
177 int32_t* pFaceCount); 180 int32_t iFaceIndex,
178 virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName, 181 int32_t* pFaceCount) override;
179 int32_t iFaceIndex, 182 IFX_Font* LoadFont(const FX_WCHAR* pszFileName,
180 int32_t* pFaceCount); 183 int32_t iFaceIndex,
181 virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, 184 int32_t* pFaceCount) override;
182 int32_t iFaceIndex, 185 IFX_Font* LoadFont(IFX_Stream* pFontStream,
183 int32_t* pFaceCount, 186 int32_t iFaceIndex,
184 FX_BOOL bSaveStream = FALSE); 187 int32_t* pFaceCount,
185 virtual IFX_Font* LoadFont(const CFX_WideString& wsFaceName, 188 FX_BOOL bSaveStream = FALSE) override;
186 int32_t iFaceIndex, 189 void ClearFontCache() override;
187 int32_t* pFaceCount); 190 void RemoveFont(IFX_Font* pFont) override;
188 virtual void ClearFontCache(); 191
189 virtual void RemoveFont(IFX_Font* pFont); 192 IFX_Font* LoadFont(const CFX_WideString& wsFaceName,
193 int32_t iFaceIndex,
194 int32_t* pFaceCount);
190 FX_BOOL EnumFonts(); 195 FX_BOOL EnumFonts();
191 FX_BOOL EnumFontsFromFontMapper(); 196 FX_BOOL EnumFontsFromFontMapper();
192 FX_BOOL EnumFontsFromFiles(); 197 FX_BOOL EnumFontsFromFiles();
193 198
194 protected: 199 protected:
195 void RegisterFace(FXFT_Face pFace, 200 void RegisterFace(FXFT_Face pFace,
196 CFX_FontDescriptors& Fonts, 201 CFX_FontDescriptors& Fonts,
197 const CFX_WideString* pFaceName, 202 const CFX_WideString* pFaceName,
198 IFX_FileAccess* pFontAccess); 203 IFX_FileAccess* pFontAccess);
199 void RegisterFaces(IFX_FileRead* pFontStream, 204 void RegisterFaces(IFX_FileRead* pFontStream,
(...skipping 25 matching lines...) Expand all
225 IFX_SystemFontInfo* pSystemFontInfo, 230 IFX_SystemFontInfo* pSystemFontInfo,
226 uint32_t index); 231 uint32_t index);
227 IFX_FileRead* CreateFontStream(const CFX_ByteString& bsFaceName); 232 IFX_FileRead* CreateFontStream(const CFX_ByteString& bsFaceName);
228 233
229 CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList; 234 CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList;
230 CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<IFX_Font*>*> m_Hash2Fonts; 235 CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<IFX_Font*>*> m_Hash2Fonts;
231 CFX_MapPtrTemplate<uint32_t, IFX_FileAccess*> m_Hash2FileAccess; 236 CFX_MapPtrTemplate<uint32_t, IFX_FileAccess*> m_Hash2FileAccess;
232 CFX_MapPtrTemplate<uint32_t, IFX_Font*> m_FileAccess2IFXFont; 237 CFX_MapPtrTemplate<uint32_t, IFX_Font*> m_FileAccess2IFXFont;
233 CFX_MapPtrTemplate<IFX_Font*, IFX_FileRead*> m_IFXFont2FileRead; 238 CFX_MapPtrTemplate<IFX_Font*, IFX_FileRead*> m_IFXFont2FileRead;
234 CFX_MapPtrTemplate<FX_WCHAR, IFX_Font*> m_FailedUnicodes2NULL; 239 CFX_MapPtrTemplate<FX_WCHAR, IFX_Font*> m_FailedUnicodes2NULL;
235 CFX_FontSourceEnum_File* m_pFontSource; 240 CFX_FontSourceEnum_File* const m_pFontSource;
236 }; 241 };
237 #endif 242 #endif
238 243
239 #endif // XFA_FGAS_FONT_FGAS_STDFONTMGR_H_ 244 #endif // XFA_FGAS_FONT_FGAS_STDFONTMGR_H_
OLDNEW
« no previous file with comments | « xfa/fde/tto/fde_textout.h ('k') | xfa/fgas/font/fgas_stdfontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698