From a1a6a1f6799da772ae1b625ea2fb09d5f5bbce5d Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 25 Sep 2017 08:31:52 +0200 Subject: [PATCH] Minor fixes. * include/freetype/internal/psaux.h, src/psaux/psobjs.{c,h}: Rearrange `ps_builder_init' arguments to conventional order. * src/psaux/psft.c (cf2_decoder_parse_charstrings): Add a check and notice for `SubFont' in Type 1 mode. --- ChangeLog | 10 ++++++++++ include/freetype/internal/psaux.h | 6 +++--- src/psaux/psft.c | 7 +++++++ src/psaux/psobjs.c | 18 +++++++++--------- src/psaux/psobjs.h | 7 ++++--- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 067ecbe6e..6930a8532 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2017-09-25 Ewald Hew + + [psaux] Minor fixes. + + * include/freetype/internal/psaux.h, src/psaux/psobjs.{c,h}: + Rearrange `ps_builder_init' arguments to conventional order. + + * src/psaux/psft.c (cf2_decoder_parse_charstrings): Add a check and + notice for `SubFont' in Type 1 mode. + 2017-09-25 Ewald Hew [psaux] Move `psdecode' into `psobjs'. diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index d37b6e5d4..25535475a 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -473,9 +473,9 @@ FT_BEGIN_HEADER typedef struct PS_Builder_FuncsRec_ { void - (*init)( void* builder, - FT_Bool is_t1, - PS_Builder* ps_builder ); + (*init)( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ); void (*done)( PS_Builder* builder ); diff --git a/src/psaux/psft.c b/src/psaux/psft.c index fd09414d8..89e168a94 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -315,6 +315,13 @@ FT_ASSERT( decoder && ( is_t1 || decoder->cff ) ); + if ( is_t1 && !decoder->current_subfont ) + { + FT_ERROR(( "cf2_decoder_parse_charstrings (Type 1): " + "SubFont missing. Use `t1_make_subfont' first\n" )); + return FT_THROW( Invalid_Table ); + } + memory = decoder->builder.memory; /* CF2 data is saved here across glyphs */ diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index a62ee231e..0baba7aa6 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2054,9 +2054,9 @@ /* hinting :: Whether hinting should be applied. */ /* */ FT_LOCAL_DEF( void ) - ps_builder_init( void* builder, - FT_Bool is_t1, - PS_Builder* ps_builder ) + ps_builder_init( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ) { FT_ZERO( ps_builder ); @@ -2356,9 +2356,9 @@ { T1_Decoder t1_decoder = (T1_Decoder)decoder; - ps_builder_init( &t1_decoder->builder, - is_t1, - &ps_decoder->builder ); + ps_builder_init( &ps_decoder->builder, + &t1_decoder->builder, + is_t1 ); ps_decoder->cf2_instance = &t1_decoder->cf2_instance; ps_decoder->psnames = t1_decoder->psnames; @@ -2382,9 +2382,9 @@ { CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder; - ps_builder_init( &cff_decoder->builder, - is_t1, - &ps_decoder->builder ); + ps_builder_init( &ps_decoder->builder, + &cff_decoder->builder, + is_t1 ); ps_decoder->cff = cff_decoder->cff; ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 6773eacb2..e1f72407a 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -242,9 +242,10 @@ FT_BEGIN_HEADER /*************************************************************************/ FT_LOCAL( void ) - ps_builder_init( void* builder, - FT_Bool is_t1, - PS_Builder* ps_builder ); + ps_builder_init( PS_Builder* ps_builder, + void* builder, + FT_Bool is_t1 ); + FT_LOCAL( void ) ps_builder_done( PS_Builder* builder );