| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 CFX_Font* pFont, | 182 CFX_Font* pFont, |
| 183 FX_DWORD nEncodingID = FXFM_ENCODING_NONE); | 183 FX_DWORD nEncodingID = FXFM_ENCODING_NONE); |
| 184 | 184 |
| 185 #define FXFONT_SUBST_MM 0x01 | 185 #define FXFONT_SUBST_MM 0x01 |
| 186 #define FXFONT_SUBST_GLYPHPATH 0x04 | 186 #define FXFONT_SUBST_GLYPHPATH 0x04 |
| 187 #define FXFONT_SUBST_CLEARTYPE 0x08 | 187 #define FXFONT_SUBST_CLEARTYPE 0x08 |
| 188 #define FXFONT_SUBST_TRANSFORM 0x10 | 188 #define FXFONT_SUBST_TRANSFORM 0x10 |
| 189 #define FXFONT_SUBST_NONSYMBOL 0x20 | 189 #define FXFONT_SUBST_NONSYMBOL 0x20 |
| 190 #define FXFONT_SUBST_EXACT 0x40 | 190 #define FXFONT_SUBST_EXACT 0x40 |
| 191 #define FXFONT_SUBST_STANDARD 0x80 | 191 #define FXFONT_SUBST_STANDARD 0x80 |
| 192 |
| 192 class CFX_SubstFont { | 193 class CFX_SubstFont { |
| 193 public: | 194 public: |
| 194 CFX_SubstFont(); | 195 CFX_SubstFont(); |
| 195 | 196 |
| 196 void* m_ExtHandle; | 197 void* m_ExtHandle; |
| 197 | 198 |
| 198 CFX_ByteString m_Family; | 199 CFX_ByteString m_Family; |
| 199 | 200 |
| 200 int m_Charset; | 201 int m_Charset; |
| 201 | 202 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) \ | 445 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) \ |
| 445 CFX_AutoFontCache autoFontCache((pFontCache), (pFont)) | 446 CFX_AutoFontCache autoFontCache((pFontCache), (pFont)) |
| 446 class CFX_GlyphBitmap { | 447 class CFX_GlyphBitmap { |
| 447 public: | 448 public: |
| 448 int m_Top; | 449 int m_Top; |
| 449 int m_Left; | 450 int m_Left; |
| 450 CFX_DIBitmap m_Bitmap; | 451 CFX_DIBitmap m_Bitmap; |
| 451 }; | 452 }; |
| 452 class CFX_FaceCache { | 453 class CFX_FaceCache { |
| 453 public: | 454 public: |
| 455 explicit CFX_FaceCache(FXFT_Face face); |
| 454 ~CFX_FaceCache(); | 456 ~CFX_FaceCache(); |
| 455 const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, | 457 const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, |
| 456 FX_DWORD glyph_index, | 458 FX_DWORD glyph_index, |
| 457 FX_BOOL bFontStyle, | 459 FX_BOOL bFontStyle, |
| 458 const CFX_AffineMatrix* pMatrix, | 460 const CFX_AffineMatrix* pMatrix, |
| 459 int dest_width, | 461 int dest_width, |
| 460 int anti_alias, | 462 int anti_alias, |
| 461 int& text_flags); | 463 int& text_flags); |
| 462 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, | 464 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, |
| 463 FX_DWORD glyph_index, | 465 FX_DWORD glyph_index, |
| 464 int dest_width); | 466 int dest_width); |
| 465 | 467 |
| 466 CFX_FaceCache(FXFT_Face face); | |
| 467 | |
| 468 private: | 468 private: |
| 469 FXFT_Face m_Face; | |
| 470 CFX_GlyphBitmap* RenderGlyph(CFX_Font* pFont, | 469 CFX_GlyphBitmap* RenderGlyph(CFX_Font* pFont, |
| 471 FX_DWORD glyph_index, | 470 FX_DWORD glyph_index, |
| 472 FX_BOOL bFontStyle, | 471 FX_BOOL bFontStyle, |
| 473 const CFX_AffineMatrix* pMatrix, | 472 const CFX_AffineMatrix* pMatrix, |
| 474 int dest_width, | 473 int dest_width, |
| 475 int anti_alias); | 474 int anti_alias); |
| 476 CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, | 475 CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, |
| 477 FX_DWORD glyph_index, | 476 FX_DWORD glyph_index, |
| 478 const CFX_AffineMatrix* pMatrix, | 477 const CFX_AffineMatrix* pMatrix, |
| 479 int dest_width, | 478 int dest_width, |
| 480 int anti_alias); | 479 int anti_alias); |
| 481 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, | 480 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, |
| 482 const CFX_AffineMatrix* pMatrix, | 481 const CFX_AffineMatrix* pMatrix, |
| 483 CFX_ByteStringC& FaceGlyphsKey, | 482 CFX_ByteStringC& FaceGlyphsKey, |
| 484 FX_DWORD glyph_index, | 483 FX_DWORD glyph_index, |
| 485 FX_BOOL bFontStyle, | 484 FX_BOOL bFontStyle, |
| 486 int dest_width, | 485 int dest_width, |
| 487 int anti_alias); | 486 int anti_alias); |
| 487 void InitPlatform(); |
| 488 void DestroyPlatform(); |
| 489 |
| 490 FXFT_Face const m_Face; |
| 488 std::map<CFX_ByteString, CFX_SizeGlyphCache*> m_SizeMap; | 491 std::map<CFX_ByteString, CFX_SizeGlyphCache*> m_SizeMap; |
| 489 CFX_MapPtrToPtr m_PathMap; | 492 CFX_MapPtrToPtr m_PathMap; |
| 490 CFX_DIBitmap* m_pBitmap; | 493 CFX_DIBitmap* m_pBitmap; |
| 494 }; |
| 491 | 495 |
| 492 void InitPlatform(); | 496 struct FXTEXT_GLYPHPOS { |
| 493 void DestroyPlatform(); | 497 const CFX_GlyphBitmap* m_pGlyph; |
| 498 int m_OriginX; |
| 499 int m_OriginY; |
| 500 FX_FLOAT m_fOriginX; |
| 501 FX_FLOAT m_fOriginY; |
| 494 }; | 502 }; |
| 495 typedef struct { | 503 |
| 496 const CFX_GlyphBitmap* m_pGlyph; | |
| 497 int m_OriginX, m_OriginY; | |
| 498 FX_FLOAT m_fOriginX, m_fOriginY; | |
| 499 } FXTEXT_GLYPHPOS; | |
| 500 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, | 504 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, |
| 501 int nChars, | 505 int nChars, |
| 502 int anti_alias, | 506 int anti_alias, |
| 503 FX_FLOAT retinaScaleX = 1.0f, | 507 FX_FLOAT retinaScaleX = 1.0f, |
| 504 FX_FLOAT retinaScaleY = 1.0f); | 508 FX_FLOAT retinaScaleY = 1.0f); |
| 505 | 509 |
| 506 class IFX_GSUBTable { | 510 class IFX_GSUBTable { |
| 507 public: | 511 public: |
| 508 static IFX_GSUBTable* Create(CFX_Font* pFont); | 512 static IFX_GSUBTable* Create(CFX_Font* pFont); |
| 509 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | 513 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; |
| 510 | 514 |
| 511 protected: | 515 protected: |
| 512 virtual ~IFX_GSUBTable() {} | 516 virtual ~IFX_GSUBTable() {} |
| 513 }; | 517 }; |
| 514 | 518 |
| 515 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name); | 519 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name); |
| 516 | 520 |
| 517 int PDF_GetStandardFontName(CFX_ByteString* name); | 521 int PDF_GetStandardFontName(CFX_ByteString* name); |
| 518 | 522 |
| 519 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 523 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
| OLD | NEW |