1 // Copyright 2014 PDFium Authors. All rights reserved.
\r
2 // Use of this source code is governed by a BSD-style license that can be
\r
3 // found in the LICENSE file.
\r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
\r
7 #ifndef _FX_GRAPHOBJS_IMP
\r
8 #define _FX_GRAPHOBJS_IMP
\r
10 class CFX_GEFontMgr;
\r
11 #ifndef FXFONT_SUBST_ITALIC
\r
12 #define FXFONT_SUBST_ITALIC 0x02
\r
14 class CFX_GEFont : public IFX_Font, public CFX_ThreadLock, public CFX_Object
\r
17 CFX_GEFont(const CFX_GEFont &src, FX_DWORD dwFontStyles);
\r
18 CFX_GEFont(IFX_FontMgr *pFontMgr);
\r
20 virtual void Release();
\r
21 virtual IFX_Font* Retain();
\r
22 FX_BOOL LoadFont(FX_LPCWSTR pszFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage);
\r
23 FX_BOOL LoadFont(FX_LPCBYTE pBuffer, FX_INT32 length);
\r
24 FX_BOOL LoadFont(FX_LPCWSTR pszFileName);
\r
25 FX_BOOL LoadFont(IFX_Stream *pFontStream, FX_BOOL bSaveStream);
\r
26 FX_BOOL LoadFont(CFX_Font *pExtFont, FX_BOOL bTakeOver = FALSE);
\r
27 virtual IFX_Font* Derive(FX_DWORD dwFontStyles, FX_WORD wCodePage = 0);
\r
28 virtual void GetFamilyName(CFX_WideString &wsFamily) const;
\r
29 virtual void GetPsName(CFX_WideString &wsName) const;
\r
30 virtual FX_DWORD GetFontStyles() const;
\r
31 virtual FX_BYTE GetCharSet() const;
\r
32 virtual FX_BOOL GetCharWidth(FX_WCHAR wUnicode, FX_INT32 &iWidth, FX_BOOL bCharCode = FALSE);
\r
33 virtual FX_INT32 GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode = FALSE);
\r
34 virtual FX_INT32 GetAscent() const;
\r
35 virtual FX_INT32 GetDescent() const;
\r
36 virtual FX_BOOL GetCharBBox(FX_WCHAR wUnicode, CFX_Rect &bbox, FX_BOOL bCharCode = FALSE);
\r
37 virtual FX_BOOL GetBBox(CFX_Rect &bbox);
\r
38 virtual FX_INT32 GetItalicAngle() const;
\r
39 virtual void Reset();
\r
40 virtual IFX_Font* GetSubstFont(FX_INT32 iGlyphIndex) const;
\r
41 virtual void* GetDevFont()const
\r
43 return (void*)m_pFont;
\r
45 virtual void SetFontProvider(IFX_FontProvider* pProvider)
\r
47 m_pProvider = pProvider;
\r
49 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
\r
50 virtual void SetLogicalFontStyle(FX_DWORD dwLogFontStyle)
\r
52 m_bUseLogFontStyle = TRUE;
\r
53 m_dwLogFontStyle = dwLogFontStyle;
\r
57 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
\r
58 FX_BOOL m_bUseLogFontStyle;
\r
59 FX_DWORD m_dwLogFontStyle;
\r
62 IFX_FontMgr *m_pFontMgr;
\r
63 FX_INT32 m_iRefCount;
\r
65 IFX_Stream *m_pStream;
\r
66 IFX_FileRead *m_pFileRead;
\r
67 IFX_FontEncoding *m_pFontEncoding;
\r
68 CFX_WordDiscreteArray *m_pCharWidthMap;
\r
69 CFX_RectMassArray *m_pRectArray;
\r
70 CFX_MapPtrToPtr *m_pBBoxMap;
\r
71 IFX_FontProvider *m_pProvider;
\r
73 CFX_PtrArray m_SubstFonts;
\r
74 CFX_MapPtrToPtr m_FontMapper;
\r
76 FX_BOOL GetCharBBox(FX_WCHAR wUnicode, CFX_Rect &bbox, FX_BOOL bRecursive, FX_BOOL bCharCode = FALSE);
\r
77 FX_BOOL GetCharWidth(FX_WCHAR wUnicode, FX_INT32 &iWidth, FX_BOOL bRecursive, FX_BOOL bCharCode = FALSE);
\r
78 FX_INT32 GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bRecursive, IFX_Font **ppFont, FX_BOOL bCharCode = FALSE);
\r