www.pudn.com > WinGOS.rar > CharSet.h


#ifndef _GOS_CHARSET_H 
#define _GOS_CHARSET_H 
 
enum _tagCharSet 
{ 
	CHARTYPE_WORDBREAK		=0x00010000L, 
	CHARTYPE_DBLBYTES		=0x00020000L, 
	FONTTYPE_MONOSPACED		=0x40000000L, 
	FONTTYPE_TRUETYPE		=0x80000000L, 
}; 
 
class CROP; 
class CFontFace; 
 
typedef struct _tagCHARSECT 
{ 
	DWORD nMinChar; 
	DWORD nMaxChar; 
	PCVOID pData; 
}CHARSECT,*PCHARSECT; 
 
typedef struct _tagFFDRAWARG 
{ 
	DWORD nPos;	//ROP的位置 
	int w,h; //显示的尺寸 
	SIZE sd; //每像素步矩 
	int nDxSum;	//x步矩累计 
	int nDySum; //y步矩累计 
	PBYTE pData; //字体的位图数据 
	int x,y; //字体开始绘制点 
	SIZE sfd; //字体每点步矩 
	DWORD nCharCode; 
	CROP rp;	//画点的ROP 
	CROP* pBkRop; //背景ROP 
}FFDRAWARG,*PFFDRAWARG; 
 
typedef PBYTE (*PFNFFFINDCHAR)(CFontFace& ff,DWORD nCharCode); 
typedef	void (*PFNFFDRAWFONT)(CFontFace& ff,FFDRAWARG& pv); 
typedef	void (*PFNFFDRAWFONT)(CFontFace& ff,FFDRAWARG& pv); 
 
typedef struct _tagFONTFACE 
{ 
	DWORD nType; 
	const CHARSECT *pSect; 
	WORD nSectSize; 
	WORD nWidth; 
	WORD nHeight; 
	WORD nFontBytes; 
}FONTFACE,*PFONTFACE; 
 
class CFontFace 
{ 
public: 
	virtual PBYTE FindChar(DWORD nCharCode); 
	virtual void DrawFont(FFDRAWARG& pv); 
	virtual int GetCharWidth(DWORD nCharCode,int nFontSize); 
public: 
	const FONTFACE& GetFontFace(){return m_ff;} 
	CFontFace(); 
protected: 
	FONTFACE m_ff; 
}; 
 
class CCharSet 
{ 
public: 
	virtual DWORD GetCharType(DWORD nCode); 
	virtual DWORD ParseText(LPCTSTR& pText); 
	virtual DWORD Translate(DWORD nCode,BOOL bToSystem); 
public: 
	int GetTextLength(LPCTSTR pText); 
	void SetFontFace(CFontFace* pFF){m_pFontFace=pFF;} 
	CFontFace* GetFontFace(){return m_pFontFace;} 
private: 
	CFontFace* m_pFontFace; 
}; 
 
extern const FONTFACE g_fntEng; 
 
#endif //_GOS_CHARSET_H