freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] advance X value is less than width


From: samaram s
Subject: Re: [ft] advance X value is less than width
Date: Mon, 25 Oct 2010 10:06:24 -0400

It's hard to tell without more information.  What font, at which ppem
size?  How does your font look like with, say, ftdiff or ftview?
Here are the Details:
FONT_NAME     =    Arial
FONT_STYLE     =    Regular
FONT_HEIGHT     =    12

For 0x76: i get bitmap data as,

BitmapData: 41,00,41,00,22,00,22,00,14,00,14,00,14,00,08,00,08,00
09- Width, [ bbox.xMax - bbox.xMin ]
09-height, [ bbox.yMax - bbox.yMin ]
07-AdvanceX [slot->advance.x>>6]

Here is the calculation to generate bitmap data,
totalsize = slot->bitmap.rows * abs(slot->bitmap.pitch);
bytes_read = ((slot->bitmap.width)+7)/8;
actual_size = slot->bitmap.rows *bytes_read;

for( n=0; n < totalsize; n++)
    {
        //reading last byte of data so no need for comma
        if( j == actual_size-1)
            sprintf((buffer+j*3),"%02x",(char*) slot->bitmap.buffer[n] );
        else
            sprintf((buffer+j*3),"%02x,",(char*) slot->bitmap.buffer[n] );

        j++;
        i++;
        if(i == bytes_read)
        {
            n = n + ( abs(slot->bitmap.pitch) - bytes_read);
            i = 0;
            continue;
        }
    }

i just used freetype to generate bitmap data, I observed the data calculation.font height,width is correct. But observed AdvanceX coming lesser than Width of the Glyph for few characters.(say may be 10 glyphs in 00-FFFF).

Thanks.






On Sat, Oct 23, 2010 at 3:57 AM, Werner LEMBERG <address@hidden> wrote:

> I observed advance x value is less than width of the char for
> y,w,v(lower case).
>
> Width i am calculating : Width as :(bbox.xMax - bbox.xMin)
>                                     AdvanceX as: slot->advance.x>>6
> For glyph v:
>  Width = 0x09
> AdvanceX = 0x08
>
> Any guess? Am i doing anything wrong? For remaining all other glyphs
> it is coming correct.

It's hard to tell without more information.  What font, at which ppem
size?  How does your font look like with, say, ftdiff or ftview?


   Werner


reply via email to

[Prev in Thread] Current Thread [Next in Thread]