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