Commit 8530a228889128adfd446514928f36663ed20f04

David Turner 2004-06-09T20:18:35

* include/freetype/freetype.h (FT_Glyph_Metrics, FT_GlyphSlotRec), src/autofit/afloader.c, src/autohint/ahhint.c: moved the definition of 'lsb_delta' and 'rsb_delta' from FT_GlyphMetrics to FT_GlyphSlotRec. The old location did BREAK BINARY COMPATIBILITY of the library !! * src/sfnt/sfobjs.c: removing compiler warning

diff --git a/ChangeLog b/ChangeLog
index 72eafd5..f380e70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-06-08  David Turner  <david@freetype.org>
+
+	* include/freetype/freetype.h (FT_Glyph_Metrics, FT_GlyphSlotRec),
+	src/autofit/afloader.c, src/autohint/ahhint.c:
+	moved the definition of 'lsb_delta' and 'rsb_delta' from FT_GlyphMetrics
+	to FT_GlyphSlotRec. The old location did BREAK BINARY COMPATIBILITY
+	of the library !!
+
+        * src/sfnt/sfobjs.c: removing compiler warning
+
 2004-06-05  Werner Lemberg  <wl@gnu.org>
 
 	* src/autofit/afloader.c (af_loader_load_g): Set `lsb_delta' and
@@ -11,9 +21,6 @@
 
 	Improve inter-letter spacing for autohinted glyphs.
 
-	* include/freetype/freetype.h (FT_Glyph_Metrics): Add elements
-	`lsb_delta' and `rsb_delta'.
-
 	* src/autohint/ahhint.c (ah_hinter_load): Set `lsb_delta' and
 	`rsb_delta' in slot->metrics and tune side bearings slightly.
 
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 453db74..3e3d217 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -213,41 +213,6 @@ FT_BEGIN_HEADER
   /*    vertAdvance ::                                                     */
   /*      Advance height for vertical layout.                              */
   /*                                                                       */
-  /*    lsb_delta ::                                                       */
-  /*      The difference between hinted and unhinted left side bearing     */
-  /*      while autohinting is active.  Zero otherwise.                    */
-  /*                                                                       */
-  /*    rsb_delta ::                                                       */
-  /*      The difference between hinted and unhinted right side bearing    */
-  /*      while autohinting is active.  Zero otherwise.                    */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*   Here a small pseudo code fragment which shows how to use            */
-  /*  `lsb_delta' and `rsb_delta':                                         */
-  /*                                                                       */
-  /*     FT_Pos  origin_x       = 0;                                       */
-  /*     FT_Pos  prev_rsb_delta = 0;                                       */
-  /*                                                                       */
-  /*                                                                       */
-  /*     for all glyphs do                                                 */
-  /*       <compute kern between current and previous glyph and add it to  */
-  /*        `origin_x'>                                                    */
-  /*                                                                       */
-  /*       <load glyph with `FT_Load_Glyph'>                               */
-  /*                                                                       */
-  /*       if ( prev_rsb_delta - face->glyph->metrics.lsb_delta >= 32 )    */
-  /*         origin_x -= 64;                                               */
-  /*       else if                                                         */
-  /*          ( prev_rsb_delta - face->glyph->metrics.lsb_delta < -32 )    */
-  /*         origin_x += 64;                                               */
-  /*                                                                       */
-  /*       prev_rsb_delta = face->glyph->metrics.rsb_delta;                */
-  /*                                                                       */
-  /*       <save glyph image, or render glyph, or ...>                     */
-  /*                                                                       */
-  /*       origin_x += face->glyph->advance.x;                             */
-  /*     endfor                                                            */
-  /*                                                                       */
   typedef struct  FT_Glyph_Metrics_
   {
     FT_Pos  width;
@@ -261,9 +226,6 @@ FT_BEGIN_HEADER
     FT_Pos  vertBearingY;
     FT_Pos  vertAdvance;
 
-    FT_Pos  lsb_delta;
-    FT_Pos  rsb_delta; 
-
   } FT_Glyph_Metrics;
 
 
@@ -1506,6 +1468,14 @@ FT_BEGIN_HEADER
   /*                         Note that the app will need to know about the */
   /*                         image format.                                 */
   /*                                                                       */
+  /*    lsb_delta ::                                                       */
+  /*      The difference between hinted and unhinted left side bearing     */
+  /*      while autohinting is active.  Zero otherwise.                    */
+  /*                                                                       */
+  /*    rsb_delta ::                                                       */
+  /*      The difference between hinted and unhinted right side bearing    */
+  /*      while autohinting is active.  Zero otherwise.                    */
+  /*                                                                       */
   /* <Note>                                                                */
   /*    If @FT_Load_Glyph is called with default flags (see                */
   /*    @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in   */
@@ -1525,6 +1495,34 @@ FT_BEGIN_HEADER
   /*    position (e.g. coordinates [0,0] on the baseline).  Of course,     */
   /*    `slot->format' is also changed to `FT_GLYPH_FORMAT_BITMAP' .       */
   /*                                                                       */
+  /* <Note>                                                                */
+  /*   Here a small pseudo code fragment which shows how to use            */
+  /*  `lsb_delta' and `rsb_delta':                                         */
+  /*   {                                                                   */
+  /*     FT_Pos  origin_x       = 0;                                       */
+  /*     FT_Pos  prev_rsb_delta = 0;                                       */
+  /*                                                                       */
+  /*                                                                       */
+  /*     for all glyphs do                                                 */
+  /*       <compute kern between current and previous glyph and add it to  */
+  /*        `origin_x'>                                                    */
+  /*                                                                       */
+  /*       <load glyph with `FT_Load_Glyph'>                               */
+  /*                                                                       */
+  /*       if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 )            */
+  /*         origin_x -= 64;                                               */
+  /*       else if                                                         */
+  /*          ( prev_rsb_delta - face->glyph->lsb_delta < -32 )            */
+  /*         origin_x += 64;                                               */
+  /*                                                                       */
+  /*       prev_rsb_delta = face->glyph->rsb_delta;                        */
+  /*                                                                       */
+  /*       <save glyph image, or render glyph, or ...>                     */
+  /*                                                                       */
+  /*       origin_x += face->glyph->advance.x;                             */
+  /*     endfor                                                            */
+  /*   }                                                                   */
+  /*                                                                       */
   typedef struct  FT_GlyphSlotRec_
   {
     FT_Library        library;
@@ -1552,6 +1550,9 @@ FT_BEGIN_HEADER
     void*             control_data;
     long              control_len;
 
+    FT_Pos            lsb_delta;
+    FT_Pos            rsb_delta;
+
     void*             other;
 
     FT_Slot_Internal  internal;
diff --git a/src/autofit/afdummy.c b/src/autofit/afdummy.c
index 3a13140..2d5f898 100644
--- a/src/autofit/afdummy.c
+++ b/src/autofit/afdummy.c
@@ -1,4 +1,5 @@
 #include "afdummy.h"
+#include "afhints.h"
 
 
   static FT_Error
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index bd3a2c0..6782ee8 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -190,8 +190,8 @@
             loader->pp1.x = FT_PIX_ROUND( pp1x_uh );
             loader->pp2.x = FT_PIX_ROUND( pp2x_uh );
 
-            slot->metrics.lsb_delta = hinter->pp1.x - pp1x_uh;
-            slot->metrics.rsb_delta = hinter->pp2.x - pp2x_uh;
+            slot->lsb_delta = loader->pp1.x - pp1x_uh;
+            slot->rsb_delta = loader->pp2.x - pp2x_uh;
 
 #if 0
             /* try to fix certain bad advance computations */
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c
index c9e4dbb..8e8afea 100644
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -1569,8 +1569,8 @@
         hinter->pp1.x = FT_PIX_ROUND( pp1x_uh );
         hinter->pp2.x = FT_PIX_ROUND( pp2x_uh );
 
-        slot->metrics.lsb_delta = hinter->pp1.x - pp1x_uh;
-        slot->metrics.rsb_delta = hinter->pp2.x - pp2x_uh;
+        slot->lsb_delta = hinter->pp1.x - pp1x_uh;
+        slot->rsb_delta = hinter->pp2.x - pp2x_uh;
 
 #if 0
         /* try to fix certain bad advance computations */
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 757cba7..620b3d7 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -251,6 +251,14 @@
   typedef unsigned char   Byte, *PByte;
   typedef char            Bool;
 
+  typedef union
+  {
+    long    l;
+    void*   p;
+    void  (*f)(void);
+
+  } Alignment, *PAlignment;
+
   typedef struct  TPoint_
   {
     Long  x;
@@ -313,7 +321,7 @@
 
 
 #define AlignProfileSize \
-          ( ( sizeof ( TProfile ) + sizeof ( long ) - 1 ) / sizeof ( long ) )
+          ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) )
 
 
 #ifdef TT_STATIC_RASTER
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 31281df..37b58a3 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -160,7 +160,7 @@
     FT_Int            found_win     = -1;
     FT_Int            found_unicode = -1;
 
-    FT_Bool           is_english;
+    FT_Bool           is_english = 0;
 
     TT_NameEntry_ConvertFunc  convert;