From db17ceb4c0a9acb307c033fb766c8f35ac9e007f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 17 Dec 2016 13:39:31 +0100 Subject: [PATCH] * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code. --- ChangeLog | 4 +++ src/truetype/ttobjs.c | 65 ++++++++++--------------------------------- 2 files changed, 18 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b9d822d2..7b7486408 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-12-17 Werner Lemberg + + * src/truetype/ttobjs.c (tt_face_init): Simplify conditional code. + 2016-12-17 Werner Lemberg [sfnt, truetype] Various sanitizing fixes. diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 81577a49b..7e37113f9 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -577,10 +577,9 @@ if ( FT_IS_SCALABLE( ttface ) ) { - #ifdef FT_CONFIG_OPTION_INCREMENTAL - if ( !ttface->internal->incremental_interface ) +#endif { error = tt_face_load_loca( face, stream ); @@ -606,58 +605,22 @@ goto Exit; /* Check the scalable flag based on `loca'. */ - if ( !ttface->internal->incremental_interface && - ttface->num_fixed_sizes && - face->glyph_locations && - tt_check_single_notdef( ttface ) ) +#ifdef FT_CONFIG_OPTION_INCREMENTAL + if ( !ttface->internal->incremental_interface ) +#endif { - FT_TRACE5(( "tt_face_init:" - " Only the `.notdef' glyph has an outline.\n" - " " - " Resetting scalable flag to FALSE.\n" )); + if ( ttface->num_fixed_sizes && + face->glyph_locations && + tt_check_single_notdef( ttface ) ) + { + FT_TRACE5(( "tt_face_init:" + " Only the `.notdef' glyph has an outline.\n" + " " + " Resetting scalable flag to FALSE.\n" )); - ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE; + ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE; + } } - -#else /* !FT_CONFIG_OPTION_INCREMENTAL */ - - error = tt_face_load_loca( face, stream ); - - /* having a (non-zero) `glyf' table without */ - /* a `loca' table is not valid */ - if ( face->glyf_len && FT_ERR_EQ( error, Table_Missing ) ) - goto Exit; - if ( error ) - goto Exit; - - /* `fpgm', `cvt', and `prep' are optional */ - error = tt_face_load_cvt( face, stream ); - if ( error && FT_ERR_NEQ( error, Table_Missing ) ) - goto Exit; - - error = tt_face_load_fpgm( face, stream ); - if ( error && FT_ERR_NEQ( error, Table_Missing ) ) - goto Exit; - - error = tt_face_load_prep( face, stream ); - if ( error && FT_ERR_NEQ( error, Table_Missing ) ) - goto Exit; - - /* Check the scalable flag based on `loca'. */ - if ( ttface->num_fixed_sizes && - face->glyph_locations && - tt_check_single_notdef( ttface ) ) - { - FT_TRACE5(( "tt_face_init:" - " Only the `.notdef' glyph has an outline.\n" - " " - " Resetting scalable flag to FALSE.\n" )); - - ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE; - } - -#endif /* !FT_CONFIG_OPTION_INCREMENTAL */ - } #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT