fixed a _nasty_ bug in the CFF driver. Note that there are still escapement problems though..

This commit is contained in:
David Turner 2000-06-28 05:35:58 +00:00
parent 98c2fde0b3
commit 075cdf1288
4 changed files with 57 additions and 32 deletions

View File

@ -87,7 +87,7 @@ else
# with the program by default on Unix, we thus add it whenever appropriate # with the program by default on Unix, we thus add it whenever appropriate
# #
ifeq ($(PLATFORM),unix) ifeq ($(PLATFORM),unix)
LINK += -lm LINK += -lm -lefence
endif endif
COMMON_LINK = $(LINK) $(COMMON_OBJ) COMMON_LINK = $(LINK) $(COMMON_OBJ)

View File

@ -363,10 +363,6 @@
if (cff->num_subfonts >= 1) if (cff->num_subfonts >= 1)
{ {
FT_Byte fd_index = CFF_Get_FD( &cff->fd_select, glyph_index ); FT_Byte fd_index = CFF_Get_FD( &cff->fd_select, glyph_index );
if (fd_index >= cff->num_subfonts)
{
FT_ERROR(( "INVALID FD INDEX = %d >= %d\n", fd_index, cff->num_subfonts ));
}
sub = cff->subfonts[fd_index]; sub = cff->subfonts[fd_index];
} }
@ -1090,32 +1086,60 @@
break; break;
case t2_op_rlinecurve: case t2_op_rlinecurve:
case t2_op_rcurveline:
{ {
FT_Int mod6 = num_args % 6; FT_Int num_lines = (num_args-6)/2;
FT_TRACE4(( " rlinecurve" ));
FT_TRACE4(( op == t2_op_rcurveline ? " rcurveline" : if ( num_args < 8 || (num_args-6) & 1)
" rlinecurve" ));
if ( num_args < 8 || ( mod6 != 0 && mod6 != 2 ) )
goto Stack_Underflow; goto Stack_Underflow;
if ( start_point ( builder, x, y ) || if ( start_point( builder, x, y ) ||
check_points( builder, ( num_args / 6 ) * 3 + mod6 / 2 ) ) check_points( builder, num_lines + 3 ) )
goto Memory_Error; goto Memory_Error;
args = stack; args = stack;
if ( op == t2_op_rlinecurve && mod6 )
/* first, add the line segments */
while (num_lines > 0)
{ {
x += args[0]; x += args[0];
y += args[1]; y += args[1];
add_point( builder, x, y, 1 ); add_point( builder, x, y, 1 );
args += 2; args += 2;
num_args -= 2; num_lines--;
} }
/* then, the curve */
x += args[0];
y += args[1];
add_point( builder, x, y, 0 );
x += args[2];
y += args[3];
add_point( builder, x, y, 0 );
x += args[4];
y += args[5];
add_point( builder, x, y, 1 );
args = stack;
}
break;
case t2_op_rcurveline:
{
FT_Int num_curves = (num_args-2)/6;
while ( num_args >= 6 )
FT_TRACE4(( " rcurveline" ));
if ( num_args < 8 || (num_args-2) % 6 )
goto Stack_Underflow;
if ( start_point ( builder, x, y ) ||
check_points( builder, num_curves*3 + 2 ) )
goto Memory_Error;
args = stack;
/* first, add the curves */
while (num_curves > 0)
{ {
x += args[0]; x += args[0];
y += args[1]; y += args[1];
@ -1126,16 +1150,13 @@
x += args[4]; x += args[4];
y += args[5]; y += args[5];
add_point( builder, x, y, 1 ); add_point( builder, x, y, 1 );
args += 6; args += 6;
num_args -= 6; num_curves--;
}
if ( op == t2_op_rcurveline && num_args )
{
x += args[0];
y += args[1];
add_point( builder, x, y, 1 );
} }
/* then the final line */
x += args[0];
y += args[1];
add_point( builder, x, y, 1 );
args = stack; args = stack;
} }
break; break;
@ -1528,12 +1549,15 @@
return error; return error;
Syntax_Error: Syntax_Error:
FT_TRACE4(( "** Syntax Error **" ));
return T2_Err_Invalid_File_Format; return T2_Err_Invalid_File_Format;
Stack_Underflow: Stack_Underflow:
FT_TRACE4(( "** Stack underflow **" ));
return T2_Err_Too_Few_Arguments; return T2_Err_Too_Few_Arguments;
Stack_Overflow: Stack_Overflow:
FT_TRACE4(( "** Stack overflow**" ));
return T2_Err_Stack_Overflow; return T2_Err_Stack_Overflow;
Memory_Error: Memory_Error:

View File

@ -354,7 +354,8 @@
if ( FILE_Seek(offset) || READ_Byte(format) ) if ( FILE_Seek(offset) || READ_Byte(format) )
goto Exit; goto Exit;
select->format = format; select->format = format;
select->cache_count = 0; /* clear cache */
switch (format) switch (format)
{ {
case 0: /* format 0, that's simple */ case 0: /* format 0, that's simple */

View File

@ -404,7 +404,7 @@
t2_kind_delta, \ t2_kind_delta, \
code | T2CODE, \ code | T2CODE, \
(FT_UInt)(char*)&T2_REF( T2TYPE, name ), \ (FT_UInt)(char*)&T2_REF( T2TYPE, name ), \
sizeof( T2_REF( T2TYPE, name ) ), \ sizeof( T2_REF( T2TYPE, name )[0] ), \
0, \ 0, \
max, \ max, \
(FT_UInt)(char*)&T2_REF( T2TYPE, num_ ## name ) \ (FT_UInt)(char*)&T2_REF( T2TYPE, num_ ## name ) \