Vpoint. Clear ();
Int AAA = m_editfont.getlength ();
Glyphmetrics GM;
DWORD dwsize;
Handle hmem;
Lpttpolygonheader lpph;
Lpbyte LPB;
Long cboutline, cbtotal;
Hwnd hwnd1;
Crect rect1;
Getdlgitem (picture1, & hwnd1 );
: Getwindowrect (hwnd1, & rect1 );
Screentoclient (& rect1 );
HDC =: getdc (hwnd1 );
CDC DC1;
Dc1.attach (HDC );
M_font1.createfontindirect (& m_type.info );
Dc1.selectobject (& m_font1 );
Mat 2 m2;
M2.em11 = floattofixed (1.0 );
M2.em12 = floattofixed (0.0 );
M2.em21 = floattofixed (0.0 );
M2.em22 = floattofixed (1.0 );
For (INT I = 0; I <m_editfont.getlength (); I ++)
{
Uint uchar; // determines whether it is a Chinese character or a character.
If (m_editfont.getat (I)> = 0)
Uchar = m_editfont.getat (I );
Else
{
Int th = m_editfont.getat (I );
Int TL = m_editfont.getat (I + 1 );
Uchar = (th & 0x00ff) <8) + (TL & 0x00ff );
I ++;
}
Dwsize = dc1.getglyphoutline (uchar, ggo_native, & GM, 0l, null, & m2); // obtain the outer contour information
Hmem = globalalloc (ghnd, dwsize); // allocate memory
Lpph = (lpttpolygonheader) globallock (hmem); // get the memory handle
Dc1.getglyphoutline (uchar, ggo_native, & GM, dwsize, lpph, & m2); // obtain the outer contour information
Cbtotal = dwsize; // obtain the size of the buffer occupied by the discount point
Cpoint P1;
P1.x =-1;
P1.y =-1;
Vpoint. push_back (P1 );
While (cbtotal> 0) // multiple
{
Hwnd hwnd1;
Getdlgitem (picture1, & hwnd1 );
HDC =: getdc (hwnd1 );
CDC DC1;
Dc1.attach (HDC );
Int xold = mapfxy (lpph-> pfxstart. X); // Coordinate Conversion
Int yold = mapfxy (lpph-> pfxstart. Y); // Coordinate Conversion
P1.x = xold;
P1.y = 200-10-yold;
Dc1.moveto (xold, 200-10-yold );
Vpoint. push_back (P1 );
LPB = (lpbyte) lpph + sizeof (ttpolygonheader); // ttpolygonheader is the structure of the TrueType font Header
// LPB points to the first address of the arc description
Cboutline = (long) lpph-> CB-sizeof (ttpolygonheader); // obtain all
While (cboutline> 0)
{
Int N;
Lpttpolycurve LPC;
LPC = (lpttpolycurve) LPB;
// Lpttpolycurve defines a radian of the font, including whether the Quadratic B-Spline of a straight line is a cubic B-spline.
// And the number of description points
/*
This structure represents a curve of the line outside the TrueType font.
Typedef struct tagttpolycurve {// ttpc
Word wtype; // curve type
Word CPFX; // Number of discount points
Pointfx apfx [1]; // discount point Array
} Ttpolycurve, far * lpttpolycurve;
*/
Drawoutline (& DC1, LPC-> wtype, LPC-> CPFX, LPC-> apfx, 0, 0); // draw a curve
Int COUNT = LPC-> CPFX; // obtain the number of vertex structures.
For (INT I = 0; I <count; I ++)
{
P1.x = mapfxy (LPC-> apfx [I]. X );
P1.y = mapfxy (LPC-> apfx [I]. y );
// Point. push_back (P1 );
}
N = sizeof (ttpolycurve) + sizeof (pointfx) * (LPC-> CPFX-1 );
// N indicates the area occupied by each line point.
LPB + = N; // move the curve group down
Cboutline-= N;
}
Dc1.lineto (xold, 200-yold-10); // draw a line
P1.x = xold;
P1.y = 200-10-yold;
Vpoint. push_back (P1 );
P1.x =-1;
P1.y =-1;
Vpoint. push_back (P1 );
Cbtotal-= lpph-> CB; // move the file down
Lpph = (lpttpolygonheader) LPB;
}
}