From 68fb4789a582561606fafbe51e7a217598bb35ec Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 15 Nov 2015 13:06:48 +0100 Subject: [PATCH] * 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. --- ChangeLog | 7 +++++++ src/autofit/afhints.c | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a39a56acd..f62d5de93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-11-15 Werner Lemberg + + * 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 * src/bdf/bdflib.c (bdf_load_font): Fix small memory leak (#46439). diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index 67438786a..56c822000 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;