OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_GE_CFX_FOLDERFONTINFO_H_ | 7 #ifndef CORE_FXGE_GE_CFX_FOLDERFONTINFO_H_ |
8 #define CORE_FXGE_GE_CFX_FOLDERFONTINFO_H_ | 8 #define CORE_FXGE_GE_CFX_FOLDERFONTINFO_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "core/fxge/cfx_fontmapper.h" | 13 #include "core/fxge/cfx_fontmapper.h" |
14 #include "core/fxge/fx_font.h" | 14 #include "core/fxge/fx_font.h" |
15 #include "core/fxge/ifx_systemfontinfo.h" | 15 #include "core/fxge/ifx_systemfontinfo.h" |
16 | 16 |
17 class CFX_FolderFontInfo : public IFX_SystemFontInfo { | 17 class CFX_FolderFontInfo : public IFX_SystemFontInfo { |
18 public: | 18 public: |
19 CFX_FolderFontInfo(); | 19 CFX_FolderFontInfo(); |
20 ~CFX_FolderFontInfo() override; | 20 ~CFX_FolderFontInfo() override; |
21 | 21 |
22 void AddPath(const CFX_ByteStringC& path); | 22 void AddPath(const CFX_ByteStringC& path); |
23 | 23 |
24 // IFX_SytemFontInfo: | 24 // IFX_SytemFontInfo: |
25 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; | 25 bool EnumFontList(CFX_FontMapper* pMapper) override; |
26 void* MapFont(int weight, | 26 void* MapFont(int weight, |
27 FX_BOOL bItalic, | 27 bool bItalic, |
28 int charset, | 28 int charset, |
29 int pitch_family, | 29 int pitch_family, |
30 const FX_CHAR* face, | 30 const FX_CHAR* face, |
31 int& bExact) override; | 31 int& bExact) override; |
32 #ifdef PDF_ENABLE_XFA | 32 #ifdef PDF_ENABLE_XFA |
33 void* MapFontByUnicode(uint32_t dwUnicode, | 33 void* MapFontByUnicode(uint32_t dwUnicode, |
34 int weight, | 34 int weight, |
35 FX_BOOL bItalic, | 35 bool bItalic, |
36 int pitch_family) override; | 36 int pitch_family) override; |
37 #endif // PDF_ENABLE_XFA | 37 #endif // PDF_ENABLE_XFA |
38 void* GetFont(const FX_CHAR* face) override; | 38 void* GetFont(const FX_CHAR* face) override; |
39 uint32_t GetFontData(void* hFont, | 39 uint32_t GetFontData(void* hFont, |
40 uint32_t table, | 40 uint32_t table, |
41 uint8_t* buffer, | 41 uint8_t* buffer, |
42 uint32_t size) override; | 42 uint32_t size) override; |
43 void DeleteFont(void* hFont) override; | 43 void DeleteFont(void* hFont) override; |
44 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; | 44 bool GetFaceName(void* hFont, CFX_ByteString& name) override; |
45 FX_BOOL GetFontCharset(void* hFont, int& charset) override; | 45 bool GetFontCharset(void* hFont, int& charset) override; |
46 | 46 |
47 protected: | 47 protected: |
48 void ScanPath(const CFX_ByteString& path); | 48 void ScanPath(const CFX_ByteString& path); |
49 void ScanFile(const CFX_ByteString& path); | 49 void ScanFile(const CFX_ByteString& path); |
50 void ReportFace(const CFX_ByteString& path, | 50 void ReportFace(const CFX_ByteString& path, |
51 FXSYS_FILE* pFile, | 51 FXSYS_FILE* pFile, |
52 uint32_t filesize, | 52 uint32_t filesize, |
53 uint32_t offset); | 53 uint32_t offset); |
54 void* GetSubstFont(const CFX_ByteString& face); | 54 void* GetSubstFont(const CFX_ByteString& face); |
55 void* FindFont(int weight, | 55 void* FindFont(int weight, |
56 FX_BOOL bItalic, | 56 bool bItalic, |
57 int charset, | 57 int charset, |
58 int pitch_family, | 58 int pitch_family, |
59 const FX_CHAR* family, | 59 const FX_CHAR* family, |
60 FX_BOOL bMatchName); | 60 bool bMatchName); |
61 | 61 |
62 std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList; | 62 std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList; |
63 std::vector<CFX_ByteString> m_PathList; | 63 std::vector<CFX_ByteString> m_PathList; |
64 CFX_FontMapper* m_pMapper; | 64 CFX_FontMapper* m_pMapper; |
65 }; | 65 }; |
66 | 66 |
67 #endif // CORE_FXGE_GE_CFX_FOLDERFONTINFO_H_ | 67 #endif // CORE_FXGE_GE_CFX_FOLDERFONTINFO_H_ |
OLD | NEW |