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