freetype
[Top][All Lists]
Advanced

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

Re: [ft] BBox question


From: Chia I Wu
Subject: Re: [ft] BBox question
Date: Fri, 12 Aug 2005 19:39:09 +0800
User-agent: Mutt/1.5.9i

On Fri, Aug 12, 2005 at 11:28:42AM +0200, Michele Petrazzo wrote:
> Chia I Wu wrote:
> Ok, but if I see this value, I see that it's lesser than that into
> glyph! (I think that it's not possible, is it true?)
I guess it's possible because face->bbox is the bounding box of the
unhinted glyphs and the glyph loaded is hinted.  But the reason
face->bbox is smaller than glyph's bbox here might be the wrong scaling.
> 
> Is there a possible to know the right value of my "I" character (19x75)
> with freetype?
It has width 7 and height 48.  The `19' is the advance width and I don't
know where the `75' comes from.
> 
> Thanks,
> Michele
> 
> 
> 
> My code:
> 
> error = FT_Set_Char_Size( face, 50 * 64, 0, 96, 96 );
> slot = face->glyph;
> FT_BBox  acbox;
> 
> error = FT_Load_Char( face, "I", FT_LOAD_DEFAULT);
> 
> metric_f = face->size->metrics;
> metric_g = face->glyph->metrics;
> 
> bbox = face->bbox;
> printf("W: %d \n", slot->advance.x /64 ); // this is the right 19

> 
> FT_Outline_Get_CBox( &face->glyph->outline, &acbox );
> printf("Glyph Y: %d, X: %d% \n", FT_MulFix( (acbox.yMax - acbox.yMin), 
> metric_f.y_scale) ,
>         FT_MulFix( (acbox.xMax - acbox.xMin), metric_f.x_scale ));
There is no need to scale here
> 
> printf("Glyph Metric W: %d -> %d\n", metric_g.width, FT_MulFix( 
> metric_g.width,  metric_f.x_scale ) );
here
> printf("Glyph Metric H: %d -> %d\n", metric_g.height, FT_MulFix( 
> metric_g.height, metric_f.y_scale ) );
and here, since they are already expressed in (26.6) pixels.
> 
> printf("Face  Y: %d, X: %d% \n", FT_MulFix( (bbox.yMax - bbox.yMin), 
> metric_f.y_scale) ,
>         FT_MulFix( (bbox.xMax - bbox.xMin), metric_f.x_scale ));
> printf("BBox xMi %d,xMa %d,yMi %d,yMa %d, \n", bbox.xMin, bbox.xMax, 
> bbox.yMin, bbox.yMax );
And you should scale the values here.

-- 
Regards,
olv




reply via email to

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