static DS32 ShowChar(DU16 code, int x, int y, DU32 color,DU8 alignFlag)
{
DS32 osdwidth,osdheight;
DU8 xSize,ySize;
int i=0, j, xx = x;
FT_Glyph glyph;
FT_Error error;
FT_BitmapGlyph bitmap_glyph ;
FT_Bitmap bitmap;
osdwidth = D_OSD_GetWidth();
osdheight = D_OSD_GetHeight();
D_Font_Set_Pix_Sizes(
Pixs[fontCurIndex], /* pixel width */
Pixs[fontCurIndex] ); /* pixel height */
FT_Load_Glyph(pFTFace, FT_Get_Char_Index(pFTFace,code), FT_LOAD_DEFAULT);//0x5B8B
error = FT_Get_Glyph(pFTFace->glyph, &glyph);
if(!error)
{
FT_Glyph_To_Bitmap(&glyph, ft_render_mode_normal, 0, 1);
bitmap_glyph = (FT_BitmapGlyph)glyph;
bitmap = bitmap_glyph->bitmap;
xSize = bitmap.width;
ySize = bitmap.rows;
if(alignFlag == Center)
y += (fontStr.fontCurHeight - ySize) >>1;
else if(alignFlag == Bottom)
y += ((fontStr.fontCurHeight + fontStr.fontCurWidth)>>1) - ySize;
for(; i<ySize; ++i)
{
for(j=0; j<xSize; ++j)
{
if (bitmap.buffer[i*xSize+j] && xx >= 0 && xx < osdwidth && y >= 0 && y<osdheight)
D_OSD_DrawPixel(xx,y,color);
xx++;
}
xx = x;
y++;
}
FT_Done_Glyph(glyph);
glyph = NULL;
}
if((code & 0xFF00) != 0){
return fontStr.fontCurWidth;
}
else {
if(xSize == 0) {
if(code != 0x20)
return 0;
}
return CharPixelLen;
}
}
|