shithub: freetype+ttf2subf

Download patch

ref: 8530a228889128adfd446514928f36663ed20f04
parent: 89d4e4bd9a4fccd6a40373727ef1f667a3bd8cb2
author: David Turner <[email protected]>
date: Wed Jun 9 16:18:35 EDT 2004

* 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

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-06-08  David Turner  <[email protected]>
+
+	* 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  <[email protected]>
 
 	* src/autofit/afloader.c (af_loader_load_g): Set `lsb_delta' and
@@ -10,9 +20,6 @@
 2004-06-04  David Chester  <[email protected]>
 
 	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.
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -213,41 +213,6 @@
   /*    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_Pos  vertBearingY;
     FT_Pos  vertAdvance;
 
-    FT_Pos  lsb_delta;
-    FT_Pos  rsb_delta; 
-
   } FT_Glyph_Metrics;
 
 
@@ -1506,6 +1468,14 @@
   /*                         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 @@
   /*    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;
@@ -1551,6 +1549,9 @@
 
     void*             control_data;
     long              control_len;
+
+    FT_Pos            lsb_delta;
+    FT_Pos            rsb_delta;
 
     void*             other;
 
--- a/src/autofit/afdummy.c
+++ b/src/autofit/afdummy.c
@@ -1,4 +1,5 @@
 #include "afdummy.h"
+#include "afhints.h"
 
 
   static FT_Error
--- 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 */
--- 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 */
--- 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
--- 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;