|
|
发表于 2008-12-22 19:54:00
|
显示全部楼层
Re:FreeType里设置汉字高度的问题
FT_Load_Char((FT_Face)m_Face, it->first, FT_LOAD_RENDER);
FT_GlyphSlot slot = ((FT_Face)m_Face)->glyph;
FT_Bitmap& bitmap=slot->bitmap;
if (nLeft + bitmap.width > m_nTextTexWidth)
{
nLeft = 0;
nTop += nHeight+1;
nHeight = 0;
}
// 超出纹理容量了
if (nTop + bitmap.rows > m_nTextTexHeight)
{
m_CharsInfo.erase(it);
continue;
}
// TexCharInfo
TexCharInfo& charInfo = it->second;
charInfo.bSBCCase = (it->first >= 65248) || (it->first >= 0x3000 && it->first <= 0x3080);
charInfo.nLeft = nLeft;
charInfo.nTop = nTop;
charInfo.nWidth = bitmap.width;
//if (charInfo.nWidth == 0)
//{
// charInfo.nWidth = m_nH;
//}
charInfo.nHeight = bitmap.rows;
charInfo.nOffsetX = slot->bitmap_left;
// 空格
if (it->first == 32)
{
charInfo.nOffsetX = m_nH / 2;
}
wchar_t c[] = L"”””.。。。";
if (it->first == '”')
{
int i;
i= 9;
}
charInfo.nOffsetY = slot->bitmap_top;
|
|