Hi, I am trying with the example1 from the tutorial and learning with it how to use the freetype API's. Thankful to all the team who developed a wonderful application.
I am confused with the bitmap buffer that i am getting,
Here is the code.(Same as example1 code)
#define WIDTH 100
#define HEIGHT 500
void
draw_bitmap( FT_Bitmap* bitmap,
FT_Int x,
FT_Int y)
{
FT_Int i, j, p, q;
FT_Int x_max = x + bitmap->width;
FT_Int y_max = y + bitmap->rows;
FILE *fp;
printf("X is %d\n",x);
printf("Y is %d\n",y);
printf("Bitmap width is %d\n",bitmap->width);
printf("Bitmap rows is %d\n",bitmap->rows);
for ( i = x, p = 0; i < x_max; i++, p++ )
{
for ( j = y, q = 0; j < y_max; j++, q++ )
{
if ( i < 0 || j < 0 ||
i >= WIDTH || j >= HEIGHT )
continue;
image[j][i] |= bitmap->buffer[q * bitmap->width + p];
}
}
}
Here is my show_image()
void
show_image( FT_Bitmap* bitmap )
{
int i, j;
for ( i = 0; i < HEIGHT; i++ )//HEIGHT
{
for ( j = 0; j < WIDTH; j++ )
if( image[i][j] < 128)
putchar('.');
else
putchar('*');
putchar( '\n' );
}
}
These are my output values,
Text C
Bitmap Left 10
Bitmap Top 314
X is 10
Y is 186
Bitmap width is 11
Bitmap rows is 12
When i tried converting a glyph C into bitmap,I can able to get the
character in bitmap but,i couldnt able to understand why image[i][j]<128 we
are printing "." (a dot)
Is there anyway i can just get the character bitmap ...nothing else with
that.
Also,
Why is the charater coming somewhere in the middle of a box.
i mean given a resolution 100*500 screen it is appearing somewhere down.Why
is it so?
I have attached my output in a PNG file.How can i understand the bitmap
buffer?
Thanks a lot
-sam
<<attachment: convert_glyph.PNG>>
_______________________________________________ Freetype mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/freetype
