Commit a1a6a1f6799da772ae1b625ea2fb09d5f5bbce5d

Ewald Hew 2017-09-25T08:31:52

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.

diff --git a/ChangeLog b/ChangeLog
index 067ecbe..6930a85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2017-09-25  Ewald Hew  <ewaldhew@gmail.com>
 
+	[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  <ewaldhew@gmail.com>
+
 	[psaux] Move `psdecode' into `psobjs'.
 
 	As the former only contains a single procedure, move it into
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index d37b6e5..2553547 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 fd09414..89e168a 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 a62ee23..0baba7a 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 6773eac..e1f7240 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 );