Example #1
0
// ¸ÖƼ¶óÀÎ Áö¿øÀ» À§ÇØ ±ÛÀÚ ´ÜÀ§ Ãâ·Â
int Mint::DrawCompositionAttribute(MDrawContext* pDC, MPOINT& p, const char* szComposition, int i)
{
	if(i>=(int)strlen(szComposition)) return 0;
	//if(pMint->GetPrimaryLanguageIdentifier()!=LANG_JAPANESE) return;

	const BYTE* pCompAttr = GetCompositionAttributes();
	DWORD nCompAttrSize = GetCompositionAttributeSize();

	if(i>=(int)nCompAttrSize) return 0;	// Composition Attribute ¹üÀ§¸¦ ¹þ¾î³ª´Â °æ¿ì

	MFont* pFont = pDC->GetFont();
	int nFontHeight = pFont->GetHeight();
	MCOLOR c = pDC->GetColor();

	int nCharSize = 1;
	bool bTwoByteChar = IsHangul(szComposition[i]);
	if(bTwoByteChar) nCharSize = 2;
	int nWidth = pFont->GetWidth(&(szComposition[i]), nCharSize);

	if(pCompAttr[i]==ATTR_TARGET_CONVERTED)				// º¯È¯µÉ ³»¿ë
		pDC->SetColor(MCOLOR(255, 0, 0, 128));
	else if(pCompAttr[i]==ATTR_TARGET_NOTCONVERTED)		// º¯È¯µÇÁö ¾Ê´Â ³»¿ë
		pDC->SetColor(MCOLOR(0, 196, 0, 128));
	else												// º¯È¯ °¡´É Àý
		pDC->SetColor(MCOLOR(128, 128, 128, 128));

	pDC->FillRectangle(p.x, p.y, nWidth, nFontHeight);

	pDC->SetColor(c);

	return nWidth;
}
Example #2
0
void Mint::DrawCompositionAttributes(MDrawContext* pDC, MPOINT& p, const char* szComposition)
{
	if(strlen(szComposition)==0) return;

	int nWidth = 0;

	for(int i=0; szComposition[i]!=NULL; i++){
		bool bTwoByteChar = IsHangul(szComposition[i]);

		nWidth += DrawCompositionAttribute(pDC, MPOINT(p.x+nWidth, p.y), szComposition, i);

		if(bTwoByteChar) i++;
	}
}
Example #3
0
BOOL IsNative( LPCTSTR lpszStr )
{
	ASSERT( g_codePage != 0 );

	LPCWSTR pwSrc = (LPCWSTR) lpszStr;

	if( g_codePage == 874 ) // 타이 
	{
		return (BYTE)*lpszStr >= 0xa1 && (BYTE)*lpszStr <= 0xfb;
	}
	else
	if( g_codePage == 949 ) // 한글 
	{
		return IsHangul( *pwSrc );
	}
	else
	if( g_codePage == 932 ) // 일본 
	{
		return IsDBCSLeadByte( (BYTE)( *pwSrc ) );
	}
	else
	if( g_codePage == 936 ) // 한자 : 중국
	{
		return IsDBCSLeadByte( (BYTE)( *pwSrc ) );
	}
	else
	if( g_codePage == 950 ) // 한자 : 대만 
	{
//		return IsDBCSLeadByte( *pwSrc );

		if( ((BYTE)*lpszStr >= 0xCA && (BYTE)*lpszStr <= 0xFD) && ( (BYTE)*lpszStr+1 >= 0xA1 ) && ( (BYTE)*lpszStr+1 <= 0xFE) )
		{
			return TRUE;
		}
		else
		if ( ( ( (BYTE)*lpszStr >= 0x41 ) && 
		 	 ( (BYTE)*lpszStr <= 0x5A ) ) || 
		   	( ( (BYTE)*lpszStr >= 0x61 ) && ( (BYTE)*lpszStr <= 0x7A) ) ) 	
		{ 
			return TRUE;			
		} 
		else
		if( isdigit2( (BYTE)*lpszStr ) )
			return TRUE;
		
	}
	return FALSE;
}