freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Freetype 2.1.2 & rotated text


From: Werner LEMBERG
Subject: Re: [Devel] Freetype 2.1.2 & rotated text
Date: Wed, 26 Jun 2002 09:26:04 +0200 (CEST)

> Its a problem... The latest fix of FT_Vector_Transform() swapped
> xy and yx of the input matrix. Now the rotation has changed direction,
> and the shearing has changed the axis. We'll have to check all calls
> to FT_Vector|Outline|Glyph_Transform()...?
> 
> The documentation (docs/tutorial/step2.html) describes the new behaviour
> (xy = 0 for horizontal shear)
> ----8<----
> // transform glyph2 (horizontal shear)
>     //
>     matrix.xx = 0x10000;
>     matrix.xy = 0;
>     matrix.yx = 0.12 * 0x10000;
>     matrix.yy = 0x10000;
> 
>     FT_Glyph_Transform( glyph2, &matrix, 0 );
> ----8<----
> 
> while the source code (src/base/ftsynth.c) uses the old behaviour
> (yx = 0 for horizontal shear)
> ----8<----
>     /* For italic, simply apply a shear transform, with an angle */
>     /* of about 12 degrees.                                      */
> 
>     transform.xx = 0x10000L;
>     transform.yx = 0x00000L;
> 
>     transform.xy = 0x06000L;
>     transform.yy = 0x10000L;
> 
>     FT_Outline_Transform( outline, &transform );
> ----8<----
> 
> Just looked into the source code of ttf.library which uses
> old FreeType 1.3.1 and found it uses yx = 0 for horizontal shear
> (old behaviour).

I fear even in the 1.3.1 it is (partially) incorrect.  This is the right
way to muliply a vector with a transformation matrix:

           (xx xy)  
   (x y) * (     ) = (x*xx+y*yx x*yx+y*yy)
           (yx yy)

Currently, in FT1, rotation of composite TT glyphs uses this formula,
but everything else (including the documentation) swaps xy and yx.

Here a nice link which explains it:

  http://campus.northpark.edu/wicksBook/MatrixAlgebra/Multiplication/

Boys, boys, I really wonder why *nobody* has noticed this for such a
long time...

I fear we have to add a big exclamation mark that the transformation
functions were incorrect in previous versions.  Still using the
incorrect functions is perhaps not a good idea...

Alternatively, we could introduce new functions for `correct'
multipication.  While this may be backwards compatible, it is really
extremely bizarre IMHO.

Opinions, please.


     Werner



reply via email to

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