Ejemplo n.º 1
0
void CSynBCGPEditView::LoadFont( void )
{
	CDC* pDC = GetDC();
	LOGFONT lf;
	m_pEdit->GetFont()->GetLogFont(&lf);

	CString strFontName(g_GlobalUtils.m_sStyleScheme.m_strEdtFontName);
	CopyMemory(lf.lfFaceName,(LPCTSTR)strFontName,(strFontName.GetLength() + 1) * sizeof(TCHAR));	
	lf.lfWeight = g_GlobalUtils.m_sStyleScheme.m_bEdtFontBold ? FW_BOLD : FW_NORMAL;
	lf.lfItalic = g_GlobalUtils.m_sStyleScheme.m_bEdtFontItalic ? 1 : 0;	
	lf.lfHeight = -MulDiv(g_GlobalUtils.m_sStyleScheme.m_uEdtFontSize, GetDeviceCaps(pDC->GetSafeHdc(), LOGPIXELSY), 72);

	m_Font.DeleteObject();
	m_Font.CreateFontIndirect(&lf);
	m_pEdit->SetFont (&m_Font);
}
Ejemplo n.º 2
0
void CTempAnnounceDlg::OnCbnSelchangeComboFont()
{
	// TODO: 在此添加控件通知处理程序代码
	int nIndex = m_FontCombo.GetCurSel() ;
	if ( nIndex != CB_ERR )
	{
		CString strTemp;
		m_FontCombo.GetLBText(nIndex, strTemp);
		CString strFontName( GetFontInfo().font_type.c_str() ) ;
		if ( strTemp != strFontName )
		{
			m_InputCtrl.SetFontName(strTemp.GetBuffer(0));
			CPersonalConfig::GetInstance()->SetTempMessageFont( m_InputCtrl.GetFontInfo() ) ;
		}
	}
}
Ejemplo n.º 3
0
void CSynBCGPEditView::ResetDefaultFont()
{
	HFONT hFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
	CDC* pDC = GetDC();

	CFont* pFont = pDC->SelectObject(CFont::FromHandle(hFont));
	pDC->SelectObject(pFont);
	::DeleteObject(hFont);

	LOGFONT lf;
	pFont->GetLogFont (&lf);

	CString strFontName(g_GlobalUtils.m_sStyleScheme.m_strEdtFontName);
	CopyMemory(lf.lfFaceName,(LPCTSTR)strFontName,(strFontName.GetLength() + 1) * sizeof(TCHAR));
	lf.lfWidth = 0;
	lf.lfEscapement = 0;
	lf.lfOrientation = 0;
	lf.lfWeight = g_GlobalUtils.m_sStyleScheme.m_bEdtFontBold ? FW_BOLD : FW_NORMAL;
	lf.lfItalic = g_GlobalUtils.m_sStyleScheme.m_bEdtFontItalic ? 1 : 0;
	lf.lfUnderline = 0;
	lf.lfStrikeOut = 0;
	lf.lfHeight = -MulDiv(g_GlobalUtils.m_sStyleScheme.m_uEdtFontSize, GetDeviceCaps(pDC->GetSafeHdc(), LOGPIXELSY), 72);
	lf.lfOutPrecision =	3;
	lf.lfClipPrecision = 2;
	lf.lfQuality = 1;
	lf.lfPitchAndFamily = 49;
	lf.lfCharSet = 0;

	LOGFONT glf;
	globalData.fontRegular.GetLogFont (&glf);
	CString strFaceName(glf.lfFaceName);
	if (0 == strFaceName.CompareNoCase(_T("΢ÈíÑźÚ")))
	{
		lf.lfQuality = 5;
	}

	m_Font.CreateFontIndirect(&lf);
	m_pEdit->SetFont (&m_Font);
}
Ejemplo n.º 4
0
void FontCache::calculateMemoryUsage(FontMemoryUsage & fmuTotal)
{
	fmuTotal.fontCache += sizeof(int) * 4;	// m_cfci, m_cfciMax, m_cfface, m_flush
	fmuTotal.fontCache += sizeof(void*);	// m_prgfci;

	// Iterate through all the font faces in the cache.
	for (int ifci = 0; ifci < m_cfci; ifci++)
	{
		CacheItem * pfci = m_prgfci + ifci;
		char rgchFontName[32];
		memset(rgchFontName, 0, 32 * sizeof(char));
		std::copy(pfci->szFaceName, pfci->szFaceName + 32, rgchFontName);
		std::string strFontName(rgchFontName);
		fmuTotal.vstrFontNames.push_back(strFontName);
		int cface = 0;
		if (pfci->pffaceRegular)
		{
			FontMemoryUsage fmu;
			pfci->pffaceRegular->calculateMemoryUsage(fmu);
			fmuTotal.add(fmu);
			fmuTotal.vFontTotalsReg.push_back(fmu.total());
			cface++;
		}
		else
			fmuTotal.vFontTotalsReg.push_back(0);

		if (pfci->pffaceBold)
		{
			FontMemoryUsage fmu;
			pfci->pffaceBold->calculateMemoryUsage(fmu);
			fmuTotal.add(fmu);
			fmuTotal.vFontTotalsBold.push_back(fmu.total());
			cface++;
		}
		else
			fmuTotal.vFontTotalsBold.push_back(0);

		if (pfci->pffaceItalic)
		{
			FontMemoryUsage fmu;
			pfci->pffaceItalic->calculateMemoryUsage(fmu);
			fmuTotal.add(fmu);
			fmuTotal.vFontTotalsItalic.push_back(fmu.total());
			cface++;
		}
		else
			fmuTotal.vFontTotalsItalic.push_back(0);

		if (pfci->pffaceBI)
		{
			FontMemoryUsage fmu;
			pfci->pffaceBI->calculateMemoryUsage(fmu);
			fmuTotal.add(fmu);
			fmuTotal.vFontTotalsBI.push_back(fmu.total());
			cface++;
		}
		else
			fmuTotal.vFontTotalsBI.push_back(0);

		fmuTotal.vFaceCount.push_back(cface);
	}
}