freetype-devel
[Top][All Lists]
Advanced

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

[Devel] Fix for FontMatrix xy swaps


From: Detlef Würkner
Subject: [Devel] Fix for FontMatrix xy swaps
Date: Wed, 26 Jun 2002 18:24:52 +0200

Hello!

I wrote:

> IMHO the Type1/Type42/CFF drivers of FT2 must be broken either before or
> after the FT_Vector_Transform() fix. They parse the font transformation
> matrix stored in the font file:
[...]
> Could someone please check whether xy and yx have to be swapped here?

Didnt have a font with a "special" FontMatrix entry but found in the news
that Adobe Helvetica-Oblique is assumed to have something like

/FontMatrix [0.001 0 0.000212557 0.001 0 0] readonly def

Replaced the standard FontMatrix line of a Type1 font with this, and
checked with type1.library (which uses the X11 PS rasterizer). As
expected the glyphs were slanted to the right. With current FreeType2
they were slanted upwards -> All FontMatrix parsing routines had xy and
yx swapped since old FT_Vector_Transform() did swap it back...

Here is the fix (only Type1 tested but all others look like cut & paste):

----8<----
--- freetype-2.1.2/src/base/ftsynth.c.ori       Thu Jul 12 22:41:08 2001
+++ freetype-2.1.2/src/base/ftsynth.c   Wed Jun 26 15:43:50 2002
@@ -51,9 +51,9 @@
     /* of about 12 degrees.                                      */
 
     transform.xx = 0x10000L;
-    transform.yx = 0x00000L;
+    transform.xy = 0x00000L;
 
-    transform.xy = 0x06000L;
+    transform.yx = 0x06000L;
     transform.yy = 0x10000L;
 
     FT_Outline_Transform( outline, &transform );
--- freetype-2.1.2/src/cff/cffparse.c.ori       Sat Mar 30 16:41:09 2002
+++ freetype-2.1.2/src/cff/cffparse.c   Wed Jun 26 15:47:12 2002
@@ -327,8 +327,8 @@
     if ( parser->top >= parser->stack + 6 )
     {
       matrix->xx = cff_parse_fixed_thousand( data++ );
-      matrix->yx = cff_parse_fixed_thousand( data++ );
       matrix->xy = cff_parse_fixed_thousand( data++ );
+      matrix->yx = cff_parse_fixed_thousand( data++ );
       matrix->yy = cff_parse_fixed_thousand( data++ );
       offset->x  = cff_parse_fixed_thousand( data++ );
       offset->y  = cff_parse_fixed_thousand( data   );
@@ -340,8 +340,8 @@
       if ( temp != 0x10000L )
       {
         matrix->xx = FT_DivFix( matrix->xx, temp );
-        matrix->yx = FT_DivFix( matrix->yx, temp );
         matrix->xy = FT_DivFix( matrix->xy, temp );
+        matrix->yx = FT_DivFix( matrix->yx, temp );
         matrix->yy = FT_DivFix( matrix->yy, temp );
         offset->x  = FT_DivFix( offset->x,  temp );
         offset->y  = FT_DivFix( offset->y,  temp );
--- freetype-2.1.2/src/cid/cidload.c.ori        Sun Apr 14 00:54:31 2002
+++ freetype-2.1.2/src/cid/cidload.c    Wed Jun 26 15:49:32 2002
@@ -214,8 +214,8 @@
       }
 
       matrix->xx = temp[0];
-      matrix->yx = temp[1];
-      matrix->xy = temp[2];
+      matrix->xy = temp[1];
+      matrix->yx = temp[2];
       matrix->yy = temp[3];
 
       /* note that the font offsets are expressed in integer font units */
--- freetype-2.1.2/src/type1/t1load.c.ori       Sun May 12 19:59:17 2002
+++ freetype-2.1.2/src/type1/t1load.c   Wed Jun 26 15:31:52 2002
@@ -919,8 +919,8 @@
     }
 
     matrix->xx = temp[0];
-    matrix->yx = temp[1];
-    matrix->xy = temp[2];
+    matrix->xy = temp[1];
+    matrix->yx = temp[2];
     matrix->yy = temp[3];
 
     /* note that the offsets must be expressed in integer font units */
--- freetype-2.1.2/src/type42/t42parse.c.ori    Fri Jun 21 07:33:23 2002
+++ freetype-2.1.2/src/type42/t42parse.c        Wed Jun 26 15:42:40 2002
@@ -338,8 +338,8 @@
     }
 
     matrix->xx = temp[0];
-    matrix->yx = temp[1];
-    matrix->xy = temp[2];
+    matrix->xy = temp[1];
+    matrix->yx = temp[2];
     matrix->yy = temp[3];
 
     /* note that the offsets must be expressed in integer font units */
----8<----

Ciao, Detlef
-- 
_ // address@hidden
\X/  Detlef Wuerkner, Langgoens/Germany



reply via email to

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