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