RE: [ft] bitmap buffer length
Oops - I should have checked before replying. size = abs(bitmap-pitch) * bitmap-rows; -Original Message- From: Werner LEMBERG [mailto:w...@gnu.org] Sent: 25 February 2010 17:08 To: David Bevan Cc: samaram...@gmail.com; freetype@nongnu.org Subject: Re: [ft] bitmap buffer length size = ((bitmap-width + 7) / 8) * bitmap-rows; // ((bitmap-width + 7) / 8) is the number of bytes for bitmap-width bits This is not necessarily correct. Especially on Windows, the pitch might be a multiple of 4. I suggest to always use the `pitch' field. Werner ___ Freetype mailing list Freetype@nongnu.org http://lists.nongnu.org/mailman/listinfo/freetype
[ft] bitmap buffer length
Hi, I would like to know how much is the bitmap buffer size. Actually i am calculating like below said, if((bitmap-width/8) 1) size = 2*bitmap-rows ; else size = ((bitmap-width /8)+1)*bitmap-rows; But for few characters i am getting it perfect,but for few characters i am getting more bytes which are not actually required.Is there anyway i can get the correct number of bytes for the bitmap-buffer to read. Thanks, Sam ___ Freetype mailing list Freetype@nongnu.org http://lists.nongnu.org/mailman/listinfo/freetype
Re: [ft] bitmap buffer length
I would like to know how much is the bitmap buffer size. Actually i am calculating like below said, if((bitmap-width/8) 1) size = 2*bitmap-rows ; else size = ((bitmap-width /8)+1)*bitmap-rows; But for few characters i am getting it perfect,but for few characters i am getting more bytes which are not actually required.Is there anyway i can get the correct number of bytes for the bitmap-buffer to read. The size of the bitmap buffer in FT_Bitmap is as documented: rows * pitch Werner ___ Freetype mailing list Freetype@nongnu.org http://lists.nongnu.org/mailman/listinfo/freetype
Re: [ft] bitmap buffer length
The pitch is positive when the bitmap has a ‘down’ flow, and negative when it has an ‘up’ flow. rows * pitch When i multiply a negative pitch i will get a negative number of bytes right?? or my assumption is wrong? I would like to read the bitmap-buffer, for (i=0; i size ; i++) printf(%.2x ,slot-bitmap.buffer[i]); if size = rows*pitch, I got the following data for unicode val 0x40 (which represents @) I got pitch as 4. Font Data:00 07 fc 00 00 00 00 3f ff 80 00 00 00 ff ff e0 00 00 03 f0 01 f0 00 0 0 07 c0 00 78 00 00 0f 00 00 3c 00 00 0e 00 00 1e 00 00 1c 07 c3 8e 00 00 3c 0f f3 87 00 00 38 3f ff 87 00 00 70 3c 1f 03 00 00 so, 4 bytes represents one row. I got bit map *width as 22* ,does it mean the glyph data is actually in *3 bytes(22/8) * and the otherbyte is for padding? Thanks, Sam On Thu, Feb 25, 2010 at 12:07 PM, Werner LEMBERG w...@gnu.org wrote: size = ((bitmap-width + 7) / 8) * bitmap-rows; // ((bitmap-width + 7) / 8) is the number of bytes for bitmap-width bits This is not necessarily correct. Especially on Windows, the pitch might be a multiple of 4. I suggest to always use the `pitch' field. Werner ___ Freetype mailing list Freetype@nongnu.org http://lists.nongnu.org/mailman/listinfo/freetype