* src/psaux/t1decode.c (t1_decoder_parse_charstring): Expand

start_point, check_points, add_point, add_point1, close_contour
macros.
Remove add_contour macro.
Return error code from t1_builder_start_point and
t1_builder_check_points when there was one (instead of returning 0).
This commit is contained in:
John Tytgat 2010-11-23 19:30:38 +01:00 committed by Werner Lemberg
parent 391c79360b
commit ed7d1a59ff
2 changed files with 48 additions and 36 deletions

View File

@ -1,3 +1,12 @@
2010-11-23 John Tytgat <John.Tytgat@esko.com>
* src/psaux/t1decode.c (t1_decoder_parse_charstring): Expand
start_point, check_points, add_point, add_point1, close_contour
macros.
Remove add_contour macro.
Return error code from t1_builder_start_point and
t1_builder_check_points when there was one (instead of returning 0).
2010-11-22 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[truetype] Identify the tricky fonts by cvt/fpgm/prep checksums.

View File

@ -373,15 +373,6 @@
#endif
/* we don't want to touch the source code -- use macro trick */
#define start_point t1_builder_start_point
#define check_points t1_builder_check_points
#define add_point t1_builder_add_point
#define add_point1 t1_builder_add_point1
#define add_contour t1_builder_add_contour
#define close_contour t1_builder_close_contour
/* compute random seed from stack address of parameter */
seed = (FT_Fixed)( ( (FT_PtrDist)(char*)&seed ^
(FT_PtrDist)(char*)&decoder ^
@ -739,8 +730,10 @@
decoder->flex_state = 1;
decoder->num_flex_vectors = 0;
if ( start_point( builder, x, y ) ||
check_points( builder, 6 ) )
if ( ( error = t1_builder_start_point( builder, x, y ) )
!= PSaux_Err_Ok ||
( error = t1_builder_check_points( builder, 6 ) )
!= PSaux_Err_Ok )
goto Fail;
break;
@ -757,10 +750,10 @@
/* point without adding any point to the outline */
idx = decoder->num_flex_vectors++;
if ( idx > 0 && idx < 7 )
add_point( builder,
x,
y,
(FT_Byte)( idx == 3 || idx == 6 ) );
t1_builder_add_point( builder,
x,
y,
(FT_Byte)( idx == 3 || idx == 6 ) );
}
break;
@ -1077,7 +1070,7 @@
case op_endchar:
FT_TRACE4(( " endchar\n" ));
close_contour( builder );
t1_builder_close_contour( builder );
/* close hints recording session */
if ( hinter )
@ -1176,7 +1169,7 @@
/* if there is no path, `closepath' is a no-op */
if ( builder->parse_state == T1_Parse_Have_Path ||
builder->parse_state == T1_Parse_Have_Moveto )
close_contour( builder );
t1_builder_close_contour( builder );
builder->parse_state = T1_Parse_Have_Width;
break;
@ -1184,7 +1177,8 @@
case op_hlineto:
FT_TRACE4(( " hlineto" ));
if ( start_point( builder, x, y ) )
if ( ( error = t1_builder_start_point( builder, x, y ) )
!= PSaux_Err_Ok )
goto Fail;
x += top[0];
@ -1205,30 +1199,34 @@
case op_hvcurveto:
FT_TRACE4(( " hvcurveto" ));
if ( start_point( builder, x, y ) ||
check_points( builder, 3 ) )
if ( ( error = t1_builder_start_point( builder, x, y ) )
!= PSaux_Err_Ok ||
( error = t1_builder_check_points( builder, 3 ) )
!= PSaux_Err_Ok )
goto Fail;
x += top[0];
add_point( builder, x, y, 0 );
t1_builder_add_point( builder, x, y, 0 );
x += top[1];
y += top[2];
add_point( builder, x, y, 0 );
t1_builder_add_point( builder, x, y, 0 );
y += top[3];
add_point( builder, x, y, 1 );
t1_builder_add_point( builder, x, y, 1 );
break;
case op_rlineto:
FT_TRACE4(( " rlineto" ));
if ( start_point( builder, x, y ) )
if ( ( error = t1_builder_start_point( builder, x, y ) )
!= PSaux_Err_Ok )
goto Fail;
x += top[0];
y += top[1];
Add_Line:
if ( add_point1( builder, x, y ) )
if ( ( error = t1_builder_add_point1( builder, x, y ) )
!= PSaux_Err_Ok )
goto Fail;
break;
@ -1248,43 +1246,48 @@
case op_rrcurveto:
FT_TRACE4(( " rrcurveto" ));
if ( start_point( builder, x, y ) ||
check_points( builder, 3 ) )
if ( ( error = t1_builder_start_point( builder, x, y ) )
!= PSaux_Err_Ok ||
( error = t1_builder_check_points( builder, 3 ) )
!= PSaux_Err_Ok )
goto Fail;
x += top[0];
y += top[1];
add_point( builder, x, y, 0 );
t1_builder_add_point( builder, x, y, 0 );
x += top[2];
y += top[3];
add_point( builder, x, y, 0 );
t1_builder_add_point( builder, x, y, 0 );
x += top[4];
y += top[5];
add_point( builder, x, y, 1 );
t1_builder_add_point( builder, x, y, 1 );
break;
case op_vhcurveto:
FT_TRACE4(( " vhcurveto" ));
if ( start_point( builder, x, y ) ||
check_points( builder, 3 ) )
if ( ( error = t1_builder_start_point( builder, x, y ) )
!= PSaux_Err_Ok ||
( error = t1_builder_check_points( builder, 3 ) )
!= PSaux_Err_Ok )
goto Fail;
y += top[0];
add_point( builder, x, y, 0 );
t1_builder_add_point( builder, x, y, 0 );
x += top[1];
y += top[2];
add_point( builder, x, y, 0 );
t1_builder_add_point( builder, x, y, 0 );
x += top[3];
add_point( builder, x, y, 1 );
t1_builder_add_point( builder, x, y, 1 );
break;
case op_vlineto:
FT_TRACE4(( " vlineto" ));
if ( start_point( builder, x, y ) )
if ( ( error = t1_builder_start_point( builder, x, y ) )
!= PSaux_Err_Ok )
goto Fail;
y += top[0];