| 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 "../../../third_party/base/nonstd_unique_ptr.h" |
| 12 #include "../fxcrt/fx_system.h" | 13 #include "../fxcrt/fx_system.h" |
| 13 #include "fx_dib.h" | 14 #include "fx_dib.h" |
| 14 | 15 |
| 15 typedef struct FT_FaceRec_* FXFT_Face; | 16 typedef struct FT_FaceRec_* FXFT_Face; |
| 16 typedef void* FXFT_Library; | 17 typedef void* FXFT_Library; |
| 17 | 18 |
| 18 class CFX_FaceCache; | 19 class CFX_FaceCache; |
| 19 class CFX_FontFaceInfo; | 20 class CFX_FontFaceInfo; |
| 20 class CFX_FontMapper; | 21 class CFX_FontMapper; |
| 21 class CFX_PathData; | 22 class CFX_PathData; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 | 170 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 |
| 170 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 | 171 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 |
| 171 typedef struct { | 172 typedef struct { |
| 172 const uint8_t* m_pFontData; | 173 const uint8_t* m_pFontData; |
| 173 FX_DWORD m_dwSize; | 174 FX_DWORD m_dwSize; |
| 174 } FoxitFonts; | 175 } FoxitFonts; |
| 175 class CFX_FontMgr { | 176 class CFX_FontMgr { |
| 176 public: | 177 public: |
| 177 CFX_FontMgr(); | 178 CFX_FontMgr(); |
| 178 ~CFX_FontMgr(); | 179 ~CFX_FontMgr(); |
| 179 void InitFTLibrary(); | 180 |
| 180 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, | 181 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, |
| 181 int weight, | 182 int weight, |
| 182 FX_BOOL bItalic, | 183 FX_BOOL bItalic, |
| 183 uint8_t*& pFontData); | 184 uint8_t*& pFontData); |
| 184 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, | 185 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, |
| 185 int weight, | 186 int weight, |
| 186 FX_BOOL bItalic, | 187 FX_BOOL bItalic, |
| 187 uint8_t* pData, | 188 uint8_t* pData, |
| 188 FX_DWORD size, | 189 FX_DWORD size, |
| 189 int face_index); | 190 int face_index); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 200 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); | 201 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); |
| 201 void ReleaseFace(FXFT_Face face); | 202 void ReleaseFace(FXFT_Face face); |
| 202 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); | 203 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); |
| 203 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, | 204 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, |
| 204 FX_BOOL bTrueType, | 205 FX_BOOL bTrueType, |
| 205 FX_DWORD flags, | 206 FX_DWORD flags, |
| 206 int weight, | 207 int weight, |
| 207 int italic_angle, | 208 int italic_angle, |
| 208 int CharsetCP, | 209 int CharsetCP, |
| 209 CFX_SubstFont* pSubstFont); | 210 CFX_SubstFont* pSubstFont); |
| 210 void FreeCache(); | |
| 211 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); | 211 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DWORD& size, int index); |
| 212 CFX_FontMapper* GetBuiltinMapper() const { return m_pBuiltinMapper.get(); } |
| 213 FXFT_Library GetFTLibrary() const { return m_FTLibrary; } |
| 212 | 214 |
| 213 CFX_FontMapper* m_pBuiltinMapper; | 215 private: |
| 216 void InitFTLibrary(); |
| 217 |
| 218 nonstd::unique_ptr<CFX_FontMapper> m_pBuiltinMapper; |
| 214 std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap; | 219 std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap; |
| 215 FXFT_Library m_FTLibrary; | 220 FXFT_Library m_FTLibrary; |
| 216 FoxitFonts m_ExternalFonts[16]; | |
| 217 }; | 221 }; |
| 218 | 222 |
| 219 class IFX_FontEnumerator { | 223 class IFX_FontEnumerator { |
| 220 public: | 224 public: |
| 221 virtual void HitFont() = 0; | 225 virtual void HitFont() = 0; |
| 222 | 226 |
| 223 virtual void Finish() = 0; | 227 virtual void Finish() = 0; |
| 224 | 228 |
| 225 protected: | 229 protected: |
| 226 virtual ~IFX_FontEnumerator() {} | 230 virtual ~IFX_FontEnumerator() {} |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 445 |
| 442 protected: | 446 protected: |
| 443 virtual ~IFX_GSUBTable() {} | 447 virtual ~IFX_GSUBTable() {} |
| 444 }; | 448 }; |
| 445 | 449 |
| 446 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name); | 450 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name); |
| 447 | 451 |
| 448 int PDF_GetStandardFontName(CFX_ByteString* name); | 452 int PDF_GetStandardFontName(CFX_ByteString* name); |
| 449 | 453 |
| 450 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 454 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
| OLD | NEW |