|
我试图在wince下使用雅黑字体,代码如下
AddFontResource(_T("\\storage card\\msyh.ttf"));
HANDLE hFont, hOldFont;
LOGFONT lf;
memset(&lf,0,sizeof(LOGFONT));
lf.lfHeight = 24;
lf.lfWidth = 0;
lf.lfWeight = FW_BOLD;
lf.lfCharSet = GB2312_CHARSET;
lf.lfOutPrecision= OUT_DEFAULT_PRECIS;
lf.lfClipPrecision= CLIP_STROKE_PRECIS;
lf.lfQuality = ANTIALIASED_QUALITY;
lf.lfPitchAndFamily= DEFAULT_PITCH|FF_MODERN;
_tcscpy(lf.lfFaceName, _T("微软雅黑"));
hFont = CreateFontIndirect(&lf);
hOldFont=(HFONT)SelectObject(dc.m_hDC,hFont);
dc.DrawText(_T("雅黑"), 2, CRect(0,0,100,100),FF_DONTCARE);
DeleteObject(SelectObject(dc.m_hDC,hOldFont));
这样子是没有问题的,但是如果把倒数第二行改成dc.DrawText(_T("城市"), 2, CRect(0,0,100,100),FF_DONTCARE);
就打不出字来了,有高手知道是为什么吗
|
|