Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
|
dsinclair
2016/07/27 17:36:01
nit: 2016
npm
2016/07/27 18:51:57
Done.
| |
| 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_FOLDERFONTINFO_H_ | |
| 8 #define CORE_FXGE_INCLUDE_CFX_FOLDERFONTINFO_H_ | |
| 9 | |
| 10 #include "core/fxge/include/cfx_fontmapper.h" | |
| 11 #include "core/fxge/include/fx_font.h" | |
| 12 | |
| 13 class IFX_SystemFontInfo { | |
|
dsinclair
2016/07/27 17:36:01
Can you move this to it's own .h file as well? Loo
npm
2016/07/27 18:51:57
Done.
| |
| 14 public: | |
| 15 static std::unique_ptr<IFX_SystemFontInfo> CreateDefault( | |
| 16 const char** pUserPaths); | |
| 17 | |
| 18 virtual ~IFX_SystemFontInfo() {} | |
| 19 | |
| 20 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; | |
| 21 virtual void* MapFont(int weight, | |
| 22 FX_BOOL bItalic, | |
| 23 int charset, | |
| 24 int pitch_family, | |
| 25 const FX_CHAR* face, | |
| 26 int& iExact) = 0; | |
| 27 | |
| 28 #ifdef PDF_ENABLE_XFA | |
| 29 virtual void* MapFontByUnicode(uint32_t dwUnicode, | |
| 30 int weight, | |
| 31 FX_BOOL bItalic, | |
| 32 int pitch_family); | |
| 33 #endif // PDF_ENABLE_XFA | |
| 34 | |
| 35 virtual void* GetFont(const FX_CHAR* face) = 0; | |
| 36 virtual uint32_t GetFontData(void* hFont, | |
| 37 uint32_t table, | |
| 38 uint8_t* buffer, | |
| 39 uint32_t size) = 0; | |
| 40 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; | |
| 41 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; | |
| 42 virtual int GetFaceIndex(void* hFont); | |
| 43 virtual void DeleteFont(void* hFont) = 0; | |
| 44 virtual void* RetainFont(void* hFont); | |
| 45 }; | |
| 46 | |
| 47 class CFX_FolderFontInfo : public IFX_SystemFontInfo { | |
| 48 public: | |
| 49 CFX_FolderFontInfo(); | |
| 50 ~CFX_FolderFontInfo() override; | |
| 51 | |
| 52 void AddPath(const CFX_ByteStringC& path); | |
| 53 | |
| 54 // IFX_SytemFontInfo: | |
| 55 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; | |
| 56 void* MapFont(int weight, | |
| 57 FX_BOOL bItalic, | |
| 58 int charset, | |
| 59 int pitch_family, | |
| 60 const FX_CHAR* face, | |
| 61 int& bExact) override; | |
| 62 #ifdef PDF_ENABLE_XFA | |
| 63 void* MapFontByUnicode(uint32_t dwUnicode, | |
| 64 int weight, | |
| 65 FX_BOOL bItalic, | |
| 66 int pitch_family) override; | |
| 67 #endif // PDF_ENABLE_XFA | |
| 68 void* GetFont(const FX_CHAR* face) override; | |
| 69 uint32_t GetFontData(void* hFont, | |
| 70 uint32_t table, | |
| 71 uint8_t* buffer, | |
| 72 uint32_t size) override; | |
| 73 void DeleteFont(void* hFont) override; | |
| 74 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; | |
| 75 FX_BOOL GetFontCharset(void* hFont, int& charset) override; | |
| 76 | |
| 77 protected: | |
| 78 void ScanPath(const CFX_ByteString& path); | |
| 79 void ScanFile(const CFX_ByteString& path); | |
| 80 void ReportFace(const CFX_ByteString& path, | |
| 81 FXSYS_FILE* pFile, | |
| 82 uint32_t filesize, | |
| 83 uint32_t offset); | |
| 84 void* GetSubstFont(const CFX_ByteString& face); | |
| 85 void* FindFont(int weight, | |
| 86 FX_BOOL bItalic, | |
| 87 int charset, | |
| 88 int pitch_family, | |
| 89 const FX_CHAR* family, | |
| 90 FX_BOOL bMatchName); | |
| 91 | |
| 92 std::map<CFX_ByteString, CFX_FontFaceInfo*> m_FontList; | |
| 93 std::vector<CFX_ByteString> m_PathList; | |
| 94 CFX_FontMapper* m_pMapper; | |
| 95 }; | |
| 96 | |
| 97 #endif // CORE_FXGE_INCLUDE_CFX_FOLDERFONTINFO_H_ | |
| OLD | NEW |