Commit 5b68e4fb60421038b58cceb8ef86e27ebf8625d7

Werner Lemberg 2014-09-24T19:06:13

[autofit] Minor clean-ups. * src/autofit/afhints.c (AF_FLAGS): Remove obsolete values. * src/autofit/afhints.c (af_glyph_hints_dump_points, af_glyph_hints_align_strong_points): Updated. * src/autofit/aflatin.c (af_latin_hints_link_segments, af_latin_hints_compute_segments), src/autofit/afcjk.c (af_cjk_hints_link_segments), src/autofit/aflatin2.c (af_latin2_hints_link_segments, af_latin2_hints_compute_segments): There are no longer fake segments since more than 10 years...

diff --git a/ChangeLog b/ChangeLog
index de1e06a..808ca3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2014-09-24  Werner Lemberg  <wl@gnu.org>
+
+	[autofit] Minor clean-ups.
+
+	* src/autofit/afhints.c (AF_FLAGS): Remove obsolete values.
+
+	* src/autofit/afhints.c (af_glyph_hints_dump_points,
+	af_glyph_hints_align_strong_points): Updated.
+
+	* src/autofit/aflatin.c (af_latin_hints_link_segments,
+	af_latin_hints_compute_segments), src/autofit/afcjk.c
+	(af_cjk_hints_link_segments), src/autofit/aflatin2.c
+	(af_latin2_hints_link_segments, af_latin2_hints_compute_segments):
+	There are no longer fake segments since more than 10 years...
+
 2014-09-22  Werner Lemberg  <wl@gnu.org>
 
 	[autofit] Minor code streamlining.
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 2084e31..048e0e7 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -765,10 +765,6 @@
     /* now compare each segment to the others */
     for ( seg1 = segments; seg1 < segment_limit; seg1++ )
     {
-      /* the fake segments are for metrics hinting only */
-      if ( seg1->first == seg1->last )
-        continue;
-
       if ( seg1->dir != major_dir )
         continue;
 
diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c
index ec61426..9fbc541 100644
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -201,7 +201,7 @@
 
     for ( point = points; point < limit; point++ )
       AF_DUMP(( "  [ %5d | %5d | %5d | %6.2f | %6.2f"
-                " | %5.2f | %5.2f | %c%c%c%c%c%c ]\n",
+                " | %5.2f | %5.2f | %c ]\n",
                 point - points,
                 point->fx,
                 point->fy,
@@ -209,12 +209,7 @@
                 point->oy / 64.0,
                 point->x / 64.0,
                 point->y / 64.0,
-                ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' ',
-                ( point->flags & AF_FLAG_INFLECTION )         ? 'i' : ' ',
-                ( point->flags & AF_FLAG_EXTREMA_X )          ? '<' : ' ',
-                ( point->flags & AF_FLAG_EXTREMA_Y )          ? 'v' : ' ',
-                ( point->flags & AF_FLAG_ROUND_X )            ? '(' : ' ',
-                ( point->flags & AF_FLAG_ROUND_Y )            ? 'u' : ' '));
+                ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' '));
     AF_DUMP(( "\n" ));
   }
 #ifdef __cplusplus
@@ -1076,8 +1071,7 @@
         /* if this point is candidate to weak interpolation, we       */
         /* interpolate it after all strong points have been processed */
 
-        if (  ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) &&
-             !( point->flags & AF_FLAG_INFLECTION )         )
+        if ( ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) )
           continue;
 
         if ( dim == AF_DIMENSION_VERT )
diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h
index c0ebd0d..92101de 100644
--- a/src/autofit/afhints.h
+++ b/src/autofit/afhints.h
@@ -72,13 +72,9 @@ FT_BEGIN_HEADER
    *    `af_{cjk,latin,...}_hints_compute_segments' are the functions to
    *    find segments in an outline.
    *
-   *    A segment is a series of consecutive points that are approximately
-   *    aligned along a coordinate axis.  The analysis to do so is specific
-   *    to a writing system.
-   *
-   *    A segment must have at least two points, except in the case of
-   *    `fake' segments that are generated to hint metrics appropriately,
-   *    and which consist of a single point.
+   *    A segment is a series of at least two consecutive points that are
+   *    approximately aligned along a coordinate axis.  The analysis to do
+   *    so is specific to a writing system.
    *
    *
    *  Edges
@@ -148,7 +144,7 @@ FT_BEGIN_HEADER
    *    Serifs are detected by `af_{cjk,latin,...}_hint_edges'.
    *
    *    In comparison to a stem, a serif (as handled by the auto-hinter
-   *    module which takes care of the `latin' writing system) has
+   *    module that takes care of the `latin' writing system) has
    *
    *      best segment_1 = segment_2 && best segment_2 != segment_1
    *
@@ -178,19 +174,19 @@ FT_BEGIN_HEADER
    *
    *  Strong Points
    *
-   *    Experience has shown that points which are not part of an edge need
-   *    to be interpolated linearly between their two closest edges, even if
-   *    these are not part of the contour of those particular points.
-   *    Typical candidates for this are
+   *    Experience has shown that points not part of an edge need to be
+   *    interpolated linearly between their two closest edges, even if these
+   *    are not part of the contour of those particular points.  Typical
+   *    candidates for this are
    *
    *    - angle points (i.e., points where the `in' and `out' direction
    *      differ greatly)
    *
    *    - inflection points (i.e., where the `in' and `out' angles are the
    *      same, but the curvature changes sign) [currently, such points
-   *      aren't handled in the auto-hinter]
+   *      aren't handled specially in the auto-hinter]
    *
-   *    `af_glyph_hints_align_strong_points' is the function which takes
+   *    `af_glyph_hints_align_strong_points' is the function that takes
    *    care of such situations; it is equivalent to the TrueType `IP'
    *    hinting instruction.
    *
@@ -220,23 +216,12 @@ FT_BEGIN_HEADER
     AF_FLAG_CUBIC   = 1 << 1,
     AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC,
 
-    /* point extremum flags */
-    AF_FLAG_EXTREMA_X = 1 << 2,
-    AF_FLAG_EXTREMA_Y = 1 << 3,
-
-    /* point roundness flags */
-    AF_FLAG_ROUND_X = 1 << 4,
-    AF_FLAG_ROUND_Y = 1 << 5,
-
     /* point touch flags */
-    AF_FLAG_TOUCH_X = 1 << 6,
-    AF_FLAG_TOUCH_Y = 1 << 7,
+    AF_FLAG_TOUCH_X = 1 << 2,
+    AF_FLAG_TOUCH_Y = 1 << 3,
 
     /* candidates for weak interpolation have this flag set */
-    AF_FLAG_WEAK_INTERPOLATION = 1 << 8,
-
-    /* all inflection points in the outline have this flag set */
-    AF_FLAG_INFLECTION = 1 << 9
+    AF_FLAG_WEAK_INTERPOLATION = 1 << 4
 
   } AF_Flags;
 
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index dc424af..36a3689 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1329,9 +1329,6 @@
         FT_Pos    last_v  = last->v;
 
 
-        if ( first == last )
-          continue;
-
         if ( first_v < last_v )
         {
           AF_Point  p;
@@ -1407,9 +1404,7 @@
     /* now compare each segment to the others */
     for ( seg1 = segments; seg1 < segment_limit; seg1++ )
     {
-      /* the fake segments are introduced to hint the metrics -- */
-      /* we must never link them to anything                     */
-      if ( seg1->dir != axis->major_dir || seg1->first == seg1->last )
+      if ( seg1->dir != axis->major_dir )
         continue;
 
       /* search for stems having opposite directions, */
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index 29b4af2..07590b3 100644
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -890,9 +890,6 @@
         FT_Pos    last_v  = last->v;
 
 
-        if ( first == last )
-          continue;
-
         if ( first_v < last_v )
         {
           p = first->prev;
@@ -984,7 +981,7 @@
 #ifdef AF_SORT_SEGMENTS
     for ( seg1 = segments; seg1 < segment_mid; seg1++ )
     {
-      if ( seg1->dir != axis->major_dir || seg1->first == seg1->last )
+      if ( seg1->dir != axis->major_dir )
         continue;
 
       for ( seg2 = segment_mid; seg2 < segment_limit; seg2++ )
@@ -992,9 +989,7 @@
     /* now compare each segment to the others */
     for ( seg1 = segments; seg1 < segment_limit; seg1++ )
     {
-      /* the fake segments are introduced to hint the metrics -- */
-      /* we must never link them to anything                     */
-      if ( seg1->dir != axis->major_dir || seg1->first == seg1->last )
+      if ( seg1->dir != axis->major_dir )
         continue;
 
       for ( seg2 = segments; seg2 < segment_limit; seg2++ )