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