[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.
This commit is contained in:
Ewald Hew 2017-08-25 10:13:46 +08:00
parent fd7441a3b7
commit 4fedbbe130
4 changed files with 23 additions and 15 deletions

View File

@ -473,9 +473,9 @@ FT_BEGIN_HEADER
typedef struct PS_Builder_FuncsRec_ typedef struct PS_Builder_FuncsRec_
{ {
void void
(*init)( void* builder, (*init)( PS_Builder* ps_builder,
FT_Bool is_t1, void* builder,
PS_Builder* ps_builder ); FT_Bool is_t1 );
void void
(*done)( PS_Builder* builder ); (*done)( PS_Builder* builder );

View File

@ -315,6 +315,13 @@
FT_ASSERT( decoder && FT_ASSERT( decoder &&
( is_t1 || decoder->cff ) ); ( 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; memory = decoder->builder.memory;
/* CF2 data is saved here across glyphs */ /* CF2 data is saved here across glyphs */

View File

@ -2054,9 +2054,9 @@
/* hinting :: Whether hinting should be applied. */ /* hinting :: Whether hinting should be applied. */
/* */ /* */
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
ps_builder_init( void* builder, ps_builder_init( PS_Builder* ps_builder,
FT_Bool is_t1, void* builder,
PS_Builder* ps_builder ) FT_Bool is_t1 )
{ {
FT_ZERO( ps_builder ); FT_ZERO( ps_builder );
@ -2356,9 +2356,9 @@
{ {
T1_Decoder t1_decoder = (T1_Decoder)decoder; T1_Decoder t1_decoder = (T1_Decoder)decoder;
ps_builder_init( &t1_decoder->builder, ps_builder_init( &ps_decoder->builder,
is_t1, &t1_decoder->builder,
&ps_decoder->builder ); is_t1 );
ps_decoder->cf2_instance = &t1_decoder->cf2_instance; ps_decoder->cf2_instance = &t1_decoder->cf2_instance;
ps_decoder->psnames = t1_decoder->psnames; ps_decoder->psnames = t1_decoder->psnames;
@ -2382,9 +2382,9 @@
{ {
CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder; CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder;
ps_builder_init( &cff_decoder->builder, ps_builder_init( &ps_decoder->builder,
is_t1, &cff_decoder->builder,
&ps_decoder->builder ); is_t1 );
ps_decoder->cff = cff_decoder->cff; ps_decoder->cff = cff_decoder->cff;
ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance; ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance;

View File

@ -242,9 +242,10 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
FT_LOCAL( void ) FT_LOCAL( void )
ps_builder_init( void* builder, ps_builder_init( PS_Builder* ps_builder,
FT_Bool is_t1, void* builder,
PS_Builder* ps_builder ); FT_Bool is_t1 );
FT_LOCAL( void ) FT_LOCAL( void )
ps_builder_done( PS_Builder* builder ); ps_builder_done( PS_Builder* builder );