Here is the sample code which fails to retrieve the bitmap glyph properly, I see all white space with a ...................
at the end for number 3 for example..yet example1.c here http://freetype.freedesktop.org/freetype2/docs/tutorial/ works well with letters/numbers oriented as provided in the original email below... ///////////////////////////////////////////////////////// // void PrintLetter( unsigned char *my_buf, //this buffer is face->glyph->bitmap->buffer FT_Bitmap *bmp //same bitmap struct to which the buffer above belongs ) { FT_Int i, j, p; FT_Int x_max = bmp->pitch; FT_Int y_max = bmp->rows; // // i each time should equal the first pixel in each row and // should move upward every iteration // j would print one by one each byte in a given row // for (i = (y_max-1)*x_max, p = 0; p < y_max ; i-=x_max, p++ ) { for ( j = i; j < x_max; j++) { putchar(my_buf[j] == 0 ? ' ' : my_buf[j] < 128 ? '-' : '.'); } putchar('\n'); } } ________________________________________ From: Werner LEMBERG [[email protected]] Sent: Wednesday, September 01, 2010 10:39 AM To: Minhaj Ahmed Subject: Re: [ft] reading glyph bitmap > Thanx for the reply, I am using exactly the same method & it works > but orients the glyph horizontally, was wondering why I am unable to > read it row by row instead? Without a (working) code snippet, I can't help. And please don't write to me privately but to the freetype list. Werner From: Minhaj Ahmed Sent: Tuesday, August 31, 2010 4:30 PM To: [email protected] Subject: reading glyph bitmap Hope I am sending this on the right email list. I am new to fonts in general and am trying to render the bitmap of various glyphs on to a label. I can only read the bitmap using the index y_offset * width_of_bmp + x_offset . Starting for x and y offsets of 0 this as expected reads in the first vertical line in the bitmap into the first scanline and orients the glyph horizontally. Every time I’ve tried to scan the bitmap from top left down or from bottom left up I’ve failed. Can anybody explain why? Also how do you flip the glyph, I ask because rotation is not enough to fix the glyph read in the way I’ve been able to so far. Thanx in advance! ... -..- ...... ... -...- ......- ... -....- .......- ... ......- ........ ... -......- ........ ... -.......- ........ ... -........- ........ ... -.........- ... ... -..........- ... ... -...........- ... ... -............- ... ...--......--.....- ... ..........- -....................... .........- -...................... ........- -....................- .......- ..................- ......- -...............- .....- -.............. ....- -............- _______________________________________________ Freetype mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/freetype
