[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] A question about rotated glyph metrics
From: |
Alexander Gelfenbain |
Subject: |
Re: [Freetype] A question about rotated glyph metrics |
Date: |
Thu, 30 Aug 2001 19:01:26 -0700 |
User-agent: |
Mutt/1.2.5i |
Hi David,
thank you for your help!
On Thu, Aug 30, 2001 at 10:13:39AM +0200, David Turner wrote:
> >
> > Question: what is the proper way to calculate glyph metrics for a
> > transformed
> > glyph? If the transformed glyph is unhinted, my guess would be to load
> > an unscaled glyph, convert FUnits to floating point coordinates and apply
> > the affine
> > transform to them in my code. Or should I scale the untransformed glyph with
> > TT_Set_Instance_CharSize(1<<6), get its metrics and apply my affine
> > transform to it?
> >
>
> Generally speaking, you should decompose your affine transform into
> a scale then another rotation/skewing transform.
I don't have the _Graphics Gems III_ book that has an article on decomposing
affine transforms handy. It seems that if I have an 2x2 matrix that defines
an affine transform:
a11 a12
a21 a22
I can decompose it into the scale matrix S
sx 0
0 sy
and the other affine transform matrix B using the following formulae:
sx = sqrt(a11**2 + a12**2);
sy = det(A)/sx; where det(A) is a11*a22 - a12*a21.
b11 = a11/sx
b12 = a12/sx
b21 = a21/sy
b22 = a22/sy
does that sound correct?
Thanks,
AG
--
Alexander Gelfenbain, Sun Microsystems, Inc.
+1 (408) 635-0612