Use FT_SET_ERROR where useful. Other minor code formatting.
This commit is contained in:
parent
db17ceb4c0
commit
5d664b6d51
@ -942,13 +942,14 @@
|
||||
/* if it works, fine. */
|
||||
|
||||
error = FT_New_Face_From_Suitcase( library, pathname, face_index, aface );
|
||||
if ( error == 0 )
|
||||
return error;
|
||||
if ( error )
|
||||
{
|
||||
/* let it fall through to normal loader (.ttf, .otf, etc.); */
|
||||
/* we signal this by returning no error and no FT_Face */
|
||||
*aface = NULL;
|
||||
}
|
||||
|
||||
/* let it fall through to normal loader (.ttf, .otf, etc.); */
|
||||
/* we signal this by returning no error and no FT_Face */
|
||||
*aface = NULL;
|
||||
return 0;
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
@ -982,12 +983,13 @@
|
||||
/* try resourcefork based font: LWFN, FFIL */
|
||||
error = FT_New_Face_From_Resource( library, (UInt8 *)pathname,
|
||||
face_index, aface );
|
||||
if ( error != 0 || *aface != NULL )
|
||||
if ( error || *aface )
|
||||
return error;
|
||||
|
||||
/* let it fall through to normal loader (.ttf, .otf, etc.) */
|
||||
args.flags = FT_OPEN_PATHNAME;
|
||||
args.pathname = (char*)pathname;
|
||||
|
||||
return FT_Open_Face( library, &args, face_index, aface );
|
||||
}
|
||||
|
||||
|
@ -1400,7 +1400,7 @@
|
||||
|
||||
error = FT_Open_Face( library, &args, face_index, aface );
|
||||
|
||||
if ( error == FT_Err_Ok )
|
||||
if ( !error )
|
||||
(*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
|
||||
else
|
||||
#ifdef FT_MACINTOSH
|
||||
@ -1758,11 +1758,12 @@
|
||||
aface );
|
||||
|
||||
Exit2:
|
||||
if ( error == FT_ERR( Array_Too_Large ) )
|
||||
if ( FT_ERR_EQ( error, Array_Too_Large ) )
|
||||
FT_TRACE2(( " Abort due to too-short buffer to store"
|
||||
" all POST fragments\n" ));
|
||||
else if ( error == FT_ERR( Invalid_Offset ) )
|
||||
else if ( FT_ERR_EQ( error, Invalid_Offset ) )
|
||||
FT_TRACE2(( " Abort due to invalid offset in a POST fragment\n" ));
|
||||
|
||||
if ( error )
|
||||
error = FT_ERR( Cannot_Open_Resource );
|
||||
FT_FREE( pfb_data );
|
||||
|
@ -423,7 +423,7 @@ THE SOFTWARE.
|
||||
else
|
||||
bdfface->family_name = NULL;
|
||||
|
||||
if ( ( error = bdf_interpret_style( face ) ) != 0 )
|
||||
if ( FT_SET_ERROR( bdf_interpret_style( face ) ) )
|
||||
goto Exit;
|
||||
|
||||
/* the number of glyphs (with one slot for the undefined glyph */
|
||||
|
@ -2301,7 +2301,7 @@
|
||||
p->font->comments[p->font->comments_len] = 0;
|
||||
}
|
||||
}
|
||||
else if ( error == FT_Err_Ok )
|
||||
else if ( !error )
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
|
||||
*font = p->font;
|
||||
|
@ -44,7 +44,7 @@
|
||||
cf2_setError( FT_Error* error,
|
||||
FT_Error value )
|
||||
{
|
||||
if ( error && *error == 0 )
|
||||
if ( error && !*error )
|
||||
*error = value;
|
||||
}
|
||||
|
||||
|
@ -1260,8 +1260,8 @@ THE SOFTWARE.
|
||||
if ( face->accel.constantWidth )
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
|
||||
if ( ( error = pcf_interpret_style( face ) ) != 0 )
|
||||
goto Exit;
|
||||
if ( FT_SET_ERROR( pcf_interpret_style( face ) ) )
|
||||
goto Exit;
|
||||
|
||||
prop = pcf_find_property( face, "FAMILY_NAME" );
|
||||
if ( prop && prop->isString )
|
||||
|
@ -347,7 +347,7 @@
|
||||
size,
|
||||
gindex,
|
||||
( load_flags & FT_LOAD_BITMAP_METRICS_ONLY ) != 0 );
|
||||
if ( error == 0 )
|
||||
if ( !error )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
@ -752,10 +752,8 @@
|
||||
if ( arg_cnt != 0 )
|
||||
goto Unexpected_OtherSubr;
|
||||
|
||||
if ( ( error = t1_builder_start_point( builder, x, y ) )
|
||||
!= FT_Err_Ok ||
|
||||
( error = t1_builder_check_points( builder, 6 ) )
|
||||
!= FT_Err_Ok )
|
||||
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ||
|
||||
FT_SET_ERROR( t1_builder_check_points( builder, 6 ) ) )
|
||||
goto Fail;
|
||||
|
||||
decoder->flex_state = 1;
|
||||
@ -1200,8 +1198,7 @@
|
||||
case op_hlineto:
|
||||
FT_TRACE4(( " hlineto" ));
|
||||
|
||||
if ( ( error = t1_builder_start_point( builder, x, y ) )
|
||||
!= FT_Err_Ok )
|
||||
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
|
||||
goto Fail;
|
||||
|
||||
x += top[0];
|
||||
@ -1222,10 +1219,8 @@
|
||||
case op_hvcurveto:
|
||||
FT_TRACE4(( " hvcurveto" ));
|
||||
|
||||
if ( ( error = t1_builder_start_point( builder, x, y ) )
|
||||
!= FT_Err_Ok ||
|
||||
( error = t1_builder_check_points( builder, 3 ) )
|
||||
!= FT_Err_Ok )
|
||||
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ||
|
||||
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
|
||||
goto Fail;
|
||||
|
||||
x += top[0];
|
||||
@ -1240,16 +1235,14 @@
|
||||
case op_rlineto:
|
||||
FT_TRACE4(( " rlineto" ));
|
||||
|
||||
if ( ( error = t1_builder_start_point( builder, x, y ) )
|
||||
!= FT_Err_Ok )
|
||||
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
|
||||
goto Fail;
|
||||
|
||||
x += top[0];
|
||||
y += top[1];
|
||||
|
||||
Add_Line:
|
||||
if ( ( error = t1_builder_add_point1( builder, x, y ) )
|
||||
!= FT_Err_Ok )
|
||||
if ( FT_SET_ERROR( t1_builder_add_point1( builder, x, y ) ) )
|
||||
goto Fail;
|
||||
break;
|
||||
|
||||
@ -1269,10 +1262,8 @@
|
||||
case op_rrcurveto:
|
||||
FT_TRACE4(( " rrcurveto" ));
|
||||
|
||||
if ( ( error = t1_builder_start_point( builder, x, y ) )
|
||||
!= FT_Err_Ok ||
|
||||
( error = t1_builder_check_points( builder, 3 ) )
|
||||
!= FT_Err_Ok )
|
||||
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ||
|
||||
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
|
||||
goto Fail;
|
||||
|
||||
x += top[0];
|
||||
@ -1291,10 +1282,8 @@
|
||||
case op_vhcurveto:
|
||||
FT_TRACE4(( " vhcurveto" ));
|
||||
|
||||
if ( ( error = t1_builder_start_point( builder, x, y ) )
|
||||
!= FT_Err_Ok ||
|
||||
( error = t1_builder_check_points( builder, 3 ) )
|
||||
!= FT_Err_Ok )
|
||||
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ||
|
||||
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
|
||||
goto Fail;
|
||||
|
||||
y += top[0];
|
||||
@ -1309,8 +1298,7 @@
|
||||
case op_vlineto:
|
||||
FT_TRACE4(( " vlineto" ));
|
||||
|
||||
if ( ( error = t1_builder_start_point( builder, x, y ) )
|
||||
!= FT_Err_Ok )
|
||||
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
|
||||
goto Fail;
|
||||
|
||||
y += top[0];
|
||||
|
@ -3756,7 +3756,7 @@
|
||||
error = clazz->validate( cmap, FT_VALIDATOR( &valid ) );
|
||||
}
|
||||
|
||||
if ( valid.validator.error == 0 )
|
||||
if ( !valid.validator.error )
|
||||
{
|
||||
FT_CMap ttcmap;
|
||||
|
||||
|
@ -1796,11 +1796,11 @@
|
||||
|
||||
/* this call provides additional offsets */
|
||||
/* for each component's translation */
|
||||
if ( ( error = TT_Vary_Apply_Glyph_Deltas(
|
||||
face,
|
||||
glyph_index,
|
||||
&outline,
|
||||
(FT_UInt)outline.n_points ) ) != 0 )
|
||||
if ( FT_SET_ERROR( TT_Vary_Apply_Glyph_Deltas(
|
||||
face,
|
||||
glyph_index,
|
||||
&outline,
|
||||
(FT_UInt)outline.n_points ) ) )
|
||||
goto Exit1;
|
||||
|
||||
subglyph = gloader->current.subglyphs;
|
||||
|
@ -954,10 +954,10 @@
|
||||
|
||||
FT_TRACE2(( "GVAR " ));
|
||||
|
||||
if ( ( error = face->goto_table( face,
|
||||
TTAG_gvar,
|
||||
stream,
|
||||
&table_len ) ) != 0 )
|
||||
if ( FT_SET_ERROR( face->goto_table( face,
|
||||
TTAG_gvar,
|
||||
stream,
|
||||
&table_len ) ) )
|
||||
{
|
||||
FT_TRACE2(( "is missing\n" ));
|
||||
goto Exit;
|
||||
@ -1322,12 +1322,12 @@
|
||||
FT_TRACE2(( "FVAR " ));
|
||||
|
||||
/* both `fvar' and `gvar' must be present */
|
||||
if ( ( error = face->goto_table( face, TTAG_gvar,
|
||||
stream, &table_len ) ) != 0 )
|
||||
if ( FT_SET_ERROR( face->goto_table( face, TTAG_gvar,
|
||||
stream, &table_len ) ) )
|
||||
{
|
||||
/* CFF2 is an alternate to gvar here */
|
||||
if ( ( error = face->goto_table( face, TTAG_CFF2,
|
||||
stream, &table_len ) ) != 0 )
|
||||
if ( FT_SET_ERROR( face->goto_table( face, TTAG_CFF2,
|
||||
stream, &table_len ) ) )
|
||||
{
|
||||
FT_TRACE1(( "\n"
|
||||
"TT_Get_MM_Var: `gvar' or `CFF2' table is missing\n" ));
|
||||
@ -1335,8 +1335,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( error = face->goto_table( face, TTAG_fvar,
|
||||
stream, &table_len ) ) != 0 )
|
||||
if ( FT_SET_ERROR( face->goto_table( face, TTAG_fvar,
|
||||
stream, &table_len ) ) )
|
||||
{
|
||||
FT_TRACE1(( "is missing\n" ));
|
||||
goto Exit;
|
||||
@ -1589,7 +1589,7 @@
|
||||
|
||||
if ( face->blend == NULL )
|
||||
{
|
||||
if ( ( error = TT_Get_MM_Var( face, NULL ) ) != 0 )
|
||||
if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
@ -1624,7 +1624,7 @@
|
||||
FT_TRACE5(( "\n" ));
|
||||
|
||||
if ( !face->isCFF2 && blend->glyphoffsets == NULL )
|
||||
if ( ( error = ft_var_load_gvar( face ) ) != 0 )
|
||||
if ( FT_SET_ERROR( ft_var_load_gvar( face ) ) )
|
||||
goto Exit;
|
||||
|
||||
if ( blend->normalizedcoords == NULL )
|
||||
@ -1740,7 +1740,7 @@
|
||||
|
||||
if ( face->blend == NULL )
|
||||
{
|
||||
if ( ( error = TT_Get_MM_Var( face, NULL ) ) != 0 )
|
||||
if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) )
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -1805,7 +1805,7 @@
|
||||
|
||||
if ( face->blend == NULL )
|
||||
{
|
||||
if ( ( error = TT_Get_MM_Var( face, NULL ) ) != 0 )
|
||||
if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) )
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user