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_FXGE_INCLUDE_FX_FONT_H_ | 7 #ifndef CORE_FXGE_INCLUDE_FX_FONT_H_ |
8 #define CORE_FXGE_INCLUDE_FX_FONT_H_ | 8 #define CORE_FXGE_INCLUDE_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/fxge/include/fx_dib.h" | 15 #include "core/fxge/include/fx_dib.h" |
16 #include "core/fxge/include/fx_freetype.h" | 16 #include "core/fxge/include/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; | |
23 class CFX_FontMapper; | 22 class CFX_FontMapper; |
24 class CFX_PathData; | 23 class CFX_PathData; |
25 class CFX_SizeGlyphCache; | 24 class CFX_SizeGlyphCache; |
26 class CFX_SubstFont; | 25 class CFX_SubstFont; |
27 class CTTFontDesc; | 26 class CTTFontDesc; |
28 class IFX_SystemFontInfo; | 27 class IFX_SystemFontInfo; |
29 | 28 |
30 #ifdef _SKIA_SUPPORT_ | 29 #ifdef _SKIA_SUPPORT_ |
31 class SkTypeface; | 30 class SkTypeface; |
32 | 31 |
(...skipping 25 matching lines...) Expand all Loading... |
58 #define FXFONT_TURKISH_CHARSET 162 | 57 #define FXFONT_TURKISH_CHARSET 162 |
59 #define FXFONT_HEBREW_CHARSET 177 | 58 #define FXFONT_HEBREW_CHARSET 177 |
60 #define FXFONT_ARABIC_CHARSET 178 | 59 #define FXFONT_ARABIC_CHARSET 178 |
61 #define FXFONT_BALTIC_CHARSET 186 | 60 #define FXFONT_BALTIC_CHARSET 186 |
62 #define FXFONT_FF_FIXEDPITCH 1 | 61 #define FXFONT_FF_FIXEDPITCH 1 |
63 #define FXFONT_FF_ROMAN (1 << 4) | 62 #define FXFONT_FF_ROMAN (1 << 4) |
64 #define FXFONT_FF_SCRIPT (4 << 4) | 63 #define FXFONT_FF_SCRIPT (4 << 4) |
65 #define FXFONT_FW_NORMAL 400 | 64 #define FXFONT_FW_NORMAL 400 |
66 #define FXFONT_FW_BOLD 700 | 65 #define FXFONT_FW_BOLD 700 |
67 | 66 |
| 67 #define CHARSET_FLAG_ANSI 1 |
| 68 #define CHARSET_FLAG_SYMBOL 2 |
| 69 #define CHARSET_FLAG_SHIFTJIS 4 |
| 70 #define CHARSET_FLAG_BIG5 8 |
| 71 #define CHARSET_FLAG_GB 16 |
| 72 #define CHARSET_FLAG_KOREAN 32 |
| 73 |
68 class CFX_Font { | 74 class CFX_Font { |
69 public: | 75 public: |
70 CFX_Font(); | 76 CFX_Font(); |
71 ~CFX_Font(); | 77 ~CFX_Font(); |
72 | 78 |
73 void LoadSubst(const CFX_ByteString& face_name, | 79 void LoadSubst(const CFX_ByteString& face_name, |
74 FX_BOOL bTrueType, | 80 FX_BOOL bTrueType, |
75 uint32_t flags, | 81 uint32_t flags, |
76 int weight, | 82 int weight, |
77 int italic_angle, | 83 int italic_angle, |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 uint32_t table, | 378 uint32_t table, |
373 uint8_t* buffer, | 379 uint8_t* buffer, |
374 uint32_t size) = 0; | 380 uint32_t size) = 0; |
375 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; | 381 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; |
376 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; | 382 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; |
377 virtual int GetFaceIndex(void* hFont); | 383 virtual int GetFaceIndex(void* hFont); |
378 virtual void DeleteFont(void* hFont) = 0; | 384 virtual void DeleteFont(void* hFont) = 0; |
379 virtual void* RetainFont(void* hFont); | 385 virtual void* RetainFont(void* hFont); |
380 }; | 386 }; |
381 | 387 |
| 388 class CTTFontDesc { |
| 389 public: |
| 390 CTTFontDesc() { |
| 391 m_Type = 0; |
| 392 m_pFontData = nullptr; |
| 393 m_RefCount = 0; |
| 394 } |
| 395 ~CTTFontDesc(); |
| 396 // ret < 0, releaseface not appropriate for this object. |
| 397 // ret == 0, object released |
| 398 // ret > 0, object still alive, other referrers. |
| 399 int ReleaseFace(FXFT_Face face); |
| 400 int m_Type; |
| 401 union { |
| 402 struct { |
| 403 FX_BOOL m_bItalic; |
| 404 FX_BOOL m_bBold; |
| 405 FXFT_Face m_pFace; |
| 406 } m_SingleFace; |
| 407 struct { |
| 408 FXFT_Face m_pFaces[16]; |
| 409 } m_TTCFace; |
| 410 }; |
| 411 uint8_t* m_pFontData; |
| 412 int m_RefCount; |
| 413 }; |
| 414 |
| 415 class CFX_FontFaceInfo { |
| 416 public: |
| 417 CFX_FontFaceInfo(CFX_ByteString filePath, |
| 418 CFX_ByteString faceName, |
| 419 CFX_ByteString fontTables, |
| 420 uint32_t fontOffset, |
| 421 uint32_t fileSize); |
| 422 |
| 423 const CFX_ByteString m_FilePath; |
| 424 const CFX_ByteString m_FaceName; |
| 425 const CFX_ByteString m_FontTables; |
| 426 const uint32_t m_FontOffset; |
| 427 const uint32_t m_FileSize; |
| 428 uint32_t m_Styles; |
| 429 uint32_t m_Charsets; |
| 430 }; |
| 431 |
382 class CFX_FolderFontInfo : public IFX_SystemFontInfo { | 432 class CFX_FolderFontInfo : public IFX_SystemFontInfo { |
383 public: | 433 public: |
384 CFX_FolderFontInfo(); | 434 CFX_FolderFontInfo(); |
385 ~CFX_FolderFontInfo() override; | 435 ~CFX_FolderFontInfo() override; |
386 | 436 |
387 void AddPath(const CFX_ByteStringC& path); | 437 void AddPath(const CFX_ByteStringC& path); |
388 | 438 |
389 // IFX_SytemFontInfo: | 439 // IFX_SytemFontInfo: |
390 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; | 440 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; |
391 void* MapFont(int weight, | 441 void* MapFont(int weight, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 FX_FLOAT retinaScaleX = 1.0f, | 586 FX_FLOAT retinaScaleX = 1.0f, |
537 FX_FLOAT retinaScaleY = 1.0f); | 587 FX_FLOAT retinaScaleY = 1.0f); |
538 | 588 |
539 CFX_ByteString GetNameFromTT(const uint8_t* name_table, | 589 CFX_ByteString GetNameFromTT(const uint8_t* name_table, |
540 uint32_t name_table_size, | 590 uint32_t name_table_size, |
541 uint32_t name); | 591 uint32_t name); |
542 | 592 |
543 int PDF_GetStandardFontName(CFX_ByteString* name); | 593 int PDF_GetStandardFontName(CFX_ByteString* name); |
544 | 594 |
545 #endif // CORE_FXGE_INCLUDE_FX_FONT_H_ | 595 #endif // CORE_FXGE_INCLUDE_FX_FONT_H_ |
OLD | NEW |