Commit 2f0fdb9316120084c9b62647f9a730b11ab90202

David Turner 2004-06-21T21:16:56

fixing a scaling bug in the TrueType glyph loader that generated ugly artefacts when the TrueType bytecode interpreter was compiled in

diff --git a/ChangeLog b/ChangeLog
index 5dbb153..693a58b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-06-21  David Turner  <david@freetype.org>
+
+        * src/base/ftobjs.c: documentation fix
+
+        * src/truetype/ttgload.c: fixing a scaling bug that caused incorrect
+        rendering when the bytecode interpreter was enabled.
+
 2004-06-14  Huw D M Davies  <h.davies1@physics.ox.ac.uk>
 
 	* src/winfonts/winfnt.c (FNT_Face_Init): Set x_ppem and y_ppem
@@ -16,7 +23,7 @@
 2004-06-10  David Turner  <david@freetype.org>
 
 	* src/base/ftobject.c, src/base/fthash.c, src/base/ftexcept.c,
-	src/base/ftsysio.c, src/base/ftsysmem.c, src/base/ftlist.c: Removed. 
+	src/base/ftsysio.c, src/base/ftsysmem.c, src/base/ftlist.c: Removed.
 	Obsolete.
 
 	* src/raster/ftraster.c (Alignment, PAlignment): New union to fix
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 8b0256e..bbd6ce6 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1999,7 +1999,7 @@
     if ( char_height < 1 * 64 )
       char_height = 1 * 64;
 
-    /* Compute pixel sizes in 26.6 units with rounding */
+    /* Compute pixel sizes in 26.6 units */
     dim_x = ( char_width  * horz_resolution + 36 ) / 72;
     dim_y = ( char_height * vert_resolution + 36 ) / 72;
 
@@ -2007,7 +2007,6 @@
       FT_UShort  x_ppem = (FT_UShort)( ( dim_x + 32 ) >> 6 );
       FT_UShort  y_ppem = (FT_UShort)( ( dim_y + 32 ) >> 6 );
 
-
       if ( x_ppem == metrics->x_ppem && y_ppem == metrics->y_ppem )
         return FT_Err_Ok;
 
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 0256ee6..9fc2d03 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -206,7 +206,7 @@
       *tsb = face->os2.sTypoAscender;
       *ah  = face->os2.sTypoAscender - face->os2.sTypoDescender;
     }
-    else 
+    else
     {
       *tsb = face->horizontal.Ascender;
       *ah  = face->horizontal.Ascender - face->horizontal.Descender;
@@ -778,9 +778,8 @@
     {
       FT_Vector*  vec     = zone->cur;
       FT_Vector*  limit   = vec + n_points;
-      FT_Fixed    x_scale = load->size->metrics.x_scale;
-      FT_Fixed    y_scale = load->size->metrics.y_scale;
-
+      FT_Fixed    x_scale = ((TT_Size)load->size)->metrics.x_scale;
+      FT_Fixed    y_scale = ((TT_Size)load->size)->metrics.y_scale;
 
       /* first scale the glyph points */
       for ( ; vec < limit; vec++ )
@@ -912,8 +911,8 @@
     y_scale = 0x10000L;
     if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
     {
-      x_scale = loader->size->metrics.x_scale;
-      y_scale = loader->size->metrics.y_scale;
+      x_scale = ((TT_Size)loader->size)->metrics.x_scale;
+      y_scale = ((TT_Size)loader->size)->metrics.y_scale;
     }
 
     /* get metrics, horizontal and vertical */