[cairo] Serious concerns about cairo

Behdad Esfahbod behdad at behdad.org
Thu Oct 5 08:28:01 PDT 2006


On Tue, 2006-09-26 at 17:04 -0700, Bill Spitzak wrote:
> 
> Behdad Esfahbod wrote:
> 
> > Can you elaborate?  What is the area-preserving box?  What we currently
> > return is the bounding box of the rotated glyph bounding box.
> 
> The returned box has the same area as the transformed bounding box, and 
> should circumscribe the ellipse that results from transforming an 
> ellipse inscribed in the input bounding box.

This is very interesting, but, it does result in ink out of the bounding
box for letters as simple as a capital T, right?

behdad

> This is some math I am using, but I don't think it is correct, as it is 
> not a continuous function. It does produce the correct area:
> 
> * Transform the vectors w,0 and 0,h to the output space as vectors A and B.
> 
> float dot = A.x*B.y-A.y*B.x;
> float W = A.x*A.x+B.x*B.x;
> float H = A.y*A.y+B.y*B.y;
> if (W > H) {
>    W = sqrt(W);
>    H = absf(dot/W);
> } else if (H > 0) {
>    H = sqrt(H);
>    W = absf(dot/H);
> } else {
>    W = H = 0;
> }
> 
> * Transform the center point x,y of the bounding box to output space as X,Y.
> 
> * output bounding box corners are (X-W/2,Y-H/2),(X+W/2,Y+H/2)
-- 
behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
        -- Dan Bern, "New American Language"



More information about the cairo mailing list