freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] What is the scale of bbox in FT_FaceRec?


From: Tom Kacvinsky
Subject: Re: [Devel] What is the scale of bbox in FT_FaceRec?
Date: Fri, 23 Mar 2001 07:28:34 -0500 (EST)

Hi Sander,

I am the one responsible for the the bbox parsing code in the Type 1 and CID
drivers.

Here is what happens: the BBox values can be real numbers, so we read them in as
16.16 fixed numbers, and then round them.  As the ascender/descender values are
16 bit ints, we have to take the high 16 bits of the 16.16 fixed number (the
integer part), so we shift right 16 bits.  In the latest cvs code (did you get a
Windows CVS client?), there is cast on this:

   root->ascender     = (FT_Short)( face->type1.font_bbox.yMax >> 16 );

The height value is calulated as ((ascender - descender) * 12) / 10, so the
height calulation is not entirely accurate.  But even if it were an accurate
calculation, it could be thrown off because of bad bbox values.

Please tell what the font bbox is in Zapf Dingbats, the values you are getting
for the bbox, and which compiler/compiler flags you are using.

One thing to keep in mind is that Type 1/CID font BBox values are in terms of
font units (usually 1000 font units per EM).  To get a value for the point size
are working with, you will need to divide by the root->units_per_EM value,
and then multiply by the point size you are using.

It looks like you have may discovered an unintended side effect of the changes I
had made. :( I'll need to squash it!  If the above suggestion (divide by UPM,
multiply by point size) does not yield the results you expect, I'll go get the
Raid and go to work. :)

Tom

On Fri, 23 Mar 2001, Sander van der Wal wrote:

> Hi
>
> What is the scale of the bbox in a FT_Face?
>
> In a type 1 font that I have (the Zapf dingbats font in Adobe Acrobat
> reader 4.0) the values in the bbox are much larger that in comparable
> TrueType fonts. In TrueType fonts the values in bbox are compatible in
> size with the ascender and descender values the same face, but not so
> in a Type 1 font.
>
> The ascender in a Type 1 font is calculated as (t1objs, around line
> 277).
>
>    root->ascender     = face->type1.font_bbox.yMax >> 16;
>
> I suspect that the bbox in T1 fonts is in a different scale then in
> TrueType fonts.
>
> >From looking at the source I also believe that CID fonts behave
> exactly like Type 1 fonts in this respect.
>
> I'm ruinning into this problem because I need to calculate describe
> the whole font using size, ascender, height, width and descenders.
> This can also be done from comparable values in FT_Face, but I got
> some amazing results when I tried to use the bbox.
>
> Sander van der Wal
>
>
>
> _______________________________________________
> Devel mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/devel
>





reply via email to

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