| 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 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "core/fxcrt/include/fx_system.h" | 14 #include "core/fxcrt/include/fx_system.h" |
| 15 #include "core/include/fxge/fx_dib.h" | 15 #include "core/include/fxge/fx_dib.h" |
| 16 #include "core/include/fxge/fx_freetype.h" | 16 #include "core/include/fxge/fx_freetype.h" |
| 17 | 17 |
| 18 typedef struct FT_FaceRec_* FXFT_Face; | 18 typedef struct FT_FaceRec_* FXFT_Face; |
| 19 typedef void* FXFT_Library; | 19 typedef void* FXFT_Library; |
| 20 | 20 |
| 21 class CFX_FaceCache; | 21 class CFX_FaceCache; |
| 22 class CFX_FontFaceInfo; | 22 class CFX_FontFaceInfo; |
| 23 class CFX_FontMapper; | 23 class CFX_FontMapper; |
| 24 class CFX_PathData; | 24 class CFX_PathData; |
| 25 class CFX_SizeGlyphCache; | 25 class CFX_SizeGlyphCache; |
| 26 class CFX_SubstFont; | 26 class CFX_SubstFont; |
| 27 class CTTFontDesc; | 27 class CTTFontDesc; |
| 28 class IFX_SystemFontInfo; | 28 class IFX_SystemFontInfo; |
| 29 | 29 |
| 30 #ifdef _SKIA_SUPPORT_ |
| 31 class SkTypeface; |
| 32 |
| 33 using CFX_TypeFace = SkTypeface; |
| 34 #endif |
| 35 |
| 30 #define FXFONT_FIXED_PITCH 0x01 | 36 #define FXFONT_FIXED_PITCH 0x01 |
| 31 #define FXFONT_SERIF 0x02 | 37 #define FXFONT_SERIF 0x02 |
| 32 #define FXFONT_SYMBOLIC 0x04 | 38 #define FXFONT_SYMBOLIC 0x04 |
| 33 #define FXFONT_SCRIPT 0x08 | 39 #define FXFONT_SCRIPT 0x08 |
| 34 #define FXFONT_ITALIC 0x40 | 40 #define FXFONT_ITALIC 0x40 |
| 35 #define FXFONT_BOLD 0x40000 | 41 #define FXFONT_BOLD 0x40000 |
| 36 #define FXFONT_USEEXTERNATTR 0x80000 | 42 #define FXFONT_USEEXTERNATTR 0x80000 |
| 37 #define FXFONT_CIDFONT 0x100000 | 43 #define FXFONT_CIDFONT 0x100000 |
| 38 #ifdef PDF_ENABLE_XFA | 44 #ifdef PDF_ENABLE_XFA |
| 39 #define FXFONT_EXACTMATCH 0x80000000 | 45 #define FXFONT_EXACTMATCH 0x80000000 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 uint32_t m_nCount; | 451 uint32_t m_nCount; |
| 446 }; | 452 }; |
| 447 | 453 |
| 448 class CFX_FontCache { | 454 class CFX_FontCache { |
| 449 public: | 455 public: |
| 450 CFX_FontCache(); | 456 CFX_FontCache(); |
| 451 ~CFX_FontCache(); | 457 ~CFX_FontCache(); |
| 452 CFX_FaceCache* GetCachedFace(CFX_Font* pFont); | 458 CFX_FaceCache* GetCachedFace(CFX_Font* pFont); |
| 453 void ReleaseCachedFace(CFX_Font* pFont); | 459 void ReleaseCachedFace(CFX_Font* pFont); |
| 454 void FreeCache(FX_BOOL bRelease = FALSE); | 460 void FreeCache(FX_BOOL bRelease = FALSE); |
| 461 #ifdef _SKIA_SUPPORT_ |
| 462 CFX_TypeFace* GetDeviceCache(CFX_Font* pFont); |
| 463 #endif |
| 455 | 464 |
| 456 private: | 465 private: |
| 457 using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>; | 466 using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>; |
| 458 CFX_FTCacheMap m_FTFaceMap; | 467 CFX_FTCacheMap m_FTFaceMap; |
| 459 CFX_FTCacheMap m_ExtFaceMap; | 468 CFX_FTCacheMap m_ExtFaceMap; |
| 460 }; | 469 }; |
| 461 | 470 |
| 462 class CFX_AutoFontCache { | 471 class CFX_AutoFontCache { |
| 463 public: | 472 public: |
| 464 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) | 473 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 483 uint32_t glyph_index, | 492 uint32_t glyph_index, |
| 484 FX_BOOL bFontStyle, | 493 FX_BOOL bFontStyle, |
| 485 const CFX_Matrix* pMatrix, | 494 const CFX_Matrix* pMatrix, |
| 486 int dest_width, | 495 int dest_width, |
| 487 int anti_alias, | 496 int anti_alias, |
| 488 int& text_flags); | 497 int& text_flags); |
| 489 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, | 498 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, |
| 490 uint32_t glyph_index, | 499 uint32_t glyph_index, |
| 491 int dest_width); | 500 int dest_width); |
| 492 | 501 |
| 502 #ifdef _SKIA_SUPPORT_ |
| 503 CFX_TypeFace* GetDeviceCache(CFX_Font* pFont); |
| 504 #endif |
| 505 |
| 493 private: | 506 private: |
| 494 CFX_GlyphBitmap* RenderGlyph(CFX_Font* pFont, | 507 CFX_GlyphBitmap* RenderGlyph(CFX_Font* pFont, |
| 495 uint32_t glyph_index, | 508 uint32_t glyph_index, |
| 496 FX_BOOL bFontStyle, | 509 FX_BOOL bFontStyle, |
| 497 const CFX_Matrix* pMatrix, | 510 const CFX_Matrix* pMatrix, |
| 498 int dest_width, | 511 int dest_width, |
| 499 int anti_alias); | 512 int anti_alias); |
| 500 CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, | 513 CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, |
| 501 uint32_t glyph_index, | 514 uint32_t glyph_index, |
| 502 const CFX_Matrix* pMatrix, | 515 const CFX_Matrix* pMatrix, |
| 503 int dest_width, | 516 int dest_width, |
| 504 int anti_alias); | 517 int anti_alias); |
| 505 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, | 518 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, |
| 506 const CFX_Matrix* pMatrix, | 519 const CFX_Matrix* pMatrix, |
| 507 CFX_ByteStringC& FaceGlyphsKey, | 520 CFX_ByteStringC& FaceGlyphsKey, |
| 508 uint32_t glyph_index, | 521 uint32_t glyph_index, |
| 509 FX_BOOL bFontStyle, | 522 FX_BOOL bFontStyle, |
| 510 int dest_width, | 523 int dest_width, |
| 511 int anti_alias); | 524 int anti_alias); |
| 512 void InitPlatform(); | 525 void InitPlatform(); |
| 513 void DestroyPlatform(); | 526 void DestroyPlatform(); |
| 514 | 527 |
| 515 FXFT_Face const m_Face; | 528 FXFT_Face const m_Face; |
| 516 std::map<CFX_ByteString, CFX_SizeGlyphCache*> m_SizeMap; | 529 std::map<CFX_ByteString, CFX_SizeGlyphCache*> m_SizeMap; |
| 517 std::map<uint32_t, CFX_PathData*> m_PathMap; | 530 std::map<uint32_t, CFX_PathData*> m_PathMap; |
| 518 CFX_DIBitmap* m_pBitmap; | 531 CFX_DIBitmap* m_pBitmap; |
| 532 #ifdef _SKIA_SUPPORT_ |
| 533 CFX_TypeFace* m_pTypeface; |
| 534 #endif |
| 519 }; | 535 }; |
| 520 | 536 |
| 521 struct FXTEXT_GLYPHPOS { | 537 struct FXTEXT_GLYPHPOS { |
| 522 const CFX_GlyphBitmap* m_pGlyph; | 538 const CFX_GlyphBitmap* m_pGlyph; |
| 523 int m_OriginX; | 539 int m_OriginX; |
| 524 int m_OriginY; | 540 int m_OriginY; |
| 525 FX_FLOAT m_fOriginX; | 541 FX_FLOAT m_fOriginX; |
| 526 FX_FLOAT m_fOriginY; | 542 FX_FLOAT m_fOriginY; |
| 527 }; | 543 }; |
| 528 | 544 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 541 virtual ~IFX_GSUBTable() {} | 557 virtual ~IFX_GSUBTable() {} |
| 542 }; | 558 }; |
| 543 | 559 |
| 544 CFX_ByteString GetNameFromTT(const uint8_t* name_table, | 560 CFX_ByteString GetNameFromTT(const uint8_t* name_table, |
| 545 uint32_t name_table_size, | 561 uint32_t name_table_size, |
| 546 uint32_t name); | 562 uint32_t name); |
| 547 | 563 |
| 548 int PDF_GetStandardFontName(CFX_ByteString* name); | 564 int PDF_GetStandardFontName(CFX_ByteString* name); |
| 549 | 565 |
| 550 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 566 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
| OLD | NEW |