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 "../fxcrt/fx_ext.h" | 10 #include "../fxcrt/fx_ext.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #define FXFONT_FW_BOLD 700 | 50 #define FXFONT_FW_BOLD 700 |
51 class CFX_Font | 51 class CFX_Font |
52 { | 52 { |
53 public: | 53 public: |
54 CFX_Font(); | 54 CFX_Font(); |
55 ~CFX_Font(); | 55 ~CFX_Font(); |
56 | 56 |
57 FX_BOOL LoadSubst(const CFX_ByteString&
face_name, FX_BOOL bTrueType, FX_DWORD flags, | 57 FX_BOOL LoadSubst(const CFX_ByteString&
face_name, FX_BOOL bTrueType, FX_DWORD flags, |
58 int weight, int italic_angle, int CharsetC
P, FX_BOOL bVertical = FALSE); | 58 int weight, int italic_angle, int CharsetC
P, FX_BOOL bVertical = FALSE); |
59 | 59 |
60 FX_BOOL» » » » » LoadEmbedded(FX_LPCBYTE data, FX
_DWORD size); | 60 FX_BOOL» » » » » LoadEmbedded(const uint8_t* data
, FX_DWORD size); |
61 | 61 |
62 FX_BOOL LoadFile(IFX_FileRead* pFile); | 62 FX_BOOL LoadFile(IFX_FileRead* pFile); |
63 | 63 |
64 FXFT_Face GetFace() const | 64 FXFT_Face GetFace() const |
65 { | 65 { |
66 return m_Face; | 66 return m_Face; |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 const CFX_SubstFont* GetSubstFont() const | 70 const CFX_SubstFont* GetSubstFont() const |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 FXFT_Face m_Face; | 116 FXFT_Face m_Face; |
117 | 117 |
118 CFX_SubstFont* m_pSubstFont; | 118 CFX_SubstFont* m_pSubstFont; |
119 FX_BOOL IsEmbedded() | 119 FX_BOOL IsEmbedded() |
120 { | 120 { |
121 return m_bEmbedded; | 121 return m_bEmbedded; |
122 } | 122 } |
123 | 123 |
124 void AdjustMMParams(int glyph_index,
int width, int weight); | 124 void AdjustMMParams(int glyph_index,
int width, int weight); |
125 FX_LPBYTE» » » » m_pFontDataAllocation; | 125 uint8_t*» » » » m_pFontDataAllocation; |
126 FX_LPBYTE m_pFontData; | 126 uint8_t* m_pFontData; |
127 FX_LPBYTE» » » » m_pGsubData; | 127 uint8_t*» » » » m_pGsubData; |
128 FX_DWORD m_dwSize; | 128 FX_DWORD m_dwSize; |
129 CFX_BinaryBuf m_OtfFontData; | 129 CFX_BinaryBuf m_OtfFontData; |
130 void* m_hHandle; | 130 void* m_hHandle; |
131 void* m_pPlatformFont; | 131 void* m_pPlatformFont; |
132 void* m_pPlatformFontCollection; | 132 void* m_pPlatformFontCollection; |
133 void* m_pDwFont; | 133 void* m_pDwFont; |
134 FX_BOOL m_bDwLoaded; | 134 FX_BOOL m_bDwLoaded; |
135 void ReleasePlatformResource(); | 135 void ReleasePlatformResource(); |
136 | 136 |
137 void DeleteFace(); | 137 void DeleteFace(); |
(...skipping 23 matching lines...) Expand all Loading... |
161 #define FXFONT_SUBST_TRANSFORM 0x10 | 161 #define FXFONT_SUBST_TRANSFORM 0x10 |
162 #define FXFONT_SUBST_NONSYMBOL 0x20 | 162 #define FXFONT_SUBST_NONSYMBOL 0x20 |
163 #define FXFONT_SUBST_EXACT 0x40 | 163 #define FXFONT_SUBST_EXACT 0x40 |
164 #define FXFONT_SUBST_STANDARD 0x80 | 164 #define FXFONT_SUBST_STANDARD 0x80 |
165 class CFX_SubstFont | 165 class CFX_SubstFont |
166 { | 166 { |
167 public: | 167 public: |
168 | 168 |
169 CFX_SubstFont(); | 169 CFX_SubstFont(); |
170 | 170 |
171 FX_LPVOID» » » » m_ExtHandle; | 171 void*» » » » m_ExtHandle; |
172 | 172 |
173 CFX_ByteString m_Family; | 173 CFX_ByteString m_Family; |
174 | 174 |
175 int m_Charset; | 175 int m_Charset; |
176 | 176 |
177 FX_DWORD m_SubstFlags; | 177 FX_DWORD m_SubstFlags; |
178 | 178 |
179 int m_Weight; | 179 int m_Weight; |
180 | 180 |
181 int m_ItalicAngle; | 181 int m_ItalicAngle; |
182 | 182 |
183 FX_BOOL m_bSubstOfCJK; | 183 FX_BOOL m_bSubstOfCJK; |
184 | 184 |
185 int m_WeightCJK; | 185 int m_WeightCJK; |
186 | 186 |
187 FX_BOOL m_bItlicCJK; | 187 FX_BOOL m_bItlicCJK; |
188 }; | 188 }; |
189 #define FX_FONT_FLAG_SERIF 0x01 | 189 #define FX_FONT_FLAG_SERIF 0x01 |
190 #define FX_FONT_FLAG_FIXEDPITCH 0x02 | 190 #define FX_FONT_FLAG_FIXEDPITCH 0x02 |
191 #define FX_FONT_FLAG_ITALIC 0x04 | 191 #define FX_FONT_FLAG_ITALIC 0x04 |
192 #define FX_FONT_FLAG_BOLD 0x08 | 192 #define FX_FONT_FLAG_BOLD 0x08 |
193 #define FX_FONT_FLAG_SYMBOLIC_SYMBOL 0x10 | 193 #define FX_FONT_FLAG_SYMBOLIC_SYMBOL 0x10 |
194 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 | 194 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 |
195 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 | 195 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 |
196 typedef struct { | 196 typedef struct { |
197 FX_LPCBYTE» m_pFontData; | 197 const uint8_t*» m_pFontData; |
198 FX_DWORD m_dwSize; | 198 FX_DWORD m_dwSize; |
199 } FoxitFonts; | 199 } FoxitFonts; |
200 class CFX_FontMgr | 200 class CFX_FontMgr |
201 { | 201 { |
202 public: | 202 public: |
203 CFX_FontMgr(); | 203 CFX_FontMgr(); |
204 ~CFX_FontMgr(); | 204 ~CFX_FontMgr(); |
205 void InitFTLibrary(); | 205 void InitFTLibrary(); |
206 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, | 206 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, |
207 int weight, FX_BOOL bItalic, FX_LPBYTE& pFontD
ata); | 207 int weight, FX_BOOL bItalic, uint8_t*& pFontDa
ta); |
208 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, | 208 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, |
209 int weight, FX_BOOL bItalic, FX_LPBYTE pData,
FX_DWORD size, int face_index); | 209 int weight, FX_BOOL bItalic, uint8_t* pData, F
X_DWORD size, int face_index); |
210 FXFT_Face GetCachedTTCFace(int ttc_size, FX_DWORD checksum, | 210 FXFT_Face GetCachedTTCFace(int ttc_size, FX_DWORD checksum, |
211 int font_offset, FX_LPBYTE& pFontData); | 211 int font_offset, uint8_t*& pFontData); |
212 FXFT_Face AddCachedTTCFace(int ttc_size, FX_DWORD checksum, | 212 FXFT_Face AddCachedTTCFace(int ttc_size, FX_DWORD checksum, |
213 FX_LPBYTE pData, FX_DWORD size, int font_of
fset); | 213 uint8_t* pData, FX_DWORD size, int font_off
set); |
214 FXFT_Face» » GetFileFace(FX_LPCSTR filename, int face_index); | 214 FXFT_Face» » GetFileFace(const FX_CHAR* filename, int face_index); |
215 FXFT_Face» » GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_i
ndex); | 215 FXFT_Face» » GetFixedFace(const uint8_t* pData, FX_DWORD size, int fa
ce_index); |
216 void ReleaseFace(FXFT_Face face); | 216 void ReleaseFace(FXFT_Face face); |
217 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo)
; | 217 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo)
; |
218 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b
TrueType, FX_DWORD flags, | 218 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b
TrueType, FX_DWORD flags, |
219 int weight, int italic_angle, int CharsetCP, C
FX_SubstFont* pSubstFont); | 219 int weight, int italic_angle, int CharsetCP, C
FX_SubstFont* pSubstFont); |
220 | 220 |
221 void FreeCache(); | 221 void FreeCache(); |
222 | 222 |
223 FX_BOOL» » » GetStandardFont(FX_LPCBYTE& pFontData, FX_DWORD&
size, int index); | 223 FX_BOOL» » » GetStandardFont(const uint8_t*& pFontData, FX_DW
ORD& size, int index); |
224 CFX_FontMapper* m_pBuiltinMapper; | 224 CFX_FontMapper* m_pBuiltinMapper; |
225 IFX_FontMapper* m_pExtMapper; | 225 IFX_FontMapper* m_pExtMapper; |
226 CFX_MapByteStringToPtr m_FaceMap; | 226 CFX_MapByteStringToPtr m_FaceMap; |
227 FXFT_Library m_FTLibrary; | 227 FXFT_Library m_FTLibrary; |
228 FoxitFonts m_ExternalFonts[16]; | 228 FoxitFonts m_ExternalFonts[16]; |
229 }; | 229 }; |
230 class IFX_FontMapper | 230 class IFX_FontMapper |
231 { | 231 { |
232 public: | 232 public: |
233 | 233 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 FXFT_Face m_FoxitFaces[14]; | 291 FXFT_Face m_FoxitFaces[14]; |
292 IFX_FontEnumerator* m_pFontEnumerator; | 292 IFX_FontEnumerator* m_pFontEnumerator; |
293 }; | 293 }; |
294 class IFX_SystemFontInfo | 294 class IFX_SystemFontInfo |
295 { | 295 { |
296 public: | 296 public: |
297 static IFX_SystemFontInfo* CreateDefault(); | 297 static IFX_SystemFontInfo* CreateDefault(); |
298 virtual void Release() = 0; | 298 virtual void Release() = 0; |
299 | 299 |
300 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; | 300 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; |
301 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact) = 0; | 301 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact) = 0; |
302 virtual void*» » GetFont(FX_LPCSTR face) = 0; | 302 virtual void*» » GetFont(const FX_CHAR* face) = 0; |
303 virtual FX_DWORD» GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffe
r, FX_DWORD size) = 0; | 303 virtual FX_DWORD» GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer
, FX_DWORD size) = 0; |
304 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) =
0; | 304 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) =
0; |
305 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; | 305 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; |
306 virtual int GetFaceIndex(void* hFont) | 306 virtual int GetFaceIndex(void* hFont) |
307 { | 307 { |
308 return 0; | 308 return 0; |
309 } | 309 } |
310 virtual void DeleteFont(void* hFont) = 0; | 310 virtual void DeleteFont(void* hFont) = 0; |
311 virtual void* RetainFont(void* hFont) | 311 virtual void* RetainFont(void* hFont) |
312 { | 312 { |
313 return NULL; | 313 return NULL; |
314 } | 314 } |
315 protected: | 315 protected: |
316 ~IFX_SystemFontInfo() { } | 316 ~IFX_SystemFontInfo() { } |
317 }; | 317 }; |
318 class CFX_FolderFontInfo : public IFX_SystemFontInfo | 318 class CFX_FolderFontInfo : public IFX_SystemFontInfo |
319 { | 319 { |
320 public: | 320 public: |
321 CFX_FolderFontInfo(); | 321 CFX_FolderFontInfo(); |
322 virtual ~CFX_FolderFontInfo(); | 322 virtual ~CFX_FolderFontInfo(); |
323 void AddPath(FX_BSTR path); | 323 void AddPath(FX_BSTR path); |
324 virtual void Release(); | 324 virtual void Release(); |
325 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); | 325 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); |
326 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); | 326 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); |
327 virtual void*» » GetFont(FX_LPCSTR face); | 327 virtual void*» » GetFont(const FX_CHAR* face); |
328 virtual FX_DWORD» GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffe
r, FX_DWORD size); | 328 virtual FX_DWORD» GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer
, FX_DWORD size); |
329 virtual void DeleteFont(void* hFont); | 329 virtual void DeleteFont(void* hFont); |
330 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); | 330 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); |
331 virtual FX_BOOL GetFontCharset(void* hFont, int& charset); | 331 virtual FX_BOOL GetFontCharset(void* hFont, int& charset); |
332 protected: | 332 protected: |
333 CFX_MapByteStringToPtr m_FontList; | 333 CFX_MapByteStringToPtr m_FontList; |
334 CFX_ByteStringArray m_PathList; | 334 CFX_ByteStringArray m_PathList; |
335 CFX_FontMapper* m_pMapper; | 335 CFX_FontMapper* m_pMapper; |
336 void ScanPath(CFX_ByteString& path); | 336 void ScanPath(CFX_ByteString& path); |
337 void ScanFile(CFX_ByteString& path); | 337 void ScanFile(CFX_ByteString& path); |
338 void ReportFace(CFX_ByteString& path, FXSYS_F
ILE* pFile, FX_DWORD filesize, FX_DWORD offset); | 338 void ReportFace(CFX_ByteString& path, FXSYS_F
ILE* pFile, FX_DWORD filesize, FX_DWORD offset); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 public: | 426 public: |
427 virtual void Release() = 0; | 427 virtual void Release() = 0; |
428 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0
; | 428 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0
; |
429 | 429 |
430 protected: | 430 protected: |
431 ~IFX_GSUBTable() { } | 431 ~IFX_GSUBTable() { } |
432 }; | 432 }; |
433 IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont); | 433 IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont); |
434 | 434 |
435 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 435 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
OLD | NEW |