freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] FIX? [was: Non-integer bbox for T1 font?]


From: Tom Kacvinsky
Subject: Re: [Devel] FIX? [was: Non-integer bbox for T1 font?]
Date: Wed, 7 Mar 2001 08:47:33 -0500 (EST)

Well, I am having second thoughts.  This is what happens when I
repsond to a question in the morning without first having a pot of
coffee.

I reread the section regarding a Type 1 font's bbox: the t1 spec says
that the bbox must be accurate if the font uses seac, otherwise the
bbox can consist o all zeros.

So, with that in mind, some fonts (and we already have seen samples,
provided by Eric Blinn) have zero bboxes.  Because of this, the root
ascender and descnder values are bogus.

Moreover, I am not so sure rounding is the right thing to do in the
case of fractional bboxes.

Anyway, perhaps we ought to iterate over all of the glyphs in the
font, calcualting the bbox for each, and then calculate the global
bbox and use that in the ascender/descender calculations.  Again,
rounding is an issue...  But if we do decide to round, I have a macro
for rounding 16.16 fixed integer values.

Tom

On Wed, 7 Mar 2001, Tom Kacvinsky wrote:

> The functions {T1,CID}_ToFixedArray are #defined'd to be the function
> T1_ToFixedArray (which calls t1_tofixedarray). These latter two
> functions are already in the psaux module.
>
> Yes, the values for root->ascender, etc... should be rounded to the
> larger (or, if negative, smaller) integer.  But what is an easy way of
> rounding a 16.16 fixed to the larger integer?  Shifting right 16 bits
> truncates, not rounds.  Perhaps adding 1, then shifting right 16 bits.
> That will work for positive fixed values.  A corresponding operation
> holds for negative fixed values.  Pehaps this should be an exportable
> function like FT_DivFix.  We could call these functions FT_Ceil_Fix
> and FT_Floor_Fix, because "rounding" to the smallest (largest) integer
> not less (greater, resp.) than a given integer is really a ceiling
> (floor, resp.)  operation.
>
> Tom
>
> On Wed, 7 Mar 2001, Werner LEMBERG wrote:
>
> >
> > > I just looked at the use of T1_CoordArray: it was only used in
> > > parse_font_bbox.  The same function (under a different name:
> > > CID_ToFixedArray) is used in only parse_font_bbox from the cid
> > > module.  So I think these can be replaced to calls of
> > > {T1,CID}_ToFixedArray.
> >
> > Without looking into the code: Can this be unified and moved to PSaux?
> >
> > > These values are FT_Shorts, and as type1.font_bbox.yMax is an
> > > FT_Fixed, the cast is *bad* thing to do.  The least significant byte
> > > (the fractional part) is used, when the most significant byte (the
> > > integer part) should be used instead.  Perhaps root->ascender should
> > > be assigned as follows:
> > >
> > >   root->ascender     = face->type1.font_bbox.yMax >> 16;
> > >
> > > etc...
> >
> > Looks better.  But shouldn't bbox values always be rounded to the
> > larger integer?
> >
>
>
> _______________________________________________
> Devel mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/devel
>




reply via email to

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