more patches from Tom (to fix its former patches :-)
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c
index 76eb340..1a77935 100644
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -483,10 +483,10 @@
{
builder->path_begun = 1;
error = add_contour( builder );
- if ( error )
- return error;
+ if ( !error )
+ error = add_point1( builder, x, y );
}
- return add_point1( builder, x, y );
+ return error;
}
@@ -625,13 +625,13 @@
{
if ( ip >= limit )
goto Syntax_Error;
- val = ( v - 247 ) * 256 + *ip++ + 108;
+ val = ( (FT_Long)v - 247 ) * 256 + *ip++ + 108;
}
else if ( v < 255 )
{
if ( ip >= limit )
goto Syntax_Error;
- val = -( v - 251 ) * 256 - *ip++ - 108;
+ val = -( (FT_Long)v - 251 ) * 256 - *ip++ - 108;
}
else
{
@@ -1212,8 +1212,10 @@
args = stack;
/* adding five more points; 4 control points, 1 on-curve point */
+ /* make sure we have enough space for the start point if it */
+ /* needs to be added.. */
if ( start_point( builder, x, y ) ||
- check_points( builder, 5 ) )
+ check_points( builder, 6 ) )
goto Memory_Error;
/* Record the starting point's y postion for later use */
@@ -1245,9 +1247,9 @@
add_point( builder, x, y, 0 );
/* ending point, with y-value the same as the start */
- /* point's y-value -- we don't add this point, though */
x += args[8];
y = start_y;
+ add_point( builder, x, y, 1 );
args = stack;
break;
@@ -1262,9 +1264,9 @@
args = stack;
- /* adding five more points; 4 control points, 1 on-curve point */
+ /* adding six more points; 4 control points, 2 on-curve point */
if ( start_point( builder, x, y ) ||
- check_points ( builder, 5 ) )
+ check_points ( builder, 6 ) )
goto Memory_Error;
/* record the starting point's y-position for later use */
@@ -1297,6 +1299,7 @@
/* ending point, with y-value the same as the start point's */
/* y-value -- we don't add this point, though */
x += args[6];
+ add_point( builder, x, y, 1 );
args = stack;
break;
@@ -1315,7 +1318,7 @@
/* adding five more points; 4 control points, 1 on-curve point */
if ( start_point( builder, x, y ) ||
- check_points( builder, 5 ) )
+ check_points( builder, 6 ) )
goto Memory_Error;
/* record the starting point's x, y postion for later use */
@@ -1352,6 +1355,7 @@
args += 2;
}
+ /* is last operand a x or y delta ? */
if ( horizontal )
{
x += args[0];
@@ -1363,6 +1367,8 @@
y += args[0];
}
+ add_point( builder, x, y, 1 );
+
args = stack;
break;
}
@@ -1375,21 +1381,18 @@
FT_TRACE4(( " flex" ));
if ( start_point( builder, x, y ) ||
- check_points( builder, 5 ) )
+ check_points( builder, 6 ) )
goto Memory_Error;
args = stack;
- for ( count = 5; count > 0; count-- )
+ for ( count = 6; count > 0; count-- )
{
x += args[0];
y += args[1];
- add_point( builder, x, y, (FT_Bool)( count == 3 ) );
+ add_point( builder, x, y, (FT_Bool)( count == 3 || count == 0) );
args += 2;
}
- x += args[0];
- y += args[1];
-
args = stack;
}
break;