* src/psaux/psobjs.c (t1_builder_close_contour): Don't add contour

if it consists of one point only.  Based on a patch from Savannah
bug #23683 (from John Tytgat).
This commit is contained in:
Werner Lemberg 2008-06-24 05:44:28 +00:00
parent 745a4f42a5
commit 5563bea093
2 changed files with 24 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2008-06-24 Werner Lemberg <wl@gnu.org>
* src/psaux/psobjs.c (t1_builder_close_contour): Don't add contour
if it consists of one point only. Based on a patch from Savannah
bug #23683 (from John Tytgat).
2008-06-22 Werner Lemberg <wl@gnu.org> 2008-06-22 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgload.c (TT_Load_Glyph): Protect bytecode stuff * src/truetype/ttgload.c (TT_Load_Glyph): Protect bytecode stuff

View File

@ -1634,27 +1634,24 @@
t1_builder_close_contour( T1_Builder builder ) t1_builder_close_contour( T1_Builder builder )
{ {
FT_Outline* outline = builder->current; FT_Outline* outline = builder->current;
FT_Int first;
if ( !outline ) if ( !outline )
return; return;
/* XXXX: We must not include the last point in the path if it */ first = outline->n_contours <= 1
? 0 : outline->contours[outline->n_contours - 2] + 1;
/* We must not include the last point in the path if it */
/* is located on the first point. */ /* is located on the first point. */
if ( outline->n_points > 1 ) if ( outline->n_points > 1 )
{ {
FT_Int first = 0;
FT_Vector* p1 = outline->points + first; FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1; FT_Vector* p2 = outline->points + outline->n_points - 1;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
if ( outline->n_contours > 1 )
{
first = outline->contours[outline->n_contours - 2] + 1;
p1 = outline->points + first;
}
/* `delete' last point only if it coincides with the first */ /* `delete' last point only if it coincides with the first */
/* point and it is not a control point (which can happen). */ /* point and it is not a control point (which can happen). */
if ( p1->x == p2->x && p1->y == p2->y ) if ( p1->x == p2->x && p1->y == p2->y )
@ -1663,9 +1660,19 @@
} }
if ( outline->n_contours > 0 ) if ( outline->n_contours > 0 )
{
/* Don't add contours only consisting of one point, i.e., */
/* check whether begin point and last point are the same. */
if ( first == outline->n_points - 1 )
{
outline->n_contours--;
outline->n_points--;
}
else
outline->contours[outline->n_contours - 1] = outline->contours[outline->n_contours - 1] =
(short)( outline->n_points - 1 ); (short)( outline->n_points - 1 );
} }
}
/*************************************************************************/ /*************************************************************************/