HI,
Now, I use freetype font engine on our embedded system. It works fine .but
there is a question:
For displaying several characters for one time. Firstly I call:
/******************************/
while(*string)
{
error = FT_Load_Char(pFTFace,*string, FT_LOAD_DEFAULT);
string++;
if(error){
break;
}
pFtrect->right += slot->advance.x>>6;
baseline_offset =
(metrics->height-metrics->horiBearingY)>>6>baseline_offset?(metrics->height-
metrics->horiBearingY)>>6:baseline_offset;
pFtrect->top = (metrics->horiBearingY>>6)>pFtrect->top
?metrics->horiBearingY>>6:pFtrect->top;
}
/****************/
To get the total w and h of the whole strings. then malloc (w*h ) memory
to store the bitmaps which will be rendered to.
Secondly:
Call :
while(*str_temp)
{
error = FT_Load_Char(pFTFace,*str_temp, FT_LOAD_RENDER);
str_temp++;
align_top = h-rect.baseline-slot->bitmap_top;
align_left = slot->bitmap_left;
for(int i=0;i <slot->bitmap.rows;i++)
{
buf_temp =buf+x_offset+ (align_top+i)*w+align_left;
for(int j=0;j<slot->bitmap.width;j++)
{
*buf_temp++ =
slot->bitmap.buffer[i*slot->bitmap.width+j];
}
}
x_offset += slot->advance.x>>6;
}
I get the idea that the two FT_Load_Char waste a lot of time.
How can I get the total w and h of the whole strings fast ?< metrics
value>
Thanks
_______________________________________________
Freetype mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/freetype