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

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

Issue 1088733002: Kill CFX_Object. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase. Created 5 years, 8 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 | « core/include/fxge/fx_dib.h ('k') | 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 _FX_FONT_H_ 7 #ifndef _FX_FONT_H_
8 #define _FX_FONT_H_ 8 #define _FX_FONT_H_
9 #ifndef _FXCRT_EXTENSION_ 9 #ifndef _FXCRT_EXTENSION_
10 #include "../../include/fxcrt/fx_ext.h" 10 #include "../../include/fxcrt/fx_ext.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #define FXFONT_GREEK_CHARSET 161 43 #define FXFONT_GREEK_CHARSET 161
44 #define FXFONT_TURKISH_CHARSET 162 44 #define FXFONT_TURKISH_CHARSET 162
45 #define FXFONT_HEBREW_CHARSET 177 45 #define FXFONT_HEBREW_CHARSET 177
46 #define FXFONT_ARABIC_CHARSET 178 46 #define FXFONT_ARABIC_CHARSET 178
47 #define FXFONT_BALTIC_CHARSET 186 47 #define FXFONT_BALTIC_CHARSET 186
48 #define FXFONT_FF_FIXEDPITCH 1 48 #define FXFONT_FF_FIXEDPITCH 1
49 #define FXFONT_FF_ROMAN (1<<4) 49 #define FXFONT_FF_ROMAN (1<<4)
50 #define FXFONT_FF_SCRIPT (4<<4) 50 #define FXFONT_FF_SCRIPT (4<<4)
51 #define FXFONT_FW_NORMAL 400 51 #define FXFONT_FW_NORMAL 400
52 #define FXFONT_FW_BOLD 700 52 #define FXFONT_FW_BOLD 700
53 class CFX_Font : public CFX_Object 53 class CFX_Font
54 { 54 {
55 public: 55 public:
56 CFX_Font(); 56 CFX_Font();
57 ~CFX_Font(); 57 ~CFX_Font();
58 58
59 FX_BOOL LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags, 59 FX_BOOL LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags,
60 int weight, int italic_angle, int CharsetC P, FX_BOOL bVertical = FALSE); 60 int weight, int italic_angle, int CharsetC P, FX_BOOL bVertical = FALSE);
61 61
62 FX_BOOL LoadEmbedded(FX_LPCBYTE data, FX _DWORD size); 62 FX_BOOL LoadEmbedded(FX_LPCBYTE data, FX _DWORD size);
63 63
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 void DeleteFace(); 139 void DeleteFace();
140 protected: 140 protected:
141 141
142 FX_BOOL m_bEmbedded; 142 FX_BOOL m_bEmbedded;
143 FX_BOOL m_bVertical; 143 FX_BOOL m_bVertical;
144 void* m_pOwnedStream; 144 void* m_pOwnedStream;
145 }; 145 };
146 #define ENCODING_INTERNAL 0 146 #define ENCODING_INTERNAL 0
147 #define ENCODING_UNICODE 1 147 #define ENCODING_UNICODE 1
148 class IFX_FontEncoding : public CFX_Object 148 class IFX_FontEncoding
149 { 149 {
150 public: 150 public:
151 virtual ~IFX_FontEncoding() {} 151 virtual ~IFX_FontEncoding() {}
152 152
153 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; 153 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0;
154 154
155 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0 ; 155 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0 ;
156 156
157 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const = 0; 157 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const = 0;
158 }; 158 };
159 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont); 159 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont);
160 #define FXFONT_SUBST_MM 0x01 160 #define FXFONT_SUBST_MM 0x01
161 #define FXFONT_SUBST_GLYPHPATH 0x04 161 #define FXFONT_SUBST_GLYPHPATH 0x04
162 #define FXFONT_SUBST_CLEARTYPE 0x08 162 #define FXFONT_SUBST_CLEARTYPE 0x08
163 #define FXFONT_SUBST_TRANSFORM 0x10 163 #define FXFONT_SUBST_TRANSFORM 0x10
164 #define FXFONT_SUBST_NONSYMBOL 0x20 164 #define FXFONT_SUBST_NONSYMBOL 0x20
165 #define FXFONT_SUBST_EXACT 0x40 165 #define FXFONT_SUBST_EXACT 0x40
166 #define FXFONT_SUBST_STANDARD 0x80 166 #define FXFONT_SUBST_STANDARD 0x80
167 class CFX_SubstFont : public CFX_Object 167 class CFX_SubstFont
168 { 168 {
169 public: 169 public:
170 170
171 CFX_SubstFont(); 171 CFX_SubstFont();
172 172
173 FX_LPVOID m_ExtHandle; 173 FX_LPVOID m_ExtHandle;
174 174
175 CFX_ByteString m_Family; 175 CFX_ByteString m_Family;
176 176
177 int m_Charset; 177 int m_Charset;
(...skipping 14 matching lines...) Expand all
192 #define FX_FONT_FLAG_FIXEDPITCH 0x02 192 #define FX_FONT_FLAG_FIXEDPITCH 0x02
193 #define FX_FONT_FLAG_ITALIC 0x04 193 #define FX_FONT_FLAG_ITALIC 0x04
194 #define FX_FONT_FLAG_BOLD 0x08 194 #define FX_FONT_FLAG_BOLD 0x08
195 #define FX_FONT_FLAG_SYMBOLIC_SYMBOL 0x10 195 #define FX_FONT_FLAG_SYMBOLIC_SYMBOL 0x10
196 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 196 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20
197 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 197 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40
198 typedef struct { 198 typedef struct {
199 FX_LPCBYTE m_pFontData; 199 FX_LPCBYTE m_pFontData;
200 FX_DWORD m_dwSize; 200 FX_DWORD m_dwSize;
201 } FoxitFonts; 201 } FoxitFonts;
202 class CFX_FontMgr : public CFX_Object 202 class CFX_FontMgr
203 { 203 {
204 public: 204 public:
205 CFX_FontMgr(); 205 CFX_FontMgr();
206 ~CFX_FontMgr(); 206 ~CFX_FontMgr();
207 void InitFTLibrary(); 207 void InitFTLibrary();
208 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, 208 FXFT_Face GetCachedFace(const CFX_ByteString& face_name,
209 int weight, FX_BOOL bItalic, FX_LPBYTE& pFontD ata); 209 int weight, FX_BOOL bItalic, FX_LPBYTE& pFontD ata);
210 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, 210 FXFT_Face AddCachedFace(const CFX_ByteString& face_name,
211 int weight, FX_BOOL bItalic, FX_LPBYTE pData, FX_DWORD size, int face_index); 211 int weight, FX_BOOL bItalic, FX_LPBYTE pData, FX_DWORD size, int face_index);
212 FXFT_Face GetCachedTTCFace(int ttc_size, FX_DWORD checksum, 212 FXFT_Face GetCachedTTCFace(int ttc_size, FX_DWORD checksum,
213 int font_offset, FX_LPBYTE& pFontData); 213 int font_offset, FX_LPBYTE& pFontData);
214 FXFT_Face AddCachedTTCFace(int ttc_size, FX_DWORD checksum, 214 FXFT_Face AddCachedTTCFace(int ttc_size, FX_DWORD checksum,
215 FX_LPBYTE pData, FX_DWORD size, int font_of fset); 215 FX_LPBYTE pData, FX_DWORD size, int font_of fset);
216 FXFT_Face GetFileFace(FX_LPCSTR filename, int face_index); 216 FXFT_Face GetFileFace(FX_LPCSTR filename, int face_index);
217 FXFT_Face GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_i ndex); 217 FXFT_Face GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_i ndex);
218 void ReleaseFace(FXFT_Face face); 218 void ReleaseFace(FXFT_Face face);
219 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) ; 219 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) ;
220 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, 220 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); 221 int weight, int italic_angle, int CharsetCP, C FX_SubstFont* pSubstFont);
222 222
223 void FreeCache(); 223 void FreeCache();
224 224
225 FX_BOOL GetStandardFont(FX_LPCBYTE& pFontData, FX_DWORD& size, int index); 225 FX_BOOL GetStandardFont(FX_LPCBYTE& pFontData, FX_DWORD& size, int index);
226 CFX_FontMapper* m_pBuiltinMapper; 226 CFX_FontMapper* m_pBuiltinMapper;
227 IFX_FontMapper* m_pExtMapper; 227 IFX_FontMapper* m_pExtMapper;
228 CFX_MapByteStringToPtr m_FaceMap; 228 CFX_MapByteStringToPtr m_FaceMap;
229 FXFT_Library m_FTLibrary; 229 FXFT_Library m_FTLibrary;
230 FoxitFonts m_ExternalFonts[16]; 230 FoxitFonts m_ExternalFonts[16];
231 }; 231 };
232 class IFX_FontMapper : public CFX_Object 232 class IFX_FontMapper
233 { 233 {
234 public: 234 public:
235 235
236 virtual ~IFX_FontMapper() {} 236 virtual ~IFX_FontMapper() {}
237 237
238 virtual FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, 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; 239 int weight, int italic_angle, int CharsetC P, CFX_SubstFont* pSubstFont) = 0;
240 240
241 CFX_FontMgr* m_pFontMgr; 241 CFX_FontMgr* m_pFontMgr;
242 }; 242 };
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 FX_BOOL m_bListLoaded; 287 FX_BOOL m_bListLoaded;
288 FXFT_Face m_MMFaces[2]; 288 FXFT_Face m_MMFaces[2];
289 CFX_ByteString m_LastFamily; 289 CFX_ByteString m_LastFamily;
290 CFX_DWordArray m_CharsetArray; 290 CFX_DWordArray m_CharsetArray;
291 CFX_ByteStringArray m_FaceArray; 291 CFX_ByteStringArray m_FaceArray;
292 IFX_SystemFontInfo* m_pFontInfo; 292 IFX_SystemFontInfo* m_pFontInfo;
293 FXFT_Face m_FoxitFaces[14]; 293 FXFT_Face m_FoxitFaces[14];
294 IFX_FontEnumerator* m_pFontEnumerator; 294 IFX_FontEnumerator* m_pFontEnumerator;
295 }; 295 };
296 class IFX_SystemFontInfo : public CFX_Object 296 class IFX_SystemFontInfo
297 { 297 {
298 public: 298 public:
299 static IFX_SystemFontInfo* CreateDefault(); 299 static IFX_SystemFontInfo* CreateDefault();
300 virtual void Release() = 0; 300 virtual void Release() = 0;
301 301
302 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; 302 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0;
303 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset , int pitch_family, FX_LPCSTR face, FX_BOOL& bExact) = 0; 303 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset , int pitch_family, FX_LPCSTR face, FX_BOOL& bExact) = 0;
304 virtual void* GetFont(FX_LPCSTR face) = 0; 304 virtual void* GetFont(FX_LPCSTR face) = 0;
305 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffe r, FX_DWORD size) = 0; 305 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffe r, FX_DWORD size) = 0;
306 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; 306 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0;
(...skipping 25 matching lines...) Expand all
332 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); 332 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name);
333 virtual FX_BOOL GetFontCharset(void* hFont, int& charset); 333 virtual FX_BOOL GetFontCharset(void* hFont, int& charset);
334 protected: 334 protected:
335 CFX_MapByteStringToPtr m_FontList; 335 CFX_MapByteStringToPtr m_FontList;
336 CFX_ByteStringArray m_PathList; 336 CFX_ByteStringArray m_PathList;
337 CFX_FontMapper* m_pMapper; 337 CFX_FontMapper* m_pMapper;
338 void ScanPath(CFX_ByteString& path); 338 void ScanPath(CFX_ByteString& path);
339 void ScanFile(CFX_ByteString& path); 339 void ScanFile(CFX_ByteString& path);
340 void ReportFace(CFX_ByteString& path, FXSYS_F ILE* pFile, FX_DWORD filesize, FX_DWORD offset); 340 void ReportFace(CFX_ByteString& path, FXSYS_F ILE* pFile, FX_DWORD filesize, FX_DWORD offset);
341 }; 341 };
342 class CFX_CountedFaceCache : public CFX_Object 342 class CFX_CountedFaceCache
343 { 343 {
344 public: 344 public:
345 CFX_FaceCache* m_Obj; 345 CFX_FaceCache* m_Obj;
346 FX_DWORD m_nCount; 346 FX_DWORD m_nCount;
347 }; 347 };
348 typedef CFX_MapPtrTemplate<FXFT_Face, CFX_CountedFaceCache*> CFX_FTCacheMap; 348 typedef CFX_MapPtrTemplate<FXFT_Face, CFX_CountedFaceCache*> CFX_FTCacheMap;
349 class CFX_FontCache : public CFX_Object 349 class CFX_FontCache
350 { 350 {
351 public: 351 public:
352 ~CFX_FontCache(); 352 ~CFX_FontCache();
353 CFX_FaceCache* GetCachedFace(CFX_Font* pFont); 353 CFX_FaceCache* GetCachedFace(CFX_Font* pFont);
354 void ReleaseCachedFace(CFX_Font* pFon t); 354 void ReleaseCachedFace(CFX_Font* pFon t);
355 void FreeCache(FX_BOOL bRelease = FAL SE); 355 void FreeCache(FX_BOOL bRelease = FAL SE);
356 356
357 private: 357 private:
358 CFX_FTCacheMap m_FTFaceMap; 358 CFX_FTCacheMap m_FTFaceMap;
359 CFX_FTCacheMap m_ExtFaceMap; 359 CFX_FTCacheMap m_ExtFaceMap;
360 }; 360 };
361 class CFX_AutoFontCache 361 class CFX_AutoFontCache
362 { 362 {
363 public: 363 public:
364 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) 364 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont)
365 : m_pFontCache(pFontCache) 365 : m_pFontCache(pFontCache)
366 , m_pFont(pFont) 366 , m_pFont(pFont)
367 { 367 {
368 } 368 }
369 ~CFX_AutoFontCache() 369 ~CFX_AutoFontCache()
370 { 370 {
371 m_pFontCache->ReleaseCachedFace(m_pFont); 371 m_pFontCache->ReleaseCachedFace(m_pFont);
372 } 372 }
373 CFX_FontCache* m_pFontCache; 373 CFX_FontCache* m_pFontCache;
374 CFX_Font* m_pFont; 374 CFX_Font* m_pFont;
375 }; 375 };
376 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) CFX_AutoFontCache autoFontCache(( pFontCache), (pFont)) 376 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) CFX_AutoFontCache autoFontCache(( pFontCache), (pFont))
377 class CFX_GlyphBitmap : public CFX_Object 377 class CFX_GlyphBitmap
378 { 378 {
379 public: 379 public:
380 int m_Top; 380 int m_Top;
381 int m_Left; 381 int m_Left;
382 CFX_DIBitmap m_Bitmap; 382 CFX_DIBitmap m_Bitmap;
383 }; 383 };
384 class CFX_FaceCache : public CFX_Object 384 class CFX_FaceCache
385 { 385 {
386 public: 386 public:
387 ~CFX_FaceCache(); 387 ~CFX_FaceCache();
388 const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_ index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, 388 const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_ index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix,
389 int dest_width, int anti_alias, int& text_flags); 389 int dest_width, int anti_alias, int& text_flags);
390 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph_in dex, int dest_width); 390 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph_in dex, int dest_width);
391 391
392 392
393 CFX_FaceCache(FXFT_Face face); 393 CFX_FaceCache(FXFT_Face face);
394 private: 394 private:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 { 427 {
428 public: 428 public:
429 virtual void Release() = 0; 429 virtual void Release() = 0;
430 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0 ; 430 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0 ;
431 431
432 protected: 432 protected:
433 ~IFX_GSUBTable() { } 433 ~IFX_GSUBTable() { }
434 }; 434 };
435 IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont); 435 IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont);
436 #endif 436 #endif
OLDNEW
« no previous file with comments | « core/include/fxge/fx_dib.h ('k') | core/include/fxge/fx_ge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698