一. TTF字体轮廓解析与绘制
1.1 数据提取
void CHYTTFCharacter::InitTTPOLY()
{
if(0 == m_pTTPOLYData)// GetGlyphOutline提取到的字体轮廓数据
{
return;
}
TTPOLYGONHEADER* pTTPOLYGONHEADER = 0;
TTPOLYCURVE* pTTPOLYCURVE = 0;
STTTPOLYGONHEADER* pSTTTPOLYGONHEADER = 0;
STTTPOLYCURVE* pSTTTPOLYCURVE = 0;
unsigned int nTTPOLYDataLen = 0;
unsigned char* pTTPOLYData = m_pTTPOLYData;
unsigned int nCURVELen = 0;
unsigned char* pCURVE = 0;
int nTemp = 0;
while(nTTPOLYDataLen < m_nTTPOLYDataLen)
{
pSTTTPOLYGONHEADER = new STTTPOLYGONHEADER;
m_stTTPOLYGONHEADERVector.push_back(pSTTTPOLYGONHEADER);
pTTPOLYGONHEADER = (TTPOLYGONHEADER*)pTTPOLYData;
memcpy(&(pSTTTPOLYGONHEADER->m_TTPOLYGONHEADER), pTTPOLYGONHEADER, sizeof(TTPOLYGONHEADER));
pCURVE = pTTPOLYData + sizeof(TTPOLYGONHEADER);
nCURVELen = sizeof(TTPOLYGONHEADER);
while(nCURVELen < pTTPOLYGONHEADER->cb)
{
pTTPOLYCURVE = (TTPOLYCURVE*)pCURVE;
pSTTTPOLYCURVE = new STTTPOLYCURVE;
pSTTTPOLYCURVE->Init(pTTPOLYCURVE->wType, pTTPOLYCURVE->cpfx);
pSTTTPOLYGONHEADER->m_stTTPOLYCURVEVector.push_back(pSTTTPOLYCURVE);
memcpy(pSTTTPOLYCURVE->m_p_apfx, pCURVE + sizeof(TTPOLYCURVE) - sizeof(POINTFX),
sizeof(POINTFX) * pTTPOLYCURVE->cpfx);
nTemp = sizeof(TTPOLYCU