* 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
diff --git a/ChangeLog b/ChangeLog
index a39a56a..f62d5de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2015-11-15 Werner Lemberg <wl@gnu.org>
+ * 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 <wl@gnu.org>
+
* src/bdf/bdflib.c (bdf_load_font): Fix small memory leak (#46439).
2015-11-11 Werner Lemberg <wl@gnu.org>
diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c
index 6743878..56c8220 100644
--- 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;