shithub: freetype+ttf2subf

Download patch

ref: 68fb4789a582561606fafbe51e7a217598bb35ec
parent: 94cacac59479566f9718e6ebfa44f5477c889002
author: Werner Lemberg <[email protected]>
date: Sun Nov 15 08:06:48 EST 2015

* src/autofit/afhints.c (af_get_segment_index): Fix it.

The old code was too simple, returning invalid values in most cases
where a segment crosses the contour start.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2015-11-15  Werner Lemberg  <[email protected]>
 
+	* src/autofit/afhints.c (af_get_segment_index): Fix it.
+
+	The old code was too simple, returning invalid values in most cases
+	where a segment crosses the contour start.
+
+2015-11-15  Werner Lemberg  <[email protected]>
+
 	* src/bdf/bdflib.c (bdf_load_font): Fix small memory leak (#46439).
 
 2015-11-11  Werner Lemberg  <[email protected]>
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -257,11 +257,23 @@
       }
       else
       {
-        if ( point >= segment->first || point <= segment->last )
-          break;
+        AF_Point  p = segment->first;
+
+
+        for (;;)
+        {
+          if ( point == p )
+            goto Exit;
+
+          if ( p == segment->last )
+            break;
+
+          p = p->next;
+        }
       }
     }
 
+  Exit:
     if ( segment == limit )
       return -1;