BOOL
_DC::GetTextSizeEx(std::string* pStr, Size& szText){
	if( !context_ )
		return FALSE;

	LOGFONT lf;
	FONTDef pRealFont = SelectObject(*GetFontTemp());
	Font realFont;
	realFont.Attach(pRealFont);
	realFont.GetLogFont(&lf);
	SelectObject(pRealFont);
	realFont.Detach();

	wchar_t		wszTemp[256];
	int			nLen = StringHelper::UTF8ToUnicode(pStr, wszTemp, 255);
	BOOL		bRet = FALSE;

	EmbedeedFontMan* pEmbedeedFontMan = EmbedeedFontMan::GetInstance();
	int nFontId = pEmbedeedFontMan->GetEmbedeedFontId(lf.lfFaceName);
	if( nFontId == -1 )
		bRet = ::GetTextExtentPoint32W(context_, wszTemp, nLen, &szText);
	else
		bRet = pEmbedeedFontMan->GetTextSize(this, wszTemp, nLen, nFontId, szText);
	return bRet;
	}
BOOL
_DC::ExtTextOutW(int x, int y, UINT options, LPCRECTDef lprect, const wchar_t* lpString,  UINT c, const int * lpDx){
	if( !context_ || !c ) 
		return FALSE;

	// Invalid rect area.
	if( lprect && (lprect->right <= 0 || lprect->bottom <= 0) )
		return FALSE;

	BOOL		bRet	= FALSE;
	LOGFONT lf;
	FONTDef pRealFont	= (FONTDef)SelectObject(*GetFontTemp());
	Font fontReal;
	fontReal.Attach	(pRealFont);
	fontReal.GetLogFont(&lf);
	SelectObject	(pRealFont);
	fontReal.Detach();

	EmbedeedFontMan* pEmbedeedFontMan = EmbedeedFontMan::GetInstance();
	int nFontId = pEmbedeedFontMan->GetEmbedeedFontId(lf.lfFaceName);
	if( nFontId == -1 )
		bRet = (TRUE == ::ExtTextOutW(context_, x, y, options, lprect, lpString, c, NULL));
	else
		bRet = pEmbedeedFontMan->DrawTextByEmbedeedFont(nFontId, this, lpString, c, x, y, lprect);
	return	bRet;
	}
BOOL
_DC::DrawText(FONTDef pFont, int x, int y, int flag, Rect rcClipRect, std::string* pszText, float fStretchCX, float fStretchCY){
	if( !context_ || !pFont ) 
		return FALSE;

	Font font;
	LOGFONT lf;
	font.Attach(pFont);
	font.GetLogFont(&lf);
	font.Detach();

	lf.lfWidth	= (lf.lfWidth * fStretchCX);
	lf.lfHeight = (lf.lfHeight * fStretchCY);

	Font fontNew;
	if( fontNew.CreateFontIndirect(&lf) ){
		FONTDef pFontOld = SelectObject(fontNew);
		ExtTextOut(x, y, flag, rcClipRect, *pszText);
		SelectObject(pFontOld);
		fontNew.DeleteObject();
		}
	else{
		FONTDef pFontOld = SelectObject(pFont);
		ExtTextOut(x, y, flag, rcClipRect, *pszText);
		SelectObject(pFontOld);
		}
	return FALSE;
	}
BOOL
_DC::ExtTextOut(int x, int y, UINT options, LPCRECTDef lprect, std::string& text, const int * lpDx){
	if( !context_ || !text.length() ) 
		return FALSE;

	// Invalid rect area.
	if( lprect && (lprect->right <= 0 || lprect->bottom <= 0) )
		return FALSE;

	wchar_t		wszTemp[256];
	int			nLen		= StringHelper::UTF8ToUnicode(&text, wszTemp, 255);
	BOOL		bRet		= FALSE;

	LOGFONT lf;
	FONTDef pRealFont = (FONTDef)SelectObject(*GetFontTemp());
	Font fontReal;
	fontReal.Attach	(pRealFont);
	fontReal.GetLogFont(&lf);
	SelectObject	(pRealFont);
	fontReal.Detach();

	EmbedeedFontMan* pEmbedeedFontMan = EmbedeedFontMan::GetInstance();
	int nFontId = pEmbedeedFontMan->GetEmbedeedFontId(lf.lfFaceName);
	if( nFontId == -1 )
		bRet = (TRUE == ::ExtTextOutW(context_, x, y, options, lprect, wszTemp, nLen, NULL));
	else
		bRet = pEmbedeedFontMan->DrawTextByEmbedeedFont(nFontId, this, wszTemp, nLen, x, y, lprect);
	return	bRet;
	}
BOOL
_DC::GetTextSizeW(wchar_t* pwszText, int nLen, Size& szText){
	if( !context_ )
		return FALSE;

	LOGFONT lf;
	FONTDef pRealFont = SelectObject(*GetFontTemp());
	Font realFont;
	realFont.Attach(pRealFont);
	realFont.GetLogFont(&lf);
	SelectObject(pRealFont);
	realFont.Detach();

	EmbedeedFontMan* pEmbedeedFontMan = EmbedeedFontMan::GetInstance();
	int nFontId = pEmbedeedFontMan->GetEmbedeedFontId(lf.lfFaceName);
	if( nFontId == -1 )
		::GetTextExtentPoint32W(context_, pwszText, nLen, &szText);
	else
		pEmbedeedFontMan->GetTextSize(this, pwszText, nLen, nFontId, szText);
	return true;
	}