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 IFX_FontEncoding; |
18 class CFX_PathData; | 18 class CFX_PathData; |
19 class CFX_SubstFont; | 19 class CFX_SubstFont; |
20 class CFX_FaceCache; | 20 class CFX_FaceCache; |
21 class IFX_FontMapper; | |
22 class CFX_FontMapper; | 21 class CFX_FontMapper; |
23 class IFX_SystemFontInfo; | 22 class IFX_SystemFontInfo; |
24 class CFontFileFaceInfo; | 23 class CFontFileFaceInfo; |
25 #define FXFONT_FIXED_PITCH 0x01 | 24 #define FXFONT_FIXED_PITCH 0x01 |
26 #define FXFONT_SERIF 0x02 | 25 #define FXFONT_SERIF 0x02 |
27 #define FXFONT_SYMBOLIC 0x04 | 26 #define FXFONT_SYMBOLIC 0x04 |
28 #define FXFONT_SCRIPT 0x08 | 27 #define FXFONT_SCRIPT 0x08 |
29 #define FXFONT_ITALIC 0x40 | 28 #define FXFONT_ITALIC 0x40 |
30 #define FXFONT_BOLD 0x40000 | 29 #define FXFONT_BOLD 0x40000 |
31 #define FXFONT_USEEXTERNATTR 0x80000 | 30 #define FXFONT_USEEXTERNATTR 0x80000 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int fa ce_index); | 216 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int fa ce_index); |
218 void ReleaseFace(FXFT_Face face); | 217 void ReleaseFace(FXFT_Face face); |
219 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) ; | 218 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) ; |
220 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, | 219 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, |
221 int weight, int italic_angle, int CharsetCP, C FX_SubstFont* pSubstFont); | 220 int weight, int italic_angle, int CharsetCP, C FX_SubstFont* pSubstFont); |
222 | 221 |
223 void FreeCache(); | 222 void FreeCache(); |
224 | 223 |
225 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DW ORD& size, int index); | 224 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DW ORD& size, int index); |
226 CFX_FontMapper* m_pBuiltinMapper; | 225 CFX_FontMapper* m_pBuiltinMapper; |
227 IFX_FontMapper* m_pExtMapper; | |
228 CFX_MapByteStringToPtr m_FaceMap; | 226 CFX_MapByteStringToPtr m_FaceMap; |
229 FXFT_Library m_FTLibrary; | 227 FXFT_Library m_FTLibrary; |
230 FoxitFonts m_ExternalFonts[16]; | 228 FoxitFonts m_ExternalFonts[16]; |
231 }; | 229 }; |
232 class IFX_FontMapper | |
233 { | |
234 public: | |
235 | |
236 virtual ~IFX_FontMapper() {} | |
237 | |
238 virtual FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, | |
239 int weight, int italic_angle, int CharsetC P, CFX_SubstFont* pSubstFont) = 0; | |
240 | |
241 CFX_FontMgr* m_pFontMgr; | |
242 }; | |
243 class IFX_FontEnumerator | 230 class IFX_FontEnumerator |
244 { | 231 { |
245 public: | 232 public: |
246 virtual ~IFX_FontEnumerator() { } | 233 virtual ~IFX_FontEnumerator() { } |
247 | 234 |
248 virtual void HitFont() = 0; | 235 virtual void HitFont() = 0; |
249 | 236 |
250 virtual void Finish() = 0; | 237 virtual void Finish() = 0; |
251 }; | 238 }; |
252 class IFX_AdditionalFontEnum | 239 class IFX_AdditionalFontEnum |
253 { | 240 { |
254 public: | 241 public: |
255 virtual ~IFX_AdditionalFontEnum() { } | 242 virtual ~IFX_AdditionalFontEnum() { } |
256 virtual int CountFiles() = 0; | 243 virtual int CountFiles() = 0; |
257 virtual IFX_FileStream* GetFontFile(int index) = 0; | 244 virtual IFX_FileStream* GetFontFile(int index) = 0; |
258 }; | 245 }; |
259 class CFX_FontMapper : public IFX_FontMapper | 246 class CFX_FontMapper |
260 { | 247 { |
261 public: | 248 public: |
262 CFX_FontMapper(); | 249 CFX_FontMapper(CFX_FontMgr* mgr); |
Lei Zhang
2015/07/31 20:23:30
explicit
| |
263 virtual ~CFX_FontMapper(); | 250 ~CFX_FontMapper(); |
251 | |
264 void SetSystemFontInfo(IFX_SystemFontInfo* pF ontInfo); | 252 void SetSystemFontInfo(IFX_SystemFontInfo* pF ontInfo); |
265 IFX_SystemFontInfo* GetSystemFontInfo() | 253 IFX_SystemFontInfo* GetSystemFontInfo() |
266 { | 254 { |
267 return m_pFontInfo; | 255 return m_pFontInfo; |
268 } | 256 } |
269 void AddInstalledFont(const CFX_ByteString& n ame, int charset); | 257 void AddInstalledFont(const CFX_ByteString& n ame, int charset); |
270 void LoadInstalledFonts(); | 258 void LoadInstalledFonts(); |
271 CFX_ByteStringArray m_InstalledTTFonts; | 259 CFX_ByteStringArray m_InstalledTTFonts; |
272 void SetFontEnumerator(IFX_FontEnumerator* pF ontEnumerator) | 260 void SetFontEnumerator(IFX_FontEnumerator* pF ontEnumerator) |
273 { | 261 { |
274 m_pFontEnumerator = pFontEnumerator; | 262 m_pFontEnumerator = pFontEnumerator; |
275 } | 263 } |
276 IFX_FontEnumerator* GetFontEnumerator() const | 264 IFX_FontEnumerator* GetFontEnumerator() const |
277 { | 265 { |
278 return m_pFontEnumerator; | 266 return m_pFontEnumerator; |
279 } | 267 } |
280 virtual FXFT_Face» FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, | 268 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags, |
281 int weight, int italic_angle, int CharsetC P, CFX_SubstFont* pSubstFont); | 269 int weight, int italic_angle, int CharsetCP, CFX_Sub stFont* pSubstFont); |
282 private: | 270 private: |
283 CFX_ByteString GetPSNameFromTT(void* hFont); | 271 CFX_ByteString GetPSNameFromTT(void* hFont); |
284 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_n ame); | 272 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_n ame); |
285 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseFont, int italic_angle, int weight, int picthfamily); | 273 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseFont, int italic_angle, int weight, int picthfamily); |
286 | 274 |
287 FX_BOOL m_bListLoaded; | 275 FX_BOOL m_bListLoaded; |
288 FXFT_Face m_MMFaces[2]; | 276 FXFT_Face m_MMFaces[2]; |
289 CFX_ByteString m_LastFamily; | 277 CFX_ByteString m_LastFamily; |
290 CFX_DWordArray m_CharsetArray; | 278 CFX_DWordArray m_CharsetArray; |
291 CFX_ByteStringArray m_FaceArray; | 279 CFX_ByteStringArray m_FaceArray; |
292 IFX_SystemFontInfo* m_pFontInfo; | 280 IFX_SystemFontInfo* m_pFontInfo; |
293 FXFT_Face m_FoxitFaces[14]; | 281 FXFT_Face m_FoxitFaces[14]; |
294 IFX_FontEnumerator* m_pFontEnumerator; | 282 IFX_FontEnumerator* m_pFontEnumerator; |
283 CFX_FontMgr* const m_pFontMgr; | |
284 | |
Lei Zhang
2015/07/31 20:23:30
Extra blank line here?
| |
295 }; | 285 }; |
296 class IFX_SystemFontInfo | 286 class IFX_SystemFontInfo |
297 { | 287 { |
298 public: | 288 public: |
299 static IFX_SystemFontInfo* CreateDefault(); | 289 static IFX_SystemFontInfo* CreateDefault(); |
300 virtual void Release() = 0; | 290 virtual void Release() = 0; |
301 | 291 |
302 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; | 292 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; |
303 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset , int pitch_family, const FX_CHAR* face, int& iExact) = 0; | 293 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset , int pitch_family, const FX_CHAR* face, int& iExact) = 0; |
304 virtual void* GetFont(const FX_CHAR* face) = 0; | 294 virtual void* GetFont(const FX_CHAR* face) = 0; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 CFX_AffineMatrix* pText_matrix, unsigned short const* text, u nsigned long argb); | 414 CFX_AffineMatrix* pText_matrix, unsigned short const* text, u nsigned long argb); |
425 class IFX_GSUBTable | 415 class IFX_GSUBTable |
426 { | 416 { |
427 public: | 417 public: |
428 static IFX_GSUBTable* Create(CFX_Font* pFont); | 418 static IFX_GSUBTable* Create(CFX_Font* pFont); |
429 virtual ~IFX_GSUBTable() { } | 419 virtual ~IFX_GSUBTable() { } |
430 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0 ; | 420 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0 ; |
431 }; | 421 }; |
432 | 422 |
433 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 423 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
OLD | NEW |