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 CORE_INCLUDE_FXGE_FX_FONT_H_ | 7 #ifndef CORE_INCLUDE_FXGE_FX_FONT_H_ |
8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ | 8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
| 12 #include "../../../third_party/base/nonstd_unique_ptr.h" |
12 #include "../fxcrt/fx_system.h" | 13 #include "../fxcrt/fx_system.h" |
13 #include "fx_dib.h" | 14 #include "fx_dib.h" |
14 | 15 |
15 typedef struct FT_FaceRec_* FXFT_Face; | 16 typedef struct FT_FaceRec_* FXFT_Face; |
16 typedef void* FXFT_Library; | 17 typedef void* FXFT_Library; |
17 | 18 |
18 class CFX_FaceCache; | 19 class CFX_FaceCache; |
19 class CFX_FontFaceInfo; | 20 class CFX_FontFaceInfo; |
20 class CFX_FontMapper; | 21 class CFX_FontMapper; |
21 class CFX_PathData; | 22 class CFX_PathData; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 | 230 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 |
230 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 | 231 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 |
231 typedef struct { | 232 typedef struct { |
232 const uint8_t* m_pFontData; | 233 const uint8_t* m_pFontData; |
233 FX_DWORD m_dwSize; | 234 FX_DWORD m_dwSize; |
234 } FoxitFonts; | 235 } FoxitFonts; |
235 class CFX_FontMgr { | 236 class CFX_FontMgr { |
236 public: | 237 public: |
237 CFX_FontMgr(); | 238 CFX_FontMgr(); |
238 ~CFX_FontMgr(); | 239 ~CFX_FontMgr(); |
| 240 |
239 void InitFTLibrary(); | 241 void InitFTLibrary(); |
240 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, | 242 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, |
241 int weight, | 243 int weight, |
242 FX_BOOL bItalic, | 244 FX_BOOL bItalic, |
243 uint8_t*& pFontData); | 245 uint8_t*& pFontData); |
244 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, | 246 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, |
245 int weight, | 247 int weight, |
246 FX_BOOL bItalic, | 248 FX_BOOL bItalic, |
247 uint8_t* pData, | 249 uint8_t* pData, |
248 FX_DWORD size, | 250 FX_DWORD size, |
(...skipping 11 matching lines...) Expand all Loading... |
260 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); | 262 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); |
261 void ReleaseFace(FXFT_Face face); | 263 void ReleaseFace(FXFT_Face face); |
262 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); | 264 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); |
263 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, | 265 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, |
264 FX_BOOL bTrueType, | 266 FX_BOOL bTrueType, |
265 FX_DWORD flags, | 267 FX_DWORD flags, |
266 int weight, | 268 int weight, |
267 int italic_angle, | 269 int italic_angle, |
268 int CharsetCP, | 270 int CharsetCP, |
269 CFX_SubstFont* pSubstFont); | 271 CFX_SubstFont* pSubstFont); |
270 void FreeCache(); | |
271 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); | 272 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); |
| 273 CFX_FontMapper* GetBuiltinMapper() const { return m_pBuiltinMapper.get(); } |
| 274 FXFT_Library GetFTLibrary() const { return m_FTLibrary; } |
272 | 275 |
273 CFX_FontMapper* m_pBuiltinMapper; | 276 private: |
| 277 nonstd::unique_ptr<CFX_FontMapper> m_pBuiltinMapper; |
274 std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap; | 278 std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap; |
275 FXFT_Library m_FTLibrary; | 279 FXFT_Library m_FTLibrary; |
276 FoxitFonts m_ExternalFonts[16]; | |
277 }; | 280 }; |
278 | 281 |
279 class IFX_FontEnumerator { | 282 class IFX_FontEnumerator { |
280 public: | 283 public: |
281 virtual void HitFont() = 0; | 284 virtual void HitFont() = 0; |
282 | 285 |
283 virtual void Finish() = 0; | 286 virtual void Finish() = 0; |
284 | 287 |
285 protected: | 288 protected: |
286 virtual ~IFX_FontEnumerator() {} | 289 virtual ~IFX_FontEnumerator() {} |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 | 524 |
522 protected: | 525 protected: |
523 virtual ~IFX_GSUBTable() {} | 526 virtual ~IFX_GSUBTable() {} |
524 }; | 527 }; |
525 | 528 |
526 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name); | 529 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name); |
527 | 530 |
528 int PDF_GetStandardFontName(CFX_ByteString* name); | 531 int PDF_GetStandardFontName(CFX_ByteString* name); |
529 | 532 |
530 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 533 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
OLD | NEW |