19,469
社区成员
发帖
与我相关
我的任务
分享
void CTtfShowDlg::DrawContour(CDC *pDC,int X, int Y,char* theChar)
{
GLYPHMETRICS gm;
MAT2 mat;
/*
MAT2 mat= {{ 0, 1, },
{ 0, 0, },
{ 0, 0, },
{ 0, 1, }};
*/
mat.eM11=Double2Fixed(1);
mat.eM12=Double2Fixed(0);
mat.eM21=Double2Fixed(0);
#ifdef UPSIDE_DOWN
mat.eM22=Double2Fixed(1);
#else // normal
mat.eM22=Double2Fixed(-1);
#endif
POINT Origin={X,Y};
WCHAR szText[40];
// Copy the string
MultiByteToWideChar(CP_ACP, 0, theChar, -1, (LPWSTR) szText, 40);
// actually only 1 char.
for(UINT i=0;szText[i];i++)
{/* Returns the curve data points in the rasterizer’s native format, using device units. */
DWORD BufferLen=::GetGlyphOutlineW(pDC->m_hDC,szText[i],GGO_NATIVE,&gm,0,0,&mat);
if(BufferLen != GDI_ERROR) // 0xFFFFFFFFL
{//OK
BYTE *pBuffer=new BYTE[BufferLen];
DWORD Result=::GetGlyphOutlineW(pDC->m_hDC,szText[i],GGO_NATIVE,&gm,BufferLen,pBuffer,&mat);
// OutLine
DrawCurve(pDC,pBuffer,BufferLen,gm,Origin);
// if save
if(m_bSaveToFile)
{
m_bSaveToFile=FALSE;
// + size theApp.m_Ascent
char Ascent[10];
sprintf(Ascent,"%d",theApp.m_Ascent);
strcat(theChar,Ascent);
SaveGlyphInfo(theChar,pBuffer,BufferLen);
}
Origin.x += gm.gmCellIncX;
Origin.y += gm.gmCellIncY;
delete[] pBuffer;
}
}
}