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_INCLUDE_FXGE_FPF_H_ 8 #define CORE_INCLUDE_FXGE_FPF_H_ 9 10 #include "core/include/fxcrt/fx_coordinates.h" 11 12 class IFPF_FontMgr; 13 14 class IFPF_DeviceModule { 15 public: ~IFPF_DeviceModule()16 virtual ~IFPF_DeviceModule() {} 17 virtual void Destroy() = 0; 18 virtual IFPF_FontMgr* GetFontMgr() = 0; 19 }; 20 21 IFPF_DeviceModule* FPF_GetDeviceModule(); 22 23 #define FPF_MATCHFONT_REPLACEANSI 1 24 25 typedef struct FPF_HFONT_ { void* pData; } * FPF_HFONT; 26 27 class IFPF_Font { 28 public: 29 virtual void Release() = 0; 30 virtual IFPF_Font* Retain() = 0; 31 virtual FPF_HFONT GetHandle() = 0; 32 virtual CFX_ByteString GetFamilyName() = 0; 33 virtual CFX_WideString GetPsName() = 0; 34 virtual FX_DWORD GetFontStyle() const = 0; 35 virtual uint8_t GetCharset() const = 0; 36 37 virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode) = 0; 38 virtual int32_t GetGlyphWidth(int32_t iGlyphIndex) = 0; 39 40 virtual int32_t GetAscent() const = 0; 41 virtual int32_t GetDescent() const = 0; 42 43 virtual FX_BOOL GetGlyphBBox(int32_t iGlyphIndex, FX_RECT& rtBBox) = 0; 44 virtual FX_BOOL GetBBox(FX_RECT& rtBBox) = 0; 45 46 virtual int32_t GetHeight() const = 0; 47 virtual int32_t GetItalicAngle() const = 0; 48 virtual FX_DWORD GetFontData(FX_DWORD dwTable, 49 uint8_t* pBuffer, 50 FX_DWORD dwSize) = 0; 51 52 protected: ~IFPF_Font()53 virtual ~IFPF_Font() {} 54 }; 55 56 class IFPF_FontMgr { 57 public: ~IFPF_FontMgr()58 virtual ~IFPF_FontMgr() {} 59 virtual void LoadSystemFonts() = 0; 60 virtual void LoadPrivateFont(IFX_FileRead* pFontFile) = 0; 61 virtual void LoadPrivateFont(const CFX_ByteStringC& bsFileName) = 0; 62 virtual void LoadPrivateFont(void* pBuffer, size_t szBuffer) = 0; 63 64 virtual IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname, 65 uint8_t charset, 66 FX_DWORD dwStyle, 67 FX_DWORD dwMatch = 0) = 0; 68 }; 69 70 #endif // CORE_INCLUDE_FXGE_FPF_H_ 71