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> |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 static IFX_SystemFontInfo* CreateDefault(const char** pUserPaths); | 358 static IFX_SystemFontInfo* CreateDefault(const char** pUserPaths); |
359 virtual void Release() = 0; | 359 virtual void Release() = 0; |
360 | 360 |
361 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; | 361 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; |
362 virtual void* MapFont(int weight, | 362 virtual void* MapFont(int weight, |
363 FX_BOOL bItalic, | 363 FX_BOOL bItalic, |
364 int charset, | 364 int charset, |
365 int pitch_family, | 365 int pitch_family, |
366 const FX_CHAR* face, | 366 const FX_CHAR* face, |
367 int& iExact) = 0; | 367 int& iExact) = 0; |
| 368 |
368 #ifdef PDF_ENABLE_XFA | 369 #ifdef PDF_ENABLE_XFA |
369 virtual void* MapFontByUnicode(FX_DWORD dwUnicode, | 370 virtual void* MapFontByUnicode(FX_DWORD dwUnicode, |
370 int weight, | 371 int weight, |
371 FX_BOOL bItalic, | 372 FX_BOOL bItalic, |
372 int pitch_family) { | 373 int pitch_family); |
373 return NULL; | |
374 } | |
375 #endif // PDF_ENABLE_XFA | 374 #endif // PDF_ENABLE_XFA |
| 375 |
376 virtual void* GetFont(const FX_CHAR* face) = 0; | 376 virtual void* GetFont(const FX_CHAR* face) = 0; |
377 virtual FX_DWORD GetFontData(void* hFont, | 377 virtual FX_DWORD GetFontData(void* hFont, |
378 FX_DWORD table, | 378 FX_DWORD table, |
379 uint8_t* buffer, | 379 uint8_t* buffer, |
380 FX_DWORD size) = 0; | 380 FX_DWORD size) = 0; |
381 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; | 381 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; |
382 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; | 382 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; |
383 virtual int GetFaceIndex(void* hFont) { return 0; } | 383 virtual int GetFaceIndex(void* hFont); |
384 virtual void DeleteFont(void* hFont) = 0; | 384 virtual void DeleteFont(void* hFont) = 0; |
385 virtual void* RetainFont(void* hFont) { return NULL; } | 385 virtual void* RetainFont(void* hFont); |
386 | 386 |
387 protected: | 387 protected: |
388 virtual ~IFX_SystemFontInfo() {} | 388 virtual ~IFX_SystemFontInfo() {} |
389 }; | 389 }; |
390 | 390 |
391 class CFX_FolderFontInfo : public IFX_SystemFontInfo { | 391 class CFX_FolderFontInfo : public IFX_SystemFontInfo { |
392 public: | 392 public: |
393 CFX_FolderFontInfo(); | 393 CFX_FolderFontInfo(); |
394 ~CFX_FolderFontInfo() override; | 394 ~CFX_FolderFontInfo() override; |
395 void AddPath(const CFX_ByteStringC& path); | 395 void AddPath(const CFX_ByteStringC& path); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 }; | 439 }; |
440 | 440 |
441 class CFX_CountedFaceCache { | 441 class CFX_CountedFaceCache { |
442 public: | 442 public: |
443 CFX_FaceCache* m_Obj; | 443 CFX_FaceCache* m_Obj; |
444 FX_DWORD m_nCount; | 444 FX_DWORD m_nCount; |
445 }; | 445 }; |
446 | 446 |
447 class CFX_FontCache { | 447 class CFX_FontCache { |
448 public: | 448 public: |
| 449 CFX_FontCache(); |
449 ~CFX_FontCache(); | 450 ~CFX_FontCache(); |
450 CFX_FaceCache* GetCachedFace(CFX_Font* pFont); | 451 CFX_FaceCache* GetCachedFace(CFX_Font* pFont); |
451 void ReleaseCachedFace(CFX_Font* pFont); | 452 void ReleaseCachedFace(CFX_Font* pFont); |
452 void FreeCache(FX_BOOL bRelease = FALSE); | 453 void FreeCache(FX_BOOL bRelease = FALSE); |
453 | 454 |
454 private: | 455 private: |
455 using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>; | 456 using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>; |
456 CFX_FTCacheMap m_FTFaceMap; | 457 CFX_FTCacheMap m_FTFaceMap; |
457 CFX_FTCacheMap m_ExtFaceMap; | 458 CFX_FTCacheMap m_ExtFaceMap; |
458 }; | 459 }; |
| 460 |
459 class CFX_AutoFontCache { | 461 class CFX_AutoFontCache { |
460 public: | 462 public: |
461 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) | 463 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) |
462 : m_pFontCache(pFontCache), m_pFont(pFont) {} | 464 : m_pFontCache(pFontCache), m_pFont(pFont) {} |
463 ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); } | 465 ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); } |
464 CFX_FontCache* m_pFontCache; | 466 CFX_FontCache* m_pFontCache; |
465 CFX_Font* m_pFont; | 467 CFX_Font* m_pFont; |
466 }; | 468 }; |
467 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) \ | 469 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) \ |
468 CFX_AutoFontCache autoFontCache((pFontCache), (pFont)) | 470 CFX_AutoFontCache autoFontCache((pFontCache), (pFont)) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 | 538 |
537 protected: | 539 protected: |
538 virtual ~IFX_GSUBTable() {} | 540 virtual ~IFX_GSUBTable() {} |
539 }; | 541 }; |
540 | 542 |
541 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name); | 543 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name); |
542 | 544 |
543 int PDF_GetStandardFontName(CFX_ByteString* name); | 545 int PDF_GetStandardFontName(CFX_ByteString* name); |
544 | 546 |
545 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 547 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
OLD | NEW |