xref: /aosp_15_r20/external/pdfium/core/fxge/android/cfx_androidfontinfo.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2016 The PDFium Authors
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_ANDROID_CFX_ANDROIDFONTINFO_H_
8 #define CORE_FXGE_ANDROID_CFX_ANDROIDFONTINFO_H_
9 
10 #include <stdint.h>
11 
12 #include "core/fxcrt/unowned_ptr.h"
13 #include "core/fxge/cfx_fontmapper.h"
14 #include "core/fxge/systemfontinfo_iface.h"
15 #include "third_party/base/containers/span.h"
16 
17 class CFPF_SkiaFontMgr;
18 
19 class CFX_AndroidFontInfo final : public SystemFontInfoIface {
20  public:
21   CFX_AndroidFontInfo();
22   ~CFX_AndroidFontInfo() override;
23 
24   bool Init(CFPF_SkiaFontMgr* pFontMgr);
25 
26   // SystemFontInfoIface:
27   bool EnumFontList(CFX_FontMapper* pMapper) override;
28   void* MapFont(int weight,
29                 bool bItalic,
30                 FX_Charset charset,
31                 int pitch_family,
32                 const ByteString& face) override;
33   void* GetFont(const ByteString& face) override;
34   size_t GetFontData(void* hFont,
35                      uint32_t table,
36                      pdfium::span<uint8_t> buffer) override;
37   bool GetFaceName(void* hFont, ByteString* name) override;
38   bool GetFontCharset(void* hFont, FX_Charset* charset) override;
39   void DeleteFont(void* hFont) override;
40 
41  private:
42   UnownedPtr<CFPF_SkiaFontMgr> m_pFontMgr;
43 };
44 
45 #endif  // CORE_FXGE_ANDROID_CFX_ANDROIDFONTINFO_H_
46