OLD | NEW |
| (Empty) |
1 // Copyright 2016 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef CORE_FXGE_INCLUDE_CFX_FONTMAPPER_H_ | |
8 #define CORE_FXGE_INCLUDE_CFX_FONTMAPPER_H_ | |
9 | |
10 #include <memory> | |
11 #include <vector> | |
12 | |
13 #include "core/fxge/include/cfx_fontmgr.h" | |
14 #include "core/fxge/include/fx_font.h" | |
15 | |
16 class CFX_SubstFont; | |
17 | |
18 class CFX_FontMapper { | |
19 public: | |
20 explicit CFX_FontMapper(CFX_FontMgr* mgr); | |
21 ~CFX_FontMapper(); | |
22 | |
23 void SetSystemFontInfo(std::unique_ptr<IFX_SystemFontInfo> pFontInfo); | |
24 IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo.get(); } | |
25 void AddInstalledFont(const CFX_ByteString& name, int charset); | |
26 void LoadInstalledFonts(); | |
27 | |
28 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, | |
29 FX_BOOL bTrueType, | |
30 uint32_t flags, | |
31 int weight, | |
32 int italic_angle, | |
33 int CharsetCP, | |
34 CFX_SubstFont* pSubstFont); | |
35 #ifdef PDF_ENABLE_XFA | |
36 FXFT_Face FindSubstFontByUnicode(uint32_t dwUnicode, | |
37 uint32_t flags, | |
38 int weight, | |
39 int italic_angle); | |
40 #endif // PDF_ENABLE_XFA | |
41 FX_BOOL IsBuiltinFace(const FXFT_Face face) const; | |
42 int GetFaceSize() const; | |
43 CFX_ByteString GetFaceName(int index) const { | |
44 return m_FaceArray[index].name; | |
45 } | |
46 | |
47 std::vector<CFX_ByteString> m_InstalledTTFonts; | |
48 | |
49 private: | |
50 static const size_t MM_FACE_COUNT = 2; | |
51 static const size_t FOXIT_FACE_COUNT = 14; | |
52 | |
53 CFX_ByteString GetPSNameFromTT(void* hFont); | |
54 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name); | |
55 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, | |
56 int iBaseFont, | |
57 int italic_angle, | |
58 int weight, | |
59 int picthfamily); | |
60 FXFT_Face GetCachedTTCFace(void* hFont, | |
61 const uint32_t tableTTCF, | |
62 uint32_t ttc_size, | |
63 uint32_t font_size); | |
64 FXFT_Face GetCachedFace(void* hFont, | |
65 CFX_ByteString SubstName, | |
66 int weight, | |
67 FX_BOOL bItalic, | |
68 uint32_t font_size); | |
69 | |
70 struct FaceData { | |
71 CFX_ByteString name; | |
72 uint32_t charset; | |
73 }; | |
74 | |
75 FX_BOOL m_bListLoaded; | |
76 FXFT_Face m_MMFaces[MM_FACE_COUNT]; | |
77 CFX_ByteString m_LastFamily; | |
78 std::vector<FaceData> m_FaceArray; | |
79 std::unique_ptr<IFX_SystemFontInfo> m_pFontInfo; | |
80 FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; | |
81 CFX_FontMgr* const m_pFontMgr; | |
82 }; | |
83 | |
84 #endif // CORE_FXGE_INCLUDE_CFX_FONTMAPPER_H_ | |
OLD | NEW |