ref: eadc8df24db13359448af612f193685b5d7e08f7
parent: 4b92cf80c7d99fb86454ea989ccf9ff9d379180c
author: Werner Lemberg <[email protected]>
date: Wed Oct 11 01:52:42 EDT 2000
A fix from Tom to fix the last=first point problem if it is a control point.
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -500,10 +500,12 @@
/* is located on the first point. */
if ( outline->n_points > 1 )
{
- FT_Int first = 0;
- FT_Vector* p1 = outline->points + first;
- FT_Vector* p2 = outline->points + outline->n_points - 1;
+ FT_Int first = 0;
+ FT_Vector* p1 = outline->points + first;
+ FT_Vector* p2 = outline->points + 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;
@@ -510,8 +512,11 @@
p1 = outline->points + first;
}
+ /* `delete' last point only if it coincides with the first */
+ /* point and it is not a control point (which can happen). */
if ( p1->x == p2->x && p1->y == p2->y )
- outline->n_points--;
+ if ( *control == FT_Curve_Tag_On )
+ outline->n_points--;
}
if ( outline->n_contours > 0 )
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -1238,13 +1238,15 @@
{
FT_Outline* outline = builder->current;
+
/* XXXX: We must not include the last point in the path if it */
/* is located on the first point. */
if ( outline->n_points > 1 )
{
- FT_Int first = 0;
- FT_Vector* p1 = outline->points + first;
- FT_Vector* p2 = outline->points + outline->n_points - 1;
+ FT_Int first = 0;
+ FT_Vector* p1 = outline->points + first;
+ FT_Vector* p2 = outline->points + outline->n_points - 1;
+ FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
if ( outline->n_contours > 1 )
@@ -1253,8 +1255,11 @@
p1 = outline->points + first;
}
+ /* `delete' last point only if it coincides with the first */
+ /* point and it is not a control point (which can happen). */
if ( p1->x == p2->x && p1->y == p2->y )
- outline->n_points--;
+ if ( *control == FT_Curve_Tag_On )
+ outline->n_points--;
}
if ( outline->n_contours > 0 )