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 IFX_FontEncoding; | 17 class CFontFileFaceInfo; |
| 18 class CFX_FaceCache; |
| 19 class CFX_FontMapper; |
18 class CFX_PathData; | 20 class CFX_PathData; |
19 class CFX_SubstFont; | 21 class CFX_SubstFont; |
20 class CFX_FaceCache; | |
21 class CFX_FontMapper; | |
22 class IFX_SystemFontInfo; | 22 class IFX_SystemFontInfo; |
23 class CFontFileFaceInfo; | 23 |
24 #define FXFONT_FIXED_PITCH 0x01 | 24 #define FXFONT_FIXED_PITCH 0x01 |
25 #define FXFONT_SERIF 0x02 | 25 #define FXFONT_SERIF 0x02 |
26 #define FXFONT_SYMBOLIC 0x04 | 26 #define FXFONT_SYMBOLIC 0x04 |
27 #define FXFONT_SCRIPT 0x08 | 27 #define FXFONT_SCRIPT 0x08 |
28 #define FXFONT_ITALIC 0x40 | 28 #define FXFONT_ITALIC 0x40 |
29 #define FXFONT_BOLD 0x40000 | 29 #define FXFONT_BOLD 0x40000 |
30 #define FXFONT_USEEXTERNATTR 0x80000 | 30 #define FXFONT_USEEXTERNATTR 0x80000 |
31 #define FXFONT_EXACTMATCH 0x80000000 | 31 #define FXFONT_EXACTMATCH 0x80000000 |
32 #define FXFONT_CIDFONT 0x100000 | 32 #define FXFONT_CIDFONT 0x100000 |
33 #define FXFONT_ANSI_CHARSET 0 | 33 #define FXFONT_ANSI_CHARSET 0 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void DeleteFace(); | 132 void DeleteFace(); |
133 | 133 |
134 protected: | 134 protected: |
135 FX_BOOL m_bEmbedded; | 135 FX_BOOL m_bEmbedded; |
136 FX_BOOL m_bVertical; | 136 FX_BOOL m_bVertical; |
137 FX_BOOL m_bLogic; | 137 FX_BOOL m_bLogic; |
138 void* m_pOwnedStream; | 138 void* m_pOwnedStream; |
139 }; | 139 }; |
140 #define ENCODING_INTERNAL 0 | 140 #define ENCODING_INTERNAL 0 |
141 #define ENCODING_UNICODE 1 | 141 #define ENCODING_UNICODE 1 |
| 142 |
142 class IFX_FontEncoding { | 143 class IFX_FontEncoding { |
143 public: | 144 public: |
144 virtual ~IFX_FontEncoding() {} | 145 virtual ~IFX_FontEncoding() {} |
145 | 146 |
146 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; | 147 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; |
147 | 148 |
148 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0; | 149 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0; |
149 | 150 |
150 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const = 0; | 151 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const = 0; |
151 }; | 152 }; |
| 153 |
152 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont); | 154 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont); |
153 #define FXFM_ENC_TAG(a, b, c, d) \ | 155 #define FXFM_ENC_TAG(a, b, c, d) \ |
154 (((FX_DWORD)(a) << 24) | ((FX_DWORD)(b) << 16) | ((FX_DWORD)(c) << 8) | \ | 156 (((FX_DWORD)(a) << 24) | ((FX_DWORD)(b) << 16) | ((FX_DWORD)(c) << 8) | \ |
155 (FX_DWORD)(d)) | 157 (FX_DWORD)(d)) |
156 #define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0) | 158 #define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0) |
157 #define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b') | 159 #define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b') |
158 #define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c') | 160 #define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c') |
159 #define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's') | 161 #define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's') |
160 #define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ') | 162 #define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ') |
161 #define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5') | 163 #define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5') |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 CFX_SubstFont* pSubstFont); | 257 CFX_SubstFont* pSubstFont); |
256 | 258 |
257 void FreeCache(); | 259 void FreeCache(); |
258 | 260 |
259 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); | 261 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); |
260 CFX_FontMapper* m_pBuiltinMapper; | 262 CFX_FontMapper* m_pBuiltinMapper; |
261 CFX_MapByteStringToPtr m_FaceMap; | 263 CFX_MapByteStringToPtr m_FaceMap; |
262 FXFT_Library m_FTLibrary; | 264 FXFT_Library m_FTLibrary; |
263 FoxitFonts m_ExternalFonts[16]; | 265 FoxitFonts m_ExternalFonts[16]; |
264 }; | 266 }; |
| 267 |
265 class IFX_FontEnumerator { | 268 class IFX_FontEnumerator { |
266 public: | 269 public: |
267 virtual ~IFX_FontEnumerator() {} | |
268 | |
269 virtual void HitFont() = 0; | 270 virtual void HitFont() = 0; |
270 | 271 |
271 virtual void Finish() = 0; | 272 virtual void Finish() = 0; |
| 273 |
| 274 protected: |
| 275 virtual ~IFX_FontEnumerator() {} |
272 }; | 276 }; |
| 277 |
273 class IFX_AdditionalFontEnum { | 278 class IFX_AdditionalFontEnum { |
274 public: | 279 public: |
275 virtual ~IFX_AdditionalFontEnum() {} | |
276 virtual int CountFiles() = 0; | 280 virtual int CountFiles() = 0; |
277 virtual IFX_FileStream* GetFontFile(int index) = 0; | 281 virtual IFX_FileStream* GetFontFile(int index) = 0; |
| 282 |
| 283 protected: |
| 284 virtual ~IFX_AdditionalFontEnum() {} |
278 }; | 285 }; |
| 286 |
279 class CFX_FontMapper { | 287 class CFX_FontMapper { |
280 public: | 288 public: |
281 explicit CFX_FontMapper(CFX_FontMgr* mgr); | 289 explicit CFX_FontMapper(CFX_FontMgr* mgr); |
282 ~CFX_FontMapper(); | 290 ~CFX_FontMapper(); |
283 | 291 |
284 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); | 292 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); |
285 IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo; } | 293 IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo; } |
286 void AddInstalledFont(const CFX_ByteString& name, int charset); | 294 void AddInstalledFont(const CFX_ByteString& name, int charset); |
287 void LoadInstalledFonts(); | 295 void LoadInstalledFonts(); |
288 CFX_ByteStringArray m_InstalledTTFonts; | 296 CFX_ByteStringArray m_InstalledTTFonts; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 typedef struct { | 488 typedef struct { |
481 const CFX_GlyphBitmap* m_pGlyph; | 489 const CFX_GlyphBitmap* m_pGlyph; |
482 int m_OriginX, m_OriginY; | 490 int m_OriginX, m_OriginY; |
483 FX_FLOAT m_fOriginX, m_fOriginY; | 491 FX_FLOAT m_fOriginX, m_fOriginY; |
484 } FXTEXT_GLYPHPOS; | 492 } FXTEXT_GLYPHPOS; |
485 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, | 493 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, |
486 int nChars, | 494 int nChars, |
487 int anti_alias, | 495 int anti_alias, |
488 FX_FLOAT retinaScaleX = 1.0f, | 496 FX_FLOAT retinaScaleX = 1.0f, |
489 FX_FLOAT retinaScaleY = 1.0f); | 497 FX_FLOAT retinaScaleY = 1.0f); |
| 498 |
490 class IFX_GSUBTable { | 499 class IFX_GSUBTable { |
491 public: | 500 public: |
492 static IFX_GSUBTable* Create(CFX_Font* pFont); | 501 static IFX_GSUBTable* Create(CFX_Font* pFont); |
| 502 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; |
| 503 |
| 504 protected: |
493 virtual ~IFX_GSUBTable() {} | 505 virtual ~IFX_GSUBTable() {} |
494 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | |
495 }; | 506 }; |
496 | 507 |
497 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 508 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
OLD | NEW |