www.pudn.com > WinGOS.rar > ChsCharSet.cpp


#include "gos.h" 
#include "chscharset.h" 
 
extern const FONTFACE g_fntChs; 
 
DWORD CChsCharSet::GetCharType(DWORD nCode) 
{ 
	if(nCode>255) 
		return CHARTYPE_WORDBREAK|CHARTYPE_DBLBYTES; 
	return CCharSet::GetCharType(nCode); 
} 
 
DWORD CChsCharSet::ParseText(LPCTSTR& pText) 
{ 
	DWORD nCode=BYTE(*pText++); 
	if(nCode>128) 
	{ 
		nCode<<=8; 
		nCode|=BYTE(*pText++); 
		return nCode; 
	} 
	return nCode; 
} 
 
DWORD CChsCharSet::Translate(DWORD nCode,BOOL bToSystem) 
{ 
	return nCode; 
} 
 
CChsFontFace::CChsFontFace() 
{ 
	m_ff=g_fntChs; 
	m_pFF=new CFontFace(); 
} 
 
CChsFontFace::~CChsFontFace() 
{ 
	delete m_pFF; 
} 
 
PBYTE CChsFontFace::FindChar(DWORD nCharCode) 
{ 
	if(nCharCode>255) 
	{ 
		nCharCode=((nCharCode>>8)-0xa1)*94+(nCharCode&0xff)-0xa1; 
		return CFontFace::FindChar(nCharCode); 
	} 
	return m_pFF->FindChar(nCharCode); 
} 
 
void CChsFontFace::DrawFont(FFDRAWARG& pv) 
{ 
	if(pv.nCharCode>255) 
		CFontFace::DrawFont(pv); 
	else 
		m_pFF->DrawFont(pv); 
} 
 
int CChsFontFace::GetCharWidth(DWORD nCharCode,int nSize) 
{ 
	if(nCharCode>255) 
		return CFontFace::GetCharWidth(nCharCode,nSize); 
	return m_pFF->GetCharWidth(nCharCode,nSize); 
}