[ft-devel] patch requested for freetype2/internal header usage (using font_bbox)

Drew Parsons dparsons at debian.org
Tue Jan 24 03:37:24 PST 2006


On Tue, 2006-01-24 at 11:50 +0100, david turner wrote:
> Hi Drew,
> >
> > I suspect I can remove the (int) cast here too, since the face->bbox
> > values are already integers, would that be correct?
> >
> >   
> the values are longs. Apart from that, you're correct !
> 

Good-o.


> But wait, there is more: the original code is buggy !!
...
> that's because, according to the Type 1 spec, the values of  /FontBBox 
> are normally expressed
> in outline coordinates, as "regular" numbers. the original code produces 
> values that are too large
> by a factor of 2**16 !!
> 
> the consequence of this is that:
> 
> - this code generates bogus values for /FontBBox already (they're huuuge)
>   and it seems that this has never been spotted before. In other words, it
>   probably isn't important at all.
> 

Curious.  I wonder if this explains why Xprint's postscript output files
are so badly up the creek (displaying too large under gv)...
(https://bugs.freedesktop.org/show_bug.cgi?id=5574)



> So, the correct, non-buggy code would be:
> 
>  else
>   {
>     fprintf(out, "/FontBBox [%ld %ld %ld %ld] def\n",
>                  ti->ttface->bbox->xMin,
                                                      ^^^^^^
Is this a typo?  Did you mean
                 ti->ttface->bbox->xMin * 65536,
  ??

>                  ti->ttface->bbox->yMin * 65536,
>                  ti->ttface->bbox->xMax * 65536,
>                  ti->ttface->bbox->yMax * 65536);
>   }
> 

Actually, this particular codepath doesn't appear to be used regularly.
The output files seem to be mostly going through ttf2pt1 instead, which
might be why the problem hasn't been clearly reported. I'll have to
check all the various font bbox usages, I guess.

> PS: It's sort of funny to see that the original developer went to great 
> lengths
>       (peeking within the library internals) to get the values it 
> needed, without
>       being able to use them correctly. Oh well :o)

Hey, don't diss him! Before he got on to it Xprt didn't run at all!
Actually, he was aware of the problem, with the freetype internals, if
not the size misuse:
https://bugs.freedesktop.org/show_bug.cgi?id=603

Thanks,

Drew


More information about the xorg-modular mailing list