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
7struct _CFX_UniqueKeyGen {
8    void		Generate(int count, ...);
9    FX_CHAR		m_Key[128];
10    int			m_KeyLen;
11};
12class CFX_SizeGlyphCache : public CFX_Object
13{
14public:
15    CFX_SizeGlyphCache()
16    {
17        m_GlyphMap.InitHashTable(253);
18    }
19    ~CFX_SizeGlyphCache();
20    CFX_MapPtrToPtr			m_GlyphMap;
21};
22class CTTFontDesc : public CFX_Object
23{
24public:
25    CTTFontDesc()
26    {
27        m_Type = 0;
28        m_pFontData = NULL;
29        m_RefCount = 0;
30    }
31    ~CTTFontDesc();
32    FX_BOOL			ReleaseFace(FXFT_Face face);
33    int				m_Type;
34    union {
35        struct {
36            FX_BOOL		m_bItalic;
37            FX_BOOL		m_bBold;
38            FXFT_Face	m_pFace;
39        } m_SingleFace;
40        struct {
41            FXFT_Face	m_pFaces[16];
42        } m_TTCFace;
43    };
44    FX_BYTE*		m_pFontData;
45    int				m_RefCount;
46};
47class CFX_UnicodeEncoding : public IFX_FontEncoding
48{
49public:
50    CFX_UnicodeEncoding(CFX_Font* pFont);
51    virtual FX_DWORD		GlyphFromCharCodeEx(FX_DWORD charcode, int encoding = ENCODING_UNICODE);
52private:
53    CFX_Font*			m_pFont;
54    virtual FX_DWORD		GlyphFromCharCode(FX_DWORD charcode);
55    virtual CFX_WideString	UnicodeFromCharCode(FX_DWORD charcode) const
56    {
57        return CFX_WideString((FX_WCHAR)charcode);
58    }
59    virtual FX_DWORD		CharCodeFromUnicode(FX_WCHAR Unicode) const
60    {
61        return Unicode;
62    }
63    virtual FX_BOOL			IsUnicodeCompatible() const
64    {
65        return TRUE;
66    }
67};
68#define CHARSET_FLAG_ANSI		1
69#define CHARSET_FLAG_SYMBOL		2
70#define CHARSET_FLAG_SHIFTJIS	4
71#define CHARSET_FLAG_BIG5		8
72#define CHARSET_FLAG_GB			16
73#define CHARSET_FLAG_KOREAN		32
74class CFontFaceInfo : public CFX_Object
75{
76public:
77    CFX_ByteString		m_FilePath;
78    CFX_ByteString		m_FaceName;
79    FX_DWORD			m_Styles;
80    FX_DWORD			m_Charsets;
81    FX_DWORD			m_FontOffset;
82    FX_DWORD			m_FileSize;
83    CFX_ByteString		m_FontTables;
84};
85class CFontFileFaceInfo : public CFX_Object
86{
87public:
88    CFontFileFaceInfo();
89    ~CFontFileFaceInfo();
90    IFX_FileStream*		m_pFile;
91    FXFT_Face			m_Face;
92    CFX_ByteString		m_FaceName;
93    FX_DWORD			m_Charsets;
94    FX_DWORD			m_FileSize;
95    FX_DWORD			m_FontOffset;
96    int					m_Weight;
97    FX_BOOL				m_bItalic;
98    int					m_PitchFamily;
99    CFX_ByteString		m_FontTables;
100};
101