Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: core/include/fxge/fx_font.h

Issue 1262723006: Merge to XFA: Kill IFX_FontMapper (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/include/fxge/fx_ge.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int fa ce_index); 247 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int fa ce_index);
249 void ReleaseFace(FXFT_Face face); 248 void ReleaseFace(FXFT_Face face);
250 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) ; 249 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) ;
251 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, 250 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags,
252 int weight, int italic_angle, int CharsetCP, C FX_SubstFont* pSubstFont); 251 int weight, int italic_angle, int CharsetCP, C FX_SubstFont* pSubstFont);
253 252
254 void FreeCache(); 253 void FreeCache();
255 254
256 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DW ORD& size, int index); 255 FX_BOOL GetStandardFont(const uint8_t*& pFontData, FX_DW ORD& size, int index);
257 CFX_FontMapper* m_pBuiltinMapper; 256 CFX_FontMapper* m_pBuiltinMapper;
258 IFX_FontMapper* m_pExtMapper;
259 CFX_MapByteStringToPtr m_FaceMap; 257 CFX_MapByteStringToPtr m_FaceMap;
260 FXFT_Library m_FTLibrary; 258 FXFT_Library m_FTLibrary;
261 FoxitFonts m_ExternalFonts[16]; 259 FoxitFonts m_ExternalFonts[16];
262 }; 260 };
263 class IFX_FontMapper
264 {
265 public:
266
267 virtual ~IFX_FontMapper() {}
268
269 virtual FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags,
270 int weight, int italic_angle, int CharsetC P, CFX_SubstFont* pSubstFont) = 0;
271
272 CFX_FontMgr* m_pFontMgr;
273 };
274 class IFX_FontEnumerator 261 class IFX_FontEnumerator
275 { 262 {
276 public: 263 public:
277 virtual ~IFX_FontEnumerator() { } 264 virtual ~IFX_FontEnumerator() { }
278 265
279 virtual void HitFont() = 0; 266 virtual void HitFont() = 0;
280 267
281 virtual void Finish() = 0; 268 virtual void Finish() = 0;
282 }; 269 };
283 class IFX_AdditionalFontEnum 270 class IFX_AdditionalFontEnum
284 { 271 {
285 public: 272 public:
286 virtual ~IFX_AdditionalFontEnum() { } 273 virtual ~IFX_AdditionalFontEnum() { }
287 virtual int CountFiles() = 0; 274 virtual int CountFiles() = 0;
288 virtual IFX_FileStream* GetFontFile(int index) = 0; 275 virtual IFX_FileStream* GetFontFile(int index) = 0;
289 }; 276 };
290 class CFX_FontMapper : public IFX_FontMapper 277 class CFX_FontMapper
291 { 278 {
292 public: 279 public:
293 CFX_FontMapper(); 280
294 virtual ~CFX_FontMapper(); 281 CFX_FontMapper(CFX_FontMgr* mgr);
295 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) ; 282 ~CFX_FontMapper();
296 IFX_SystemFontInfo* GetSystemFontInfo() 283
284 void» » » » SetSystemFontInfo(IFX_SystemFontInfo* pF ontInfo);
285 IFX_SystemFontInfo*»GetSystemFontInfo()
297 { 286 {
298 return m_pFontInfo; 287 return m_pFontInfo;
299 } 288 }
300 void AddInstalledFont(const CFX_ByteString& name, int charset); 289 void AddInstalledFont(const CFX_ByteString& name, int charset);
301 void LoadInstalledFonts(); 290 void LoadInstalledFonts();
302 CFX_ByteStringArray m_InstalledTTFonts; 291 CFX_ByteStringArray m_InstalledTTFonts;
303 void SetFontEnumerator(IFX_FontEnumerator* pFontEnume rator) 292 void SetFontEnumerator(IFX_FontEnumerator* pFontEnume rator)
304 { 293 {
305 m_pFontEnumerator = pFontEnumerator; 294 m_pFontEnumerator = pFontEnumerator;
306 } 295 }
307 IFX_FontEnumerator* GetFontEnumerator() const 296 IFX_FontEnumerator* GetFontEnumerator() const
308 { 297 {
309 return m_pFontEnumerator; 298 return m_pFontEnumerator;
310 } 299 }
311 virtual FXFT_Face FindSubstFont(const CFX_ByteString& face_name, F X_BOOL bTrueType, FX_DWORD flags, 300
312 int weight, int italic_angle, int CharsetCP, CFX_SubstFont* pSubstFont); 301 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags,
302 int weight, int italic_angle, int CharsetCP, CFX_Sub stFont* pSubstFont);
313 FXFT_Face FindSubstFontByUnicode(FX_DWORD dwUnicode, FX_DW ORD flags, int weight, int italic_angle); 303 FXFT_Face FindSubstFontByUnicode(FX_DWORD dwUnicode, FX_DW ORD flags, int weight, int italic_angle);
314 FX_BOOL IsBuiltinFace(const FXFT_Face face) const; 304 FX_BOOL IsBuiltinFace(const FXFT_Face face) const;
315 305
316 private: 306 private:
317 static const size_t MM_FACE_COUNT = 2; 307 static const size_t MM_FACE_COUNT = 2;
318 static const size_t FOXIT_FACE_COUNT = 14; 308 static const size_t FOXIT_FACE_COUNT = 14;
309
319 CFX_ByteString GetPSNameFromTT(void* hFont); 310 CFX_ByteString GetPSNameFromTT(void* hFont);
320 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_n ame); 311 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_n ame);
321 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseFont, int italic_angle, int weight, int picthfamily); 312 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseFont, int italic_angle, int weight, int picthfamily);
322 313
323 FX_BOOL m_bListLoaded; 314 FX_BOOL m_bListLoaded;
324 FXFT_Face m_MMFaces[MM_FACE_COUNT]; 315 FXFT_Face m_MMFaces[MM_FACE_COUNT];
325 CFX_ByteString m_LastFamily; 316 CFX_ByteString m_LastFamily;
326 CFX_DWordArray m_CharsetArray; 317 CFX_DWordArray m_CharsetArray;
327 CFX_ByteStringArray m_FaceArray; 318 CFX_ByteStringArray m_FaceArray;
328 IFX_SystemFontInfo* m_pFontInfo; 319 IFX_SystemFontInfo* m_pFontInfo;
329 FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; 320 FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT];
330 IFX_FontEnumerator* m_pFontEnumerator; 321 IFX_FontEnumerator* m_pFontEnumerator;
322 CFX_FontMgr* const m_pFontMgr;
331 }; 323 };
332 class IFX_SystemFontInfo 324 class IFX_SystemFontInfo
333 { 325 {
334 public: 326 public:
335 static IFX_SystemFontInfo* CreateDefault(); 327 static IFX_SystemFontInfo* CreateDefault();
336 virtual void Release() = 0; 328 virtual void Release() = 0;
337 329
338 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; 330 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0;
339 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset , int pitch_family, const FX_CHAR* face, int& iExact) = 0; 331 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset , int pitch_family, const FX_CHAR* face, int& iExact) = 0;
340 virtual void* MapFontByUnicode(FX_DWORD dwUnicode, int weight, FX_BOOL bItalic, int pitch_family) 332 virtual void* MapFontByUnicode(FX_DWORD dwUnicode, int weight, FX_BOOL bItalic, int pitch_family)
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 CFX_AffineMatrix* pText_matrix, unsigned short const* text, u nsigned long argb); 459 CFX_AffineMatrix* pText_matrix, unsigned short const* text, u nsigned long argb);
468 class IFX_GSUBTable 460 class IFX_GSUBTable
469 { 461 {
470 public: 462 public:
471 static IFX_GSUBTable* Create(CFX_Font* pFont); 463 static IFX_GSUBTable* Create(CFX_Font* pFont);
472 virtual ~IFX_GSUBTable() { } 464 virtual ~IFX_GSUBTable() { }
473 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0 ; 465 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0 ;
474 }; 466 };
475 467
476 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ 468 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_
OLDNEW
« no previous file with comments | « no previous file | core/include/fxge/fx_ge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698