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_CIDFONT 0x100000 | 36 #define FXFONT_CIDFONT 0x100000 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); | 219 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); |
215 void ReleaseFace(FXFT_Face face); | 220 void ReleaseFace(FXFT_Face face); |
216 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); | 221 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); |
217 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, | 222 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, |
218 FX_BOOL bTrueType, | 223 FX_BOOL bTrueType, |
219 FX_DWORD flags, | 224 FX_DWORD flags, |
220 int weight, | 225 int weight, |
221 int italic_angle, | 226 int italic_angle, |
222 int CharsetCP, | 227 int CharsetCP, |
223 CFX_SubstFont* pSubstFont); | 228 CFX_SubstFont* pSubstFont); |
| 229 void FreeCache(); |
| 230 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); |
224 | 231 |
225 void FreeCache(); | |
226 | |
227 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); | |
228 CFX_FontMapper* m_pBuiltinMapper; | 232 CFX_FontMapper* m_pBuiltinMapper; |
229 CFX_MapByteStringToPtr m_FaceMap; | 233 std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap; |
230 FXFT_Library m_FTLibrary; | 234 FXFT_Library m_FTLibrary; |
231 FoxitFonts m_ExternalFonts[16]; | 235 FoxitFonts m_ExternalFonts[16]; |
232 }; | 236 }; |
233 | 237 |
234 class IFX_FontEnumerator { | 238 class IFX_FontEnumerator { |
235 public: | 239 public: |
236 virtual void HitFont() = 0; | 240 virtual void HitFont() = 0; |
237 | 241 |
238 virtual void Finish() = 0; | 242 virtual void Finish() = 0; |
239 | 243 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 void* GetFont(const FX_CHAR* face) override; | 341 void* GetFont(const FX_CHAR* face) override; |
338 FX_DWORD GetFontData(void* hFont, | 342 FX_DWORD GetFontData(void* hFont, |
339 FX_DWORD table, | 343 FX_DWORD table, |
340 uint8_t* buffer, | 344 uint8_t* buffer, |
341 FX_DWORD size) override; | 345 FX_DWORD size) override; |
342 void DeleteFont(void* hFont) override; | 346 void DeleteFont(void* hFont) override; |
343 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; | 347 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; |
344 FX_BOOL GetFontCharset(void* hFont, int& charset) override; | 348 FX_BOOL GetFontCharset(void* hFont, int& charset) override; |
345 | 349 |
346 protected: | 350 protected: |
347 CFX_MapByteStringToPtr m_FontList; | 351 std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList; |
348 CFX_ByteStringArray m_PathList; | 352 CFX_ByteStringArray m_PathList; |
349 CFX_FontMapper* m_pMapper; | 353 CFX_FontMapper* m_pMapper; |
350 void ScanPath(CFX_ByteString& path); | 354 void ScanPath(CFX_ByteString& path); |
351 void ScanFile(CFX_ByteString& path); | 355 void ScanFile(CFX_ByteString& path); |
352 void ReportFace(CFX_ByteString& path, | 356 void ReportFace(CFX_ByteString& path, |
353 FXSYS_FILE* pFile, | 357 FXSYS_FILE* pFile, |
354 FX_DWORD filesize, | 358 FX_DWORD filesize, |
355 FX_DWORD offset); | 359 FX_DWORD offset); |
356 }; | 360 }; |
357 class CFX_CountedFaceCache { | 361 class CFX_CountedFaceCache { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 const CFX_AffineMatrix* pMatrix, | 421 const CFX_AffineMatrix* pMatrix, |
418 int dest_width, | 422 int dest_width, |
419 int anti_alias); | 423 int anti_alias); |
420 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, | 424 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, |
421 const CFX_AffineMatrix* pMatrix, | 425 const CFX_AffineMatrix* pMatrix, |
422 CFX_ByteStringC& FaceGlyphsKey, | 426 CFX_ByteStringC& FaceGlyphsKey, |
423 FX_DWORD glyph_index, | 427 FX_DWORD glyph_index, |
424 FX_BOOL bFontStyle, | 428 FX_BOOL bFontStyle, |
425 int dest_width, | 429 int dest_width, |
426 int anti_alias); | 430 int anti_alias); |
427 CFX_MapByteStringToPtr m_SizeMap; | 431 std::map<CFX_ByteString, CFX_SizeGlyphCache*> m_SizeMap; |
428 CFX_MapPtrToPtr m_PathMap; | 432 CFX_MapPtrToPtr m_PathMap; |
429 CFX_DIBitmap* m_pBitmap; | 433 CFX_DIBitmap* m_pBitmap; |
430 | 434 |
431 void InitPlatform(); | 435 void InitPlatform(); |
432 void DestroyPlatform(); | 436 void DestroyPlatform(); |
433 }; | 437 }; |
434 typedef struct { | 438 typedef struct { |
435 const CFX_GlyphBitmap* m_pGlyph; | 439 const CFX_GlyphBitmap* m_pGlyph; |
436 int m_OriginX, m_OriginY; | 440 int m_OriginX, m_OriginY; |
437 FX_FLOAT m_fOriginX, m_fOriginY; | 441 FX_FLOAT m_fOriginX, m_fOriginY; |
438 } FXTEXT_GLYPHPOS; | 442 } FXTEXT_GLYPHPOS; |
439 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, | 443 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, |
440 int nChars, | 444 int nChars, |
441 int anti_alias, | 445 int anti_alias, |
442 FX_FLOAT retinaScaleX = 1.0f, | 446 FX_FLOAT retinaScaleX = 1.0f, |
443 FX_FLOAT retinaScaleY = 1.0f); | 447 FX_FLOAT retinaScaleY = 1.0f); |
444 | 448 |
445 class IFX_GSUBTable { | 449 class IFX_GSUBTable { |
446 public: | 450 public: |
447 static IFX_GSUBTable* Create(CFX_Font* pFont); | 451 static IFX_GSUBTable* Create(CFX_Font* pFont); |
448 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | 452 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; |
449 | 453 |
450 protected: | 454 protected: |
451 virtual ~IFX_GSUBTable() {} | 455 virtual ~IFX_GSUBTable() {} |
452 }; | 456 }; |
453 | 457 |
454 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 458 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
OLD | NEW |