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_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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 uint32_t m_Styles; | 283 uint32_t m_Styles; |
283 uint32_t m_Charsets; | 284 uint32_t m_Charsets; |
284 }; | 285 }; |
285 | 286 |
286 class CFX_CountedFaceCache { | 287 class CFX_CountedFaceCache { |
287 public: | 288 public: |
288 CFX_FaceCache* m_Obj; | 289 CFX_FaceCache* m_Obj; |
289 uint32_t m_nCount; | 290 uint32_t m_nCount; |
290 }; | 291 }; |
291 | 292 |
292 class CFX_FontCache { | |
293 public: | |
294 CFX_FontCache(); | |
295 ~CFX_FontCache(); | |
296 CFX_FaceCache* GetCachedFace(CFX_Font* pFont); | |
297 void ReleaseCachedFace(CFX_Font* pFont); | |
298 void FreeCache(FX_BOOL bRelease = FALSE); | |
299 #ifdef _SKIA_SUPPORT_ | |
300 CFX_TypeFace* GetDeviceCache(CFX_Font* pFont); | |
301 #endif | |
302 | |
303 private: | |
304 using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>; | |
305 CFX_FTCacheMap m_FTFaceMap; | |
306 CFX_FTCacheMap m_ExtFaceMap; | |
307 }; | |
308 | |
309 class CFX_AutoFontCache { | |
310 public: | |
311 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) | |
312 : m_pFontCache(pFontCache), m_pFont(pFont) {} | |
313 ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); } | |
314 CFX_FontCache* m_pFontCache; | |
315 CFX_Font* m_pFont; | |
316 }; | |
317 | |
318 class CFX_GlyphBitmap { | 293 class CFX_GlyphBitmap { |
319 public: | 294 public: |
320 int m_Top; | 295 int m_Top; |
321 int m_Left; | 296 int m_Left; |
322 CFX_DIBitmap m_Bitmap; | 297 CFX_DIBitmap m_Bitmap; |
323 }; | 298 }; |
324 | 299 |
325 class CFX_FaceCache { | 300 class CFX_FaceCache { |
326 public: | 301 public: |
327 explicit CFX_FaceCache(FXFT_Face face); | 302 explicit CFX_FaceCache(FXFT_Face face); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 FX_FLOAT retinaScaleX = 1.0f, | 360 FX_FLOAT retinaScaleX = 1.0f, |
386 FX_FLOAT retinaScaleY = 1.0f); | 361 FX_FLOAT retinaScaleY = 1.0f); |
387 | 362 |
388 CFX_ByteString GetNameFromTT(const uint8_t* name_table, | 363 CFX_ByteString GetNameFromTT(const uint8_t* name_table, |
389 uint32_t name_table_size, | 364 uint32_t name_table_size, |
390 uint32_t name); | 365 uint32_t name); |
391 | 366 |
392 int PDF_GetStandardFontName(CFX_ByteString* name); | 367 int PDF_GetStandardFontName(CFX_ByteString* name); |
393 | 368 |
394 #endif // CORE_FXGE_INCLUDE_FX_FONT_H_ | 369 #endif // CORE_FXGE_INCLUDE_FX_FONT_H_ |
OLD | NEW |