| 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 |
| 18 class CFX_FaceCache; |
| 19 class CFX_FontFaceInfo; |
| 20 class CFX_FontMapper; |
| 21 class CFX_PathData; |
| 22 class CFX_SizeGlyphCache; |
| 23 class CFX_SubstFont; |
| 24 class CFontFileFaceInfo; |
| 25 class CTTFontDesc; |
| 17 class IFX_FontEncoding; | 26 class IFX_FontEncoding; |
| 18 class CFX_PathData; | |
| 19 class CFX_SubstFont; | |
| 20 class CFX_FaceCache; | |
| 21 class CFX_FontMapper; | |
| 22 class IFX_SystemFontInfo; | 27 class IFX_SystemFontInfo; |
| 23 class CFontFileFaceInfo; | 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 |
| 32 #define FXFONT_ANSI_CHARSET 0 | 37 #define FXFONT_ANSI_CHARSET 0 |
| 33 #define FXFONT_DEFAULT_CHARSET 1 | 38 #define FXFONT_DEFAULT_CHARSET 1 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); | 217 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); |
| 213 void ReleaseFace(FXFT_Face face); | 218 void ReleaseFace(FXFT_Face face); |
| 214 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); | 219 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); |
| 215 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, | 220 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, |
| 216 FX_BOOL bTrueType, | 221 FX_BOOL bTrueType, |
| 217 FX_DWORD flags, | 222 FX_DWORD flags, |
| 218 int weight, | 223 int weight, |
| 219 int italic_angle, | 224 int italic_angle, |
| 220 int CharsetCP, | 225 int CharsetCP, |
| 221 CFX_SubstFont* pSubstFont); | 226 CFX_SubstFont* pSubstFont); |
| 227 void FreeCache(); |
| 228 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); |
| 222 | 229 |
| 223 void FreeCache(); | |
| 224 | |
| 225 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); | |
| 226 CFX_FontMapper* m_pBuiltinMapper; | 230 CFX_FontMapper* m_pBuiltinMapper; |
| 227 CFX_MapByteStringToPtr m_FaceMap; | 231 std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap; |
| 228 FXFT_Library m_FTLibrary; | 232 FXFT_Library m_FTLibrary; |
| 229 FoxitFonts m_ExternalFonts[16]; | 233 FoxitFonts m_ExternalFonts[16]; |
| 230 }; | 234 }; |
| 231 class IFX_FontEnumerator { | 235 class IFX_FontEnumerator { |
| 232 public: | 236 public: |
| 233 virtual ~IFX_FontEnumerator() {} | 237 virtual ~IFX_FontEnumerator() {} |
| 234 | 238 |
| 235 virtual void HitFont() = 0; | 239 virtual void HitFont() = 0; |
| 236 | 240 |
| 237 virtual void Finish() = 0; | 241 virtual void Finish() = 0; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 void* GetFont(const FX_CHAR* face) override; | 331 void* GetFont(const FX_CHAR* face) override; |
| 328 FX_DWORD GetFontData(void* hFont, | 332 FX_DWORD GetFontData(void* hFont, |
| 329 FX_DWORD table, | 333 FX_DWORD table, |
| 330 uint8_t* buffer, | 334 uint8_t* buffer, |
| 331 FX_DWORD size) override; | 335 FX_DWORD size) override; |
| 332 void DeleteFont(void* hFont) override; | 336 void DeleteFont(void* hFont) override; |
| 333 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; | 337 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; |
| 334 FX_BOOL GetFontCharset(void* hFont, int& charset) override; | 338 FX_BOOL GetFontCharset(void* hFont, int& charset) override; |
| 335 | 339 |
| 336 protected: | 340 protected: |
| 337 CFX_MapByteStringToPtr m_FontList; | 341 std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList; |
| 338 CFX_ByteStringArray m_PathList; | 342 CFX_ByteStringArray m_PathList; |
| 339 CFX_FontMapper* m_pMapper; | 343 CFX_FontMapper* m_pMapper; |
| 340 void ScanPath(CFX_ByteString& path); | 344 void ScanPath(CFX_ByteString& path); |
| 341 void ScanFile(CFX_ByteString& path); | 345 void ScanFile(CFX_ByteString& path); |
| 342 void ReportFace(CFX_ByteString& path, | 346 void ReportFace(CFX_ByteString& path, |
| 343 FXSYS_FILE* pFile, | 347 FXSYS_FILE* pFile, |
| 344 FX_DWORD filesize, | 348 FX_DWORD filesize, |
| 345 FX_DWORD offset); | 349 FX_DWORD offset); |
| 346 }; | 350 }; |
| 347 class CFX_CountedFaceCache { | 351 class CFX_CountedFaceCache { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 const CFX_AffineMatrix* pMatrix, | 411 const CFX_AffineMatrix* pMatrix, |
| 408 int dest_width, | 412 int dest_width, |
| 409 int anti_alias); | 413 int anti_alias); |
| 410 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, | 414 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, |
| 411 const CFX_AffineMatrix* pMatrix, | 415 const CFX_AffineMatrix* pMatrix, |
| 412 CFX_ByteStringC& FaceGlyphsKey, | 416 CFX_ByteStringC& FaceGlyphsKey, |
| 413 FX_DWORD glyph_index, | 417 FX_DWORD glyph_index, |
| 414 FX_BOOL bFontStyle, | 418 FX_BOOL bFontStyle, |
| 415 int dest_width, | 419 int dest_width, |
| 416 int anti_alias); | 420 int anti_alias); |
| 417 CFX_MapByteStringToPtr m_SizeMap; | 421 std::map<CFX_ByteString, CFX_SizeGlyphCache*> m_SizeMap; |
| 418 CFX_MapPtrToPtr m_PathMap; | 422 CFX_MapPtrToPtr m_PathMap; |
| 419 CFX_DIBitmap* m_pBitmap; | 423 CFX_DIBitmap* m_pBitmap; |
| 420 | 424 |
| 421 void InitPlatform(); | 425 void InitPlatform(); |
| 422 void DestroyPlatform(); | 426 void DestroyPlatform(); |
| 423 }; | 427 }; |
| 424 typedef struct { | 428 typedef struct { |
| 425 const CFX_GlyphBitmap* m_pGlyph; | 429 const CFX_GlyphBitmap* m_pGlyph; |
| 426 int m_OriginX, m_OriginY; | 430 int m_OriginX, m_OriginY; |
| 427 FX_FLOAT m_fOriginX, m_fOriginY; | 431 FX_FLOAT m_fOriginX, m_fOriginY; |
| 428 } FXTEXT_GLYPHPOS; | 432 } FXTEXT_GLYPHPOS; |
| 429 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, | 433 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, |
| 430 int nChars, | 434 int nChars, |
| 431 int anti_alias, | 435 int anti_alias, |
| 432 FX_FLOAT retinaScaleX = 1.0f, | 436 FX_FLOAT retinaScaleX = 1.0f, |
| 433 FX_FLOAT retinaScaleY = 1.0f); | 437 FX_FLOAT retinaScaleY = 1.0f); |
| 434 class IFX_GSUBTable { | 438 class IFX_GSUBTable { |
| 435 public: | 439 public: |
| 436 static IFX_GSUBTable* Create(CFX_Font* pFont); | 440 static IFX_GSUBTable* Create(CFX_Font* pFont); |
| 437 virtual ~IFX_GSUBTable() {} | 441 virtual ~IFX_GSUBTable() {} |
| 438 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | 442 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; |
| 439 }; | 443 }; |
| 440 | 444 |
| 441 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 445 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
| OLD | NEW |