Commit a6bdb667d9c94f45399c5cf4aa8cfa2ab0fde901

David Turner 2007-02-12T22:33:48

better handling of serif segments in the Latin auto-fitter, gets rid of broken "9" in Arial 9pt/96dpi

diff --git a/ChangeLog b/ChangeLog
index 0c0ac62..65cc3fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,7 +8,25 @@
 
 2007-02-12  David Turner  <david@freetype.org>
 
-	Simplify projection and dual-projection code interface.
+	* src/autofit/aflatin.c: slight optimization of the segment linker
+	and better handling of serif segments to get rid of broken "9" in
+	Arial 9 pts (96dpi)
+
+	* src/autofit/afloader.c: improve spacing adjustments for the
+	non-light auto-hinted modes. Gets rid of "inter-letter spacing
+	is too wide"
+
+	* src/truetype/ttinterp.h, src/truetype/ttinterp.c: simplify
+	projection and dual-projection code interface
+
+	* include/freetype/internal/ftmemory.h, src/base/ftutils.c,
+	src/bfd/bfddrivr.c, src/bdf/bdflib.c, src/pcf/pcfread.c,
+	src/cff/cffdrivr.c, src/cff/cffload.c, src/cff/cffobjs.c,
+	src/sfnt/sfdriver.c, src/type1/t1driver.c, src/type42/t42drivr.c:
+	introduce ft_mem_strdup, ft_mem_dup, ft_mem_strcpyn and the
+	corresponding macros, and modify code to use them. This is to
+	get rid of various uses of strcpy and other "evil" functions,
+	as well as simplify a few things
 
 	* src/truetype/ttinterp.h (TT_Project_Func): Use `FT_Pos', not
 	FT_Vector' as argument type.
@@ -44,6 +62,7 @@
 	src/sfnt/sfdriver.c (sfnt_get_glyph_name), src/type1/t1driver.c
 	(t1_get_glyph_name), src/type42/t42drivr.c (t42_get_glyph_name,
 	t42_get_name_index): Use new functions and simplify code.
+>>>>>>> 1.1522
 
 	* builds/mac/ftmac.c (FT_FSPathMakeSpec): Don't use FT_MIN.
 
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 1425d3b..608e158 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -923,11 +923,11 @@
     {
       /* the fake segments are introduced to hint the metrics -- */
       /* we must never link them to anything                     */
-      if ( seg1->first == seg1->last || seg1->dir != major_dir )
+      if ( seg1->first == seg1->last )
         continue;
 
-      for ( seg2 = segments; seg2 < segment_limit; seg2++ )
-        if ( seg2 != seg1 && seg1->dir + seg2->dir == 0 )
+      for ( seg2 = seg1+1; seg2 < segment_limit; seg2++ )
+        if ( seg1->dir + seg2->dir == 0 )
         {
           FT_Pos  pos1 = seg1->pos;
           FT_Pos  pos2 = seg2->pos;
@@ -935,7 +935,7 @@
 
 
           if ( dist < 0 )
-            continue;
+            dist = -dist;
 
           {
             FT_Pos  min = seg1->min_coord;
@@ -1020,7 +1020,7 @@
      *  corresponding threshold in font units.
      */
     if ( dim == AF_DIMENSION_HORZ )
-        segment_length_threshold = FT_DivFix( 96, hints->y_scale );
+        segment_length_threshold = FT_DivFix( 64, hints->y_scale );
     else
         segment_length_threshold = 0;
 
@@ -1057,6 +1057,12 @@
       if ( seg->height < segment_length_threshold )
         continue;
 
+     /* a special case for serif edges, if they're smaller than 1.5
+      * pixels, we ignore them
+      */
+      if ( seg->serif && 2*seg->height < 3*segment_length_threshold )
+        continue;
+
       /* look for an edge corresponding to the segment */
       for ( ee = 0; ee < axis->num_edges; ee++ )
       {
@@ -2139,7 +2145,7 @@
     for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
     {
 #ifdef AF_USE_WARPER
-      if ( ( dim == AF_DIMENSION_HORZ && 
+      if ( ( dim == AF_DIMENSION_HORZ &&
              metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) )
       {
         AF_WarperRec  warper;