1 // Copyright 2014 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_SRC_FXGE_ANDROID_FPF_SKIAFONT_H_
8 #define CORE_SRC_FXGE_ANDROID_FPF_SKIAFONT_H_
9 
10 #if _FX_OS_ == _FX_ANDROID_
11 
12 #include "core/include/fxge/fpf.h"
13 
14 class CFPF_SkiaFontDescriptor;
15 class CFPF_SkiaFontMgr;
16 class SkTypeface;
17 class CFPF_SkiaFont : public IFPF_Font {
18  public:
19   CFPF_SkiaFont();
20   ~CFPF_SkiaFont() override;
21 
22   // IFPF_Font
23   void Release() override;
24   IFPF_Font* Retain() override;
25   FPF_HFONT GetHandle() override;
26   CFX_ByteString GetFamilyName() override;
27   CFX_WideString GetPsName() override;
GetFontStyle()28   FX_DWORD GetFontStyle() const override { return m_dwStyle; }
GetCharset()29   uint8_t GetCharset() const override { return m_uCharset; }
30   int32_t GetGlyphIndex(FX_WCHAR wUnicode) override;
31   int32_t GetGlyphWidth(int32_t iGlyphIndex) override;
32   int32_t GetAscent() const override;
33   int32_t GetDescent() const override;
34   FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) override;
35   FX_BOOL GetBBox(FX_RECT& rtBBox) override;
36   int32_t GetHeight() const override;
37   int32_t GetItalicAngle() const override;
38   FX_DWORD GetFontData(FX_DWORD dwTable,
39                        uint8_t* pBuffer,
40                        FX_DWORD dwSize) override;
41 
42   FX_BOOL InitFont(CFPF_SkiaFontMgr* pFontMgr,
43                    CFPF_SkiaFontDescriptor* pFontDes,
44                    const CFX_ByteStringC& bsFamily,
45                    FX_DWORD dwStyle,
46                    uint8_t uCharset);
47 
48  protected:
49   CFPF_SkiaFontMgr* m_pFontMgr;
50   CFPF_SkiaFontDescriptor* m_pFontDes;
51   FXFT_Face m_Face;
52   FX_DWORD m_dwStyle;
53   uint8_t m_uCharset;
54   FX_DWORD m_dwRefCount;
55 };
56 #endif
57 
58 #endif  // CORE_SRC_FXGE_ANDROID_FPF_SKIAFONT_H_
59