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

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

Issue 2246223002: Refactor fx_font part 1 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase Created 4 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
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_FXGE_INCLUDE_FX_FONT_H_ 7 #ifndef CORE_FXGE_INCLUDE_FX_FONT_H_
8 #define CORE_FXGE_INCLUDE_FX_FONT_H_ 8 #define CORE_FXGE_INCLUDE_FX_FONT_H_
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <vector> 12 #include <vector>
13 13
14 #include "core/fxcrt/include/fx_system.h" 14 #include "core/fxcrt/include/fx_system.h"
15 #include "core/fxge/include/fx_dib.h" 15 #include "core/fxge/include/fx_dib.h"
16 #include "core/fxge/include/fx_freetype.h" 16 #include "core/fxge/include/fx_freetype.h"
17 17
18 typedef struct FT_FaceRec_* FXFT_Face; 18 typedef struct FT_FaceRec_* FXFT_Face;
19 typedef void* FXFT_Library; 19 typedef void* FXFT_Library;
20 20
21 class CFX_FaceCache; 21 class CFX_FaceCache;
22 class CFX_FontCache;
22 class CFX_PathData; 23 class CFX_PathData;
23 class CFX_SizeGlyphCache; 24 class CFX_SizeGlyphCache;
24 class CFX_SubstFont; 25 class CFX_SubstFont;
25 class CTTFontDesc; 26 class CTTFontDesc;
26 27
27 #ifdef _SKIA_SUPPORT_ 28 #ifdef _SKIA_SUPPORT_
28 class SkTypeface; 29 class SkTypeface;
29 30
30 using CFX_TypeFace = SkTypeface; 31 using CFX_TypeFace = SkTypeface;
31 #endif 32 #endif
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 uint32_t m_Styles; 284 uint32_t m_Styles;
284 uint32_t m_Charsets; 285 uint32_t m_Charsets;
285 }; 286 };
286 287
287 class CFX_CountedFaceCache { 288 class CFX_CountedFaceCache {
288 public: 289 public:
289 CFX_FaceCache* m_Obj; 290 CFX_FaceCache* m_Obj;
290 uint32_t m_nCount; 291 uint32_t m_nCount;
291 }; 292 };
292 293
293 class CFX_FontCache {
294 public:
295 CFX_FontCache();
296 ~CFX_FontCache();
297 CFX_FaceCache* GetCachedFace(CFX_Font* pFont);
298 void ReleaseCachedFace(CFX_Font* pFont);
299 void FreeCache(FX_BOOL bRelease = FALSE);
300 #ifdef _SKIA_SUPPORT_
301 CFX_TypeFace* GetDeviceCache(CFX_Font* pFont);
302 #endif
303
304 private:
305 using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>;
306 CFX_FTCacheMap m_FTFaceMap;
307 CFX_FTCacheMap m_ExtFaceMap;
308 };
309
310 class CFX_AutoFontCache {
311 public:
312 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont)
313 : m_pFontCache(pFontCache), m_pFont(pFont) {}
314 ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); }
315 CFX_FontCache* m_pFontCache;
316 CFX_Font* m_pFont;
317 };
318
319 class CFX_GlyphBitmap { 294 class CFX_GlyphBitmap {
320 public: 295 public:
321 int m_Top; 296 int m_Top;
322 int m_Left; 297 int m_Left;
323 CFX_DIBitmap m_Bitmap; 298 CFX_DIBitmap m_Bitmap;
324 }; 299 };
325 300
326 class CFX_FaceCache { 301 class CFX_FaceCache {
327 public: 302 public:
328 explicit CFX_FaceCache(FXFT_Face face); 303 explicit CFX_FaceCache(FXFT_Face face);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 FX_FLOAT retinaScaleX = 1.0f, 361 FX_FLOAT retinaScaleX = 1.0f,
387 FX_FLOAT retinaScaleY = 1.0f); 362 FX_FLOAT retinaScaleY = 1.0f);
388 363
389 CFX_ByteString GetNameFromTT(const uint8_t* name_table, 364 CFX_ByteString GetNameFromTT(const uint8_t* name_table,
390 uint32_t name_table_size, 365 uint32_t name_table_size,
391 uint32_t name); 366 uint32_t name);
392 367
393 int PDF_GetStandardFontName(CFX_ByteString* name); 368 int PDF_GetStandardFontName(CFX_ByteString* name);
394 369
395 #endif // CORE_FXGE_INCLUDE_FX_FONT_H_ 370 #endif // CORE_FXGE_INCLUDE_FX_FONT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698