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_ANDROID_CFPF_SKIAFONT_H_
8#define CORE_FXGE_ANDROID_CFPF_SKIAFONT_H_
9
10#include "core/fxcrt/fx_system.h"
11#include "core/fxge/fx_font.h"
12
13class CFPF_SkiaFontDescriptor;
14class CFPF_SkiaFontMgr;
15
16class CFPF_SkiaFont {
17 public:
18  CFPF_SkiaFont();
19  ~CFPF_SkiaFont();
20
21  void Release();
22  CFPF_SkiaFont* Retain();
23
24  CFX_ByteString GetFamilyName();
25  CFX_ByteString GetPsName();
26  uint32_t GetFontStyle() const { return m_dwStyle; }
27  uint8_t GetCharset() const { return m_uCharset; }
28  int32_t GetGlyphIndex(FX_WCHAR wUnicode);
29  int32_t GetGlyphWidth(int32_t iGlyphIndex);
30  int32_t GetAscent() const;
31  int32_t GetDescent() const;
32  bool GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox);
33  bool GetBBox(FX_RECT& rtBBox);
34  int32_t GetHeight() const;
35  int32_t GetItalicAngle() const;
36  uint32_t GetFontData(uint32_t dwTable, uint8_t* pBuffer, uint32_t dwSize);
37
38  bool InitFont(CFPF_SkiaFontMgr* pFontMgr,
39                CFPF_SkiaFontDescriptor* pFontDes,
40                const CFX_ByteStringC& bsFamily,
41                uint32_t dwStyle,
42                uint8_t uCharset);
43
44 private:
45  CFPF_SkiaFontMgr* m_pFontMgr;
46  CFPF_SkiaFontDescriptor* m_pFontDes;
47  FXFT_Face m_Face;
48  uint32_t m_dwStyle;
49  uint8_t m_uCharset;
50  uint32_t m_dwRefCount;
51};
52
53#endif  // CORE_FXGE_ANDROID_CFPF_SKIAFONT_H_
54