• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CFPF_SKIAFONT_H_
8 #define CORE_FXGE_ANDROID_CFPF_SKIAFONT_H_
9 
10 #include <stdint.h>
11 
12 #include "core/fxcrt/bytestring.h"
13 #include "core/fxcrt/fx_codepage_forward.h"
14 #include "core/fxcrt/retain_ptr.h"
15 #include "core/fxcrt/unowned_ptr.h"
16 #include "core/fxge/cfx_face.h"
17 #include "core/fxge/freetype/fx_freetype.h"
18 #include "third_party/base/span.h"
19 
20 class CFPF_SkiaFontMgr;
21 class CFPF_SkiaPathFont;
22 struct FX_RECT;
23 
24 class CFPF_SkiaFont {
25  public:
26   CFPF_SkiaFont(CFPF_SkiaFontMgr* pFontMgr,
27                 const CFPF_SkiaPathFont* pFont,
28                 uint32_t dwStyle,
29                 FX_Charset uCharset);
30   ~CFPF_SkiaFont();
31 
IsValid()32   bool IsValid() const { return !!m_Face; }
33 
34   ByteString GetFamilyName();
35   ByteString GetPsName();
GetFontStyle()36   uint32_t GetFontStyle() const { return m_dwStyle; }
GetCharset()37   FX_Charset GetCharset() const { return m_uCharset; }
38   int32_t GetGlyphIndex(wchar_t wUnicode);
39   int32_t GetGlyphWidth(int32_t iGlyphIndex);
40   int32_t GetAscent() const;
41   int32_t GetDescent() const;
42   bool GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox);
43   bool GetBBox(FX_RECT& rtBBox);
44   int32_t GetHeight() const;
45   int32_t GetItalicAngle() const;
46   uint32_t GetFontData(uint32_t dwTable, pdfium::span<uint8_t> pBuffer);
GetFaceRec()47   FXFT_FaceRec* GetFaceRec() const { return m_Face->GetRec(); }
48 
49  private:
50   UnownedPtr<CFPF_SkiaFontMgr> const m_pFontMgr;
51   UnownedPtr<const CFPF_SkiaPathFont> const m_pFont;
52   RetainPtr<CFX_Face> const m_Face;
53   const uint32_t m_dwStyle;
54   const FX_Charset m_uCharset;
55 };
56 
57 #endif  // CORE_FXGE_ANDROID_CFPF_SKIAFONT_H_
58