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_SYSTEMFONTINFO_IFACE_H_
8 #define CORE_FXGE_SYSTEMFONTINFO_IFACE_H_
9 
10 #include <memory>
11 
12 #include "core/fxge/cfx_fontmapper.h"
13 #include "third_party/base/span.h"
14 
15 constexpr uint32_t kTableNAME = CFX_FontMapper::MakeTag('n', 'a', 'm', 'e');
16 constexpr uint32_t kTableTTCF = CFX_FontMapper::MakeTag('t', 't', 'c', 'f');
17 
18 class SystemFontInfoIface {
19  public:
20   static std::unique_ptr<SystemFontInfoIface> CreateDefault(
21       const char** pUserPaths);
22 
23   virtual ~SystemFontInfoIface() = default;
24 
25   virtual bool EnumFontList(CFX_FontMapper* pMapper) = 0;
26   virtual void* MapFont(int weight,
27                         bool bItalic,
28                         int charset,
29                         int pitch_family,
30                         const char* face) = 0;
31   virtual void* GetFont(const char* face) = 0;
32   virtual uint32_t GetFontData(void* hFont,
33                                uint32_t table,
34                                pdfium::span<uint8_t> buffer) = 0;
35   virtual bool GetFaceName(void* hFont, ByteString* name) = 0;
36   virtual bool GetFontCharset(void* hFont, int* charset) = 0;
37   virtual int GetFaceIndex(void* hFont);
38   virtual void DeleteFont(void* hFont) = 0;
39 };
40 
41 #endif  // CORE_FXGE_SYSTEMFONTINFO_IFACE_H_
42