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 "../fxcrt/fx_system.h" | 12 #include "../fxcrt/fx_system.h" |
13 #include "fx_dib.h" | 13 #include "fx_dib.h" |
14 | 14 |
15 typedef struct FT_FaceRec_* FXFT_Face; | 15 typedef struct FT_FaceRec_* FXFT_Face; |
16 typedef void* FXFT_Library; | 16 typedef void* FXFT_Library; |
17 class CFontFileFaceInfo; | 17 |
18 class CFX_FaceCache; | 18 class CFX_FaceCache; |
| 19 class CFX_FontFaceInfo; |
19 class CFX_FontMapper; | 20 class CFX_FontMapper; |
20 class CFX_PathData; | 21 class CFX_PathData; |
| 22 class CFX_SizeGlyphCache; |
21 class CFX_SubstFont; | 23 class CFX_SubstFont; |
| 24 class CFontFileFaceInfo; |
| 25 class CTTFontDesc; |
| 26 class IFX_FontEncoding; |
22 class IFX_SystemFontInfo; | 27 class IFX_SystemFontInfo; |
23 | 28 |
24 #define FXFONT_FIXED_PITCH 0x01 | 29 #define FXFONT_FIXED_PITCH 0x01 |
25 #define FXFONT_SERIF 0x02 | 30 #define FXFONT_SERIF 0x02 |
26 #define FXFONT_SYMBOLIC 0x04 | 31 #define FXFONT_SYMBOLIC 0x04 |
27 #define FXFONT_SCRIPT 0x08 | 32 #define FXFONT_SCRIPT 0x08 |
28 #define FXFONT_ITALIC 0x40 | 33 #define FXFONT_ITALIC 0x40 |
29 #define FXFONT_BOLD 0x40000 | 34 #define FXFONT_BOLD 0x40000 |
30 #define FXFONT_USEEXTERNATTR 0x80000 | 35 #define FXFONT_USEEXTERNATTR 0x80000 |
31 #define FXFONT_EXACTMATCH 0x80000000 | 36 #define FXFONT_EXACTMATCH 0x80000000 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); | 253 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); |
249 void ReleaseFace(FXFT_Face face); | 254 void ReleaseFace(FXFT_Face face); |
250 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); | 255 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); |
251 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, | 256 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, |
252 FX_BOOL bTrueType, | 257 FX_BOOL bTrueType, |
253 FX_DWORD flags, | 258 FX_DWORD flags, |
254 int weight, | 259 int weight, |
255 int italic_angle, | 260 int italic_angle, |
256 int CharsetCP, | 261 int CharsetCP, |
257 CFX_SubstFont* pSubstFont); | 262 CFX_SubstFont* pSubstFont); |
| 263 void FreeCache(); |
| 264 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); |
258 | 265 |
259 void FreeCache(); | |
260 | |
261 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); | |
262 CFX_FontMapper* m_pBuiltinMapper; | 266 CFX_FontMapper* m_pBuiltinMapper; |
263 CFX_MapByteStringToPtr m_FaceMap; | 267 std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap; |
264 FXFT_Library m_FTLibrary; | 268 FXFT_Library m_FTLibrary; |
265 FoxitFonts m_ExternalFonts[16]; | 269 FoxitFonts m_ExternalFonts[16]; |
266 }; | 270 }; |
267 | 271 |
268 class IFX_FontEnumerator { | 272 class IFX_FontEnumerator { |
269 public: | 273 public: |
270 virtual void HitFont() = 0; | 274 virtual void HitFont() = 0; |
271 | 275 |
272 virtual void Finish() = 0; | 276 virtual void Finish() = 0; |
273 | 277 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 void* GetFont(const FX_CHAR* face) override; | 395 void* GetFont(const FX_CHAR* face) override; |
392 FX_DWORD GetFontData(void* hFont, | 396 FX_DWORD GetFontData(void* hFont, |
393 FX_DWORD table, | 397 FX_DWORD table, |
394 uint8_t* buffer, | 398 uint8_t* buffer, |
395 FX_DWORD size) override; | 399 FX_DWORD size) override; |
396 void DeleteFont(void* hFont) override; | 400 void DeleteFont(void* hFont) override; |
397 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; | 401 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; |
398 FX_BOOL GetFontCharset(void* hFont, int& charset) override; | 402 FX_BOOL GetFontCharset(void* hFont, int& charset) override; |
399 | 403 |
400 protected: | 404 protected: |
401 CFX_MapByteStringToPtr m_FontList; | 405 std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList; |
402 CFX_ByteStringArray m_PathList; | 406 CFX_ByteStringArray m_PathList; |
403 CFX_FontMapper* m_pMapper; | 407 CFX_FontMapper* m_pMapper; |
404 void ScanPath(CFX_ByteString& path); | 408 void ScanPath(CFX_ByteString& path); |
405 void ScanFile(CFX_ByteString& path); | 409 void ScanFile(CFX_ByteString& path); |
406 void ReportFace(CFX_ByteString& path, | 410 void ReportFace(CFX_ByteString& path, |
407 FXSYS_FILE* pFile, | 411 FXSYS_FILE* pFile, |
408 FX_DWORD filesize, | 412 FX_DWORD filesize, |
409 FX_DWORD offset); | 413 FX_DWORD offset); |
410 }; | 414 }; |
411 class CFX_CountedFaceCache { | 415 class CFX_CountedFaceCache { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 const CFX_AffineMatrix* pMatrix, | 475 const CFX_AffineMatrix* pMatrix, |
472 int dest_width, | 476 int dest_width, |
473 int anti_alias); | 477 int anti_alias); |
474 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, | 478 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, |
475 const CFX_AffineMatrix* pMatrix, | 479 const CFX_AffineMatrix* pMatrix, |
476 CFX_ByteStringC& FaceGlyphsKey, | 480 CFX_ByteStringC& FaceGlyphsKey, |
477 FX_DWORD glyph_index, | 481 FX_DWORD glyph_index, |
478 FX_BOOL bFontStyle, | 482 FX_BOOL bFontStyle, |
479 int dest_width, | 483 int dest_width, |
480 int anti_alias); | 484 int anti_alias); |
481 CFX_MapByteStringToPtr m_SizeMap; | 485 std::map<CFX_ByteString, CFX_SizeGlyphCache*> m_SizeMap; |
482 CFX_MapPtrToPtr m_PathMap; | 486 CFX_MapPtrToPtr m_PathMap; |
483 CFX_DIBitmap* m_pBitmap; | 487 CFX_DIBitmap* m_pBitmap; |
484 | 488 |
485 void InitPlatform(); | 489 void InitPlatform(); |
486 void DestroyPlatform(); | 490 void DestroyPlatform(); |
487 }; | 491 }; |
488 typedef struct { | 492 typedef struct { |
489 const CFX_GlyphBitmap* m_pGlyph; | 493 const CFX_GlyphBitmap* m_pGlyph; |
490 int m_OriginX, m_OriginY; | 494 int m_OriginX, m_OriginY; |
491 FX_FLOAT m_fOriginX, m_fOriginY; | 495 FX_FLOAT m_fOriginX, m_fOriginY; |
492 } FXTEXT_GLYPHPOS; | 496 } FXTEXT_GLYPHPOS; |
493 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, | 497 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, |
494 int nChars, | 498 int nChars, |
495 int anti_alias, | 499 int anti_alias, |
496 FX_FLOAT retinaScaleX = 1.0f, | 500 FX_FLOAT retinaScaleX = 1.0f, |
497 FX_FLOAT retinaScaleY = 1.0f); | 501 FX_FLOAT retinaScaleY = 1.0f); |
498 | 502 |
499 class IFX_GSUBTable { | 503 class IFX_GSUBTable { |
500 public: | 504 public: |
501 static IFX_GSUBTable* Create(CFX_Font* pFont); | 505 static IFX_GSUBTable* Create(CFX_Font* pFont); |
502 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | 506 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; |
503 | 507 |
504 protected: | 508 protected: |
505 virtual ~IFX_GSUBTable() {} | 509 virtual ~IFX_GSUBTable() {} |
506 }; | 510 }; |
507 | 511 |
508 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 512 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
OLD | NEW |