freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 7f9499044 3/3: [autofit] Clean up contour indexing.


From: Werner Lemberg
Subject: [freetype2] master 7f9499044 3/3: [autofit] Clean up contour indexing.
Date: Mon, 20 Feb 2023 23:33:34 -0500 (EST)

branch: master
commit 7f9499044e3baa901de99251a007aa66e750b26c
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [autofit] Clean up contour indexing.
    
    * src/autofit/aflatin.c (af_latin_metrics_init_blues): Refactor.
    * src/autofit/afcjk.c (af_cjk_metrics_init_blues): Ditto.
---
 src/autofit/afcjk.c   | 12 +++++-------
 src/autofit/aflatin.c | 19 ++++++++-----------
 2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 5daefff35..7734d4e77 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -417,16 +417,14 @@
 
         {
           FT_Int  nn;
-          FT_Int  first = 0;
-          FT_Int  last  = -1;
+          FT_Int  pp, first, last;
 
 
-          for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ )
+          last = -1;
+          for ( nn = 0; nn < outline.n_contours; nn++ )
           {
-            FT_Int  pp;
-
-
-            last = outline.contours[nn];
+            first = last + 1;
+            last  = outline.contours[nn];
 
             /* Avoid single-point contours since they are never rasterized. */
             /* In some fonts, they correspond to mark attachment points     */
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 4b3c59b3c..1082fee9a 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -496,23 +496,20 @@
           /* now compute min or max point indices and coordinates */
           points             = outline.points;
           best_point         = -1;
+          best_contour_first = -1;
+          best_contour_last  = -1;
           best_y             = 0;  /* make compiler happy */
-          best_contour_first = 0;  /* ditto */
-          best_contour_last  = 0;  /* ditto */
 
           {
             FT_Int  nn;
-            FT_Int  first = 0;
-            FT_Int  last  = -1;
+            FT_Int  pp, first, last;
 
 
-            for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ )
+            last = -1;
+            for ( nn = 0; nn < outline.n_contours; nn++ )
             {
-              FT_Int  old_best_point = best_point;
-              FT_Int  pp;
-
-
-              last = outline.contours[nn];
+              first = last + 1;
+              last  = outline.contours[nn];
 
               /* Avoid single-point contours since they are never      */
               /* rasterized.  In some fonts, they correspond to mark   */
@@ -551,7 +548,7 @@
                 }
               }
 
-              if ( best_point != old_best_point )
+              if ( best_point > best_contour_last )
               {
                 best_contour_first = first;
                 best_contour_last  = last;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]