shithub: freetype+ttf2subf

Download patch

ref: 2b54eba36b40806b4cae290518fcb2911eb79959
parent: 3bcad43998e3bb0c9d848756970618a8cc61edb3
author: Werner Lemberg <[email protected]>
date: Fri May 7 03:08:14 EDT 2004

* src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset,
cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.

* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.

* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2004-05-06  Werner Lemberg  <[email protected]>
+
+	* src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset,
+	cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access
+	root fields directly.
+	* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.
+
+	* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
+	frame before calling TT_Vary_Get_Glyph_Deltas.
+
+	* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
+	consistency.
+	(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
+	pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
+	are typecast to the proper PCF_XXX types within the function. 
+	Update code accordingly.
+	(pcf_cmap_class): Remove casts.
+	(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
+	PCF_XXX but FT_XXX arguments which are typecast to the proper
+	PCF_XXX types within the function.
+	Update code accordingly.
+	Use FT_CALLBACK_DEF throughout.
+	(PCF_Set_Point_Size): New wrapper function.
+	(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
+	(pcf_driver_class): Remove casts.
+
 2004-05-04  Steve Hartwell  <[email protected]>
 
 	* src/truetype/ttobjs.c (tt_driver_done): Fix typo.
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -203,8 +203,8 @@
     /* reset the size object if necessary */
     if ( size )
     {
-      /* these two object must have the same parent */
-      if ( size->root.face != slot->root.face )
+      /* these two objects must have the same parent */
+      if ( cffsize->face != cffslot->face )
         return CFF_Err_Invalid_Face_Handle;
     }
 
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -46,7 +46,7 @@
   /*                                                                       */
   /*                            SIZE FUNCTIONS                             */
   /*                                                                       */
-  /*  Note that we store the global hints in the size's "internal" root    */
+  /*  Note that we store the global hints in the size's `internal' root    */
   /*  field.                                                               */
   /*                                                                       */
   /*************************************************************************/
@@ -140,7 +140,7 @@
     CFF_Size  size = (CFF_Size)cffsize;
 
 
-    if ( size->root.internal )
+    if ( cffsize->internal )
     {
       PSH_Globals_Funcs  funcs;
 
@@ -147,9 +147,9 @@
 
       funcs = cff_size_get_globals_funcs( size );
       if ( funcs )
-        funcs->destroy( (PSH_Globals)size->root.internal );
+        funcs->destroy( (PSH_Globals)cffsize->internal );
 
-      size->root.internal = 0;
+      cffsize->internal = 0;
     }
   }
 
@@ -165,7 +165,7 @@
     if ( funcs )
     {
       PSH_Globals    globals;
-      CFF_Face       face    = (CFF_Face)size->root.face;
+      CFF_Face       face    = (CFF_Face)cffsize->face;
       CFF_Font       font    = (CFF_FontRec *)face->extra.data;
       CFF_SubFont    subfont = &font->top_font;
 
@@ -219,9 +219,9 @@
         priv.lenIV          = cpriv->lenIV;
       }
 
-      error = funcs->create( size->root.face->memory, &priv, &globals );
+      error = funcs->create( cffsize->face->memory, &priv, &globals );
       if ( !error )
-        size->root.internal = (FT_Size_Internal)(void*)globals;
+        cffsize->internal = (FT_Size_Internal)(void*)globals;
     }
 
     return error;
@@ -236,7 +236,7 @@
     CFF_Size           size  = (CFF_Size)cffsize;
     PSH_Globals_Funcs  funcs = cff_size_get_globals_funcs( size );
     FT_Error           error = CFF_Err_Ok;
-    FT_Face            face  = size->root.face;
+    FT_Face            face  = cffsize->face;
 
     FT_UNUSED( char_width );
     FT_UNUSED( char_height );
@@ -243,9 +243,9 @@
 
 
     if ( funcs )
-      error = funcs->set_scale( (PSH_Globals)size->root.internal,
-                                 size->root.metrics.x_scale,
-                                 size->root.metrics.y_scale,
+      error = funcs->set_scale( (PSH_Globals)cffsize->internal,
+                                 cffsize->metrics.x_scale,
+                                 cffsize->metrics.y_scale,
                                  0, 0 );
 
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
@@ -255,7 +255,7 @@
       error = sbit_size_reset( size );
 
       if ( !error && !( face->face_flags & FT_FACE_FLAG_SCALABLE ) )
-        size->root.metrics = size->strike_metrics;
+        cffsize->metrics = size->strike_metrics;
     }
 
 #endif
@@ -290,19 +290,16 @@
   /*************************************************************************/
 
   FT_LOCAL_DEF( void )
-  cff_slot_done( FT_GlyphSlot  cffslot )        /* CFF_GlyphSlot */
+  cff_slot_done( FT_GlyphSlot  slot )
   {
-    CFF_GlyphSlot  slot = (CFF_GlyphSlot)cffslot;
-
-    slot->root.internal->glyph_hints = 0;
+    slot->internal->glyph_hints = 0;
   }
 
 
   FT_LOCAL_DEF( FT_Error )
-  cff_slot_init( FT_GlyphSlot  cffslot )        /* CFF_GlyphSlot */
+  cff_slot_init( FT_GlyphSlot  slot )
   {
-    CFF_GlyphSlot     slot     = (CFF_GlyphSlot)cffslot;
-    CFF_Face          face     = (CFF_Face)slot->root.face;
+    CFF_Face          face     = (CFF_Face)slot->face;
     CFF_Font          font     = (CFF_FontRec *)face->extra.data;
     PSHinter_Service  pshinter = (PSHinter_Service)font->pshinter;
 
@@ -312,7 +309,7 @@
       FT_Module  module;
 
 
-      module = FT_Get_Module( slot->root.face->driver->root.library,
+      module = FT_Get_Module( slot->face->driver->root.library,
                               "pshinter" );
       if ( module )
       {
@@ -320,7 +317,7 @@
 
 
         funcs = pshinter->get_t2_funcs( module );
-        slot->root.internal->glyph_hints = (void*)funcs;
+        slot->internal->glyph_hints = (void*)funcs;
       }
     }
 
@@ -379,7 +376,7 @@
       goto Bad_Format;
 #else
     sfnt = (SFNT_Service)FT_Get_Module_Interface(
-             face->root.driver->root.library, "sfnt" );
+             cffface->driver->root.library, "sfnt" );
     if ( !sfnt )
       goto Bad_Format;
 
@@ -386,7 +383,7 @@
     FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
 
     pshinter = (PSHinter_Service)FT_Get_Module_Interface(
-                 face->root.driver->root.library, "pshinter" );
+                 cffface->driver->root.library, "pshinter" );
 #endif
 
     /* create input stream from resource */
@@ -451,8 +448,7 @@
     {
       CFF_Font         cff;
       CFF_FontRecDict  dict;
-      FT_Memory        memory = face->root.memory;
-      FT_Face          root;
+      FT_Memory        memory = cffface->memory;
       FT_Int32         flags;
 
 
@@ -470,8 +466,7 @@
       /* Complement the root flags with some interesting information. */
       /* Note that this is only necessary for pure CFF and CEF fonts. */
 
-      root             = &face->root;
-      root->num_glyphs = cff->num_glyphs;
+      cffface->num_glyphs = cff->num_glyphs;
 
       dict = &cff->top_font.font_dict;
 
@@ -492,46 +487,46 @@
 
 
         /* Set up num_faces. */
-        root->num_faces = cff->num_faces;
+        cffface->num_faces = cff->num_faces;
 
         /* compute number of glyphs */
         if ( dict->cid_registry != 0xFFFFU )
-          root->num_glyphs = dict->cid_count;
+          cffface->num_glyphs = dict->cid_count;
         else
-          root->num_glyphs = cff->charstrings_index.count;
+          cffface->num_glyphs = cff->charstrings_index.count;
 
         /* set global bbox, as well as EM size */
-        root->bbox.xMin =   dict->font_bbox.xMin             >> 16;
-        root->bbox.yMin =   dict->font_bbox.yMin             >> 16;
-        root->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
-        root->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
+        cffface->bbox.xMin =   dict->font_bbox.xMin             >> 16;
+        cffface->bbox.yMin =   dict->font_bbox.yMin             >> 16;
+        cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
+        cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
 
-        root->ascender  = (FT_Short)( root->bbox.yMax );
-        root->descender = (FT_Short)( root->bbox.yMin );
-        root->height    = (FT_Short)(
-          ( ( root->ascender - root->descender ) * 12 ) / 10 );
+        cffface->ascender  = (FT_Short)( cffface->bbox.yMax );
+        cffface->descender = (FT_Short)( cffface->bbox.yMin );
+        cffface->height    = (FT_Short)(
+          ( ( cffface->ascender - cffface->descender ) * 12 ) / 10 );
 
         if ( dict->units_per_em )
-          root->units_per_EM = dict->units_per_em;
+          cffface->units_per_EM = dict->units_per_em;
         else
-          root->units_per_EM = 1000;
+          cffface->units_per_EM = 1000;
 
-        root->underline_position  =
+        cffface->underline_position  =
           (FT_Short)( dict->underline_position >> 16 );
-        root->underline_thickness =
+        cffface->underline_thickness =
           (FT_Short)( dict->underline_thickness >> 16 );
 
         /* retrieve font family & style name */
-        root->family_name = cff_index_get_name( &cff->name_index,
-                                                face_index );
+        cffface->family_name = cff_index_get_name( &cff->name_index,
+                                                   face_index );
 
-        if ( root->family_name )
+        if ( cffface->family_name )
         {
           char*  full   = cff_index_get_sid_string( &cff->string_index,
                                                     dict->full_name,
                                                     psnames );
           char*  fullp  = full;
-          char*  family = root->family_name;
+          char*  family = cffface->family_name;
 
           /* We try to extract the style name from the full name.   */
           /* We need to ignore spaces and dashes during the search. */
@@ -584,14 +579,14 @@
 
           /* do we have a `/FontName' for a CID-keyed font? */
           if ( cid_font_name )
-            root->family_name = cid_font_name;
+            cffface->family_name = cid_font_name;
         }
 
         if ( style_name )
-          root->style_name = style_name;
+          cffface->style_name = style_name;
         else
           /* assume "Regular" style if we don't know better */
-          root->style_name = cff_strcpy( memory, (char *)"Regular" );
+          cffface->style_name = cff_strcpy( memory, (char *)"Regular" );
 
         /*******************************************************************/
         /*                                                                 */
@@ -614,7 +609,7 @@
           flags |= FT_FACE_FLAG_KERNING;
 #endif
 
-        root->face_flags = flags;
+        cffface->face_flags = flags;
 
         /*******************************************************************/
         /*                                                                 */
@@ -638,7 +633,7 @@
           FT_FREE( weight );
         }
 
-        root->style_flags = flags;
+        cffface->style_flags = flags;
       }
 
 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
@@ -645,7 +640,7 @@
       /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
       /* has unset this flag because of the 3.0 `post' table           */
       if ( dict->cid_registry == 0xFFFFU )
-        root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
+        cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
 #endif
 
       /*******************************************************************/
@@ -663,9 +658,9 @@
         CFF_Encoding   encoding = &cff->encoding;
 
 
-        for ( nn = 0; nn < (FT_UInt)root->num_charmaps; nn++ )
+        for ( nn = 0; nn < (FT_UInt)cffface->num_charmaps; nn++ )
         {
-          cmap = root->charmaps[nn];
+          cmap = cffface->charmaps[nn];
 
           /* Windows Unicode (3,1)? */
           if ( cmap->platform_id == 3 && cmap->encoding_id == 1 )
@@ -682,18 +677,18 @@
           goto Exit;
 
         /* we didn't find a Unicode charmap -- synthetize one */
-        cmaprec.face        = root;
+        cmaprec.face        = cffface;
         cmaprec.platform_id = 3;
         cmaprec.encoding_id = 1;
         cmaprec.encoding    = FT_ENCODING_UNICODE;
 
-        nn = (FT_UInt)root->num_charmaps;
+        nn = (FT_UInt)cffface->num_charmaps;
 
         FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL );
 
         /* if no Unicode charmap was previously selected, select this one */
-        if ( root->charmap == NULL && nn != (FT_UInt)root->num_charmaps )
-          root->charmap = root->charmaps[nn];
+        if ( cffface->charmap == NULL && nn != (FT_UInt)cffface->num_charmaps )
+          cffface->charmap = cffface->charmaps[nn];
 
       Skip_Unicode:
         if ( encoding->count > 0 )
@@ -701,7 +696,7 @@
           FT_CMap_Class  clazz;
 
 
-          cmaprec.face        = root;
+          cmaprec.face        = cffface;
           cmaprec.platform_id = 7;  /* Adobe platform id */
 
           if ( encoding->offset == 0 )
@@ -741,7 +736,7 @@
   cff_face_done( FT_Face  cffface )         /* CFF_Face */
   {
     CFF_Face      face   = (CFF_Face)cffface;
-    FT_Memory     memory = face->root.memory;
+    FT_Memory     memory = cffface->memory;
     SFNT_Service  sfnt   = (SFNT_Service)face->sfnt;
 
 
--- a/src/cff/cffobjs.h
+++ b/src/cff/cffobjs.h
@@ -131,10 +131,10 @@
                         FT_UInt     vert_resolution );
 
   FT_LOCAL( void )
-  cff_slot_done( FT_GlyphSlot  slot );      /* CFF_GlyphSlot */
+  cff_slot_done( FT_GlyphSlot  slot );
 
   FT_LOCAL( FT_Error )
-  cff_slot_init( FT_GlyphSlot   slot );     /* CFF_GlyphSlot */
+  cff_slot_init( FT_GlyphSlot  slot );
 
 
   /*************************************************************************/
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -48,9 +48,10 @@
 #include FT_SERVICE_BDF_H
 #include FT_SERVICE_XFREE86_NAME_H
 
+
   typedef struct  PCF_CMapRec_
   {
-    FT_CMapRec    cmap;
+    FT_CMapRec    root;
     FT_UInt       num_encodings;
     PCF_Encoding  encodings;
 
@@ -58,11 +59,15 @@
 
 
   FT_CALLBACK_DEF( FT_Error )
-  pcf_cmap_init( PCF_CMap  cmap )
+  pcf_cmap_init( FT_CMap     pcfcmap,   /* PCF_CMap */
+                 FT_Pointer  init_data )
   {
-    PCF_Face  face = (PCF_Face)FT_CMAP_FACE( cmap );
+    PCF_CMap  cmap = (PCF_CMap)pcfcmap;
+    PCF_Face  face = (PCF_Face)FT_CMAP_FACE( pcfcmap );
 
+    FT_UNUSED( init_data );
 
+
     cmap->num_encodings = (FT_UInt)face->nencodings;
     cmap->encodings     = face->encodings;
 
@@ -71,8 +76,11 @@
 
 
   FT_CALLBACK_DEF( void )
-  pcf_cmap_done( PCF_CMap  cmap )
+  pcf_cmap_done( FT_CMap  pcfcmap )         /* PCF_CMap */
   {
+    PCF_CMap  cmap = (PCF_CMap)pcfcmap;
+
+
     cmap->encodings     = NULL;
     cmap->num_encodings = 0;
   }
@@ -79,12 +87,13 @@
 
 
   FT_CALLBACK_DEF( FT_UInt )
-  pcf_cmap_char_index( PCF_CMap   cmap,
+  pcf_cmap_char_index( FT_CMap    pcfcmap,  /* PCF_CMap */
                        FT_UInt32  charcode )
   {
+    PCF_CMap      cmap      = (PCF_CMap)pcfcmap;
     PCF_Encoding  encodings = cmap->encodings;
     FT_UInt       min, max, mid;
-    FT_UInt       result = 0;
+    FT_UInt       result    = 0;
 
 
     min = 0;
@@ -115,13 +124,14 @@
 
 
   FT_CALLBACK_DEF( FT_UInt )
-  pcf_cmap_char_next( PCF_CMap    cmap,
+  pcf_cmap_char_next( FT_CMap    pcfcmap,   /* PCF_CMap */
                       FT_UInt32  *acharcode )
   {
+    PCF_CMap      cmap      = (PCF_CMap)pcfcmap;
     PCF_Encoding  encodings = cmap->encodings;
     FT_UInt       min, max, mid;
-    FT_UInt32     charcode = *acharcode + 1;
-    FT_UInt       result   = 0;
+    FT_UInt32     charcode  = *acharcode + 1;
+    FT_UInt       result    = 0;
 
 
     min = 0;
@@ -163,10 +173,10 @@
   FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec  pcf_cmap_class =
   {
     sizeof( PCF_CMapRec ),
-    (FT_CMap_InitFunc)     pcf_cmap_init,
-    (FT_CMap_DoneFunc)     pcf_cmap_done,
-    (FT_CMap_CharIndexFunc)pcf_cmap_char_index,
-    (FT_CMap_CharNextFunc) pcf_cmap_char_next
+    pcf_cmap_init,
+    pcf_cmap_done,
+    pcf_cmap_char_index,
+    pcf_cmap_char_next
   };
 
 
@@ -180,9 +190,10 @@
 #define FT_COMPONENT  trace_pcfdriver
 
 
-  FT_CALLBACK_DEF( FT_Error )
-  PCF_Face_Done( PCF_Face  face )
+  FT_CALLBACK_DEF( void )
+  PCF_Face_Done( FT_Face  pcfface )         /* PCF_Face */
   {
+    PCF_Face   face   = (PCF_Face)pcfface;
     FT_Memory  memory = FT_FACE_MEMORY( face );
 
 
@@ -208,8 +219,8 @@
     }
 
     FT_FREE( face->toc.tables );
-    FT_FREE( face->root.family_name );
-    FT_FREE( face->root.available_sizes );
+    FT_FREE( pcfface->family_name );
+    FT_FREE( pcfface->available_sizes );
     FT_FREE( face->charset_encoding );
     FT_FREE( face->charset_registry );
 
@@ -216,23 +227,22 @@
     FT_TRACE4(( "PCF_Face_Done: done face\n" ));
 
     /* close gzip/LZW stream if any */
-    if ( face->root.stream == &face->gzip_stream )
+    if ( pcfface->stream == &face->gzip_stream )
     {
       FT_Stream_Close( &face->gzip_stream );
-      face->root.stream = face->gzip_source;
+      pcfface->stream = face->gzip_source;
     }
-
-    return PCF_Err_Ok;
   }
 
 
   FT_CALLBACK_DEF( FT_Error )
   PCF_Face_Init( FT_Stream      stream,
-                 PCF_Face       face,
+                 FT_Face        pcfface,        /* PCF_Face */
                  FT_Int         face_index,
                  FT_Int         num_params,
                  FT_Parameter*  params )
   {
+    PCF_Face  face  = (PCF_Face)pcfface;
     FT_Error  error = PCF_Err_Ok;
 
     FT_UNUSED( num_params );
@@ -267,9 +277,9 @@
           goto Fail;
 
         face->gzip_source = stream;
-        face->root.stream = &face->gzip_stream;
+        pcfface->stream   = &face->gzip_stream;
 
-        stream = face->root.stream;
+        stream = pcfface->stream;
 
         error = pcf_load_font( stream, face );
         if ( error )
@@ -278,9 +288,9 @@
       else
       {
         face->gzip_source = stream;
-        face->root.stream = &face->gzip_stream;
+        pcfface->stream   = &face->gzip_stream;
 
-        stream = face->root.stream;
+        stream = pcfface->stream;
 
         error = pcf_load_font( stream, face );
         if ( error )
@@ -337,8 +347,8 @@
 
 #if 0
         /* Select default charmap */
-        if (face->root.num_charmaps)
-          face->root.charmap = face->root.charmaps[0];
+        if ( pcfface->num_charmaps )
+          pcfface->charmap = pcfface->charmaps[0];
 #endif
       }
     }
@@ -353,12 +363,17 @@
   }
 
 
-  static FT_Error
-  PCF_Set_Pixel_Size( FT_Size  size )
+  FT_CALLBACK_DEF( FT_Error )
+  PCF_Set_Pixel_Size( FT_Size  size,
+                      FT_UInt  pixel_width,
+                      FT_UInt  pixel_height )
   {
-    PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
+    PCF_Face  face = (PCF_Face)FT_SIZE_FACE( size );
 
+    FT_UNUSED( pixel_width );
+    FT_UNUSED( pixel_height );
 
+
     FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem,
                                       face->root.available_sizes->y_ppem >> 6 ));
 
@@ -384,7 +399,23 @@
   }
 
 
-  static FT_Error
+  FT_CALLBACK_DEF( FT_Error )
+  PCF_Set_Point_Size( FT_Size     size,
+                      FT_F26Dot6  char_width,
+                      FT_F26Dot6  char_height,
+                      FT_UInt     horz_resolution,
+                      FT_UInt     vert_resolution )
+  {
+    FT_UNUSED( char_width );
+    FT_UNUSED( char_height );
+    FT_UNUSED( horz_resolution );
+    FT_UNUSED( vert_resolution );
+
+    return PCF_Set_Pixel_Size( size, 0, 0 );
+  }
+
+
+  FT_CALLBACK_DEF( FT_Error )
   PCF_Glyph_Load( FT_GlyphSlot  slot,
                   FT_Size       size,
                   FT_UInt       glyph_index,
@@ -568,7 +599,7 @@
   };
 
 
-  static FT_Module_Interface
+  FT_CALLBACK_DEF( FT_Module_Interface )
   pcf_driver_requester( FT_Module    module,
                         const char*  name )
   {
@@ -592,30 +623,30 @@
 
       0,
 
-      (FT_Module_Constructor)0,
-      (FT_Module_Destructor) 0,
-      (FT_Module_Requester)  pcf_driver_requester
+      0,
+      0,
+      pcf_driver_requester
     },
 
-    sizeof( PCF_FaceRec ),
-    sizeof( FT_SizeRec ),
-    sizeof( FT_GlyphSlotRec ),
+    sizeof ( PCF_FaceRec ),
+    sizeof ( FT_SizeRec ),
+    sizeof ( FT_GlyphSlotRec ),
 
-    (FT_Face_InitFunc)        PCF_Face_Init,
-    (FT_Face_DoneFunc)        PCF_Face_Done,
-    (FT_Size_InitFunc)        0,
-    (FT_Size_DoneFunc)        0,
-    (FT_Slot_InitFunc)        0,
-    (FT_Slot_DoneFunc)        0,
+    PCF_Face_Init,
+    PCF_Face_Done,
+    0,                      /* FT_Size_InitFunc */
+    0,                      /* FT_Size_DoneFunc */
+    0,                      /* FT_Slot_InitFunc */
+    0,                      /* FT_Slot_DoneFunc */
 
-    (FT_Size_ResetPointsFunc) PCF_Set_Pixel_Size,
-    (FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size,
+    PCF_Set_Point_Size,
+    PCF_Set_Pixel_Size,
 
-    (FT_Slot_LoadFunc)        PCF_Glyph_Load,
+    PCF_Glyph_Load,
 
-    (FT_Face_GetKerningFunc)  0,
-    (FT_Face_AttachFunc)      0,
-    (FT_Face_GetAdvancesFunc) 0
+    0,                      /* FT_Face_GetKerningFunc  */
+    0,                      /* FT_Face_AttachFunc      */
+    0                       /* FT_Face_GetAdvancesFunc */
   };
 
 
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -738,15 +738,25 @@
     if ( ((TT_Face)load->face)->doblend )
     {
       /* Deltas apply to the unscaled data. */
-      FT_Vector*  deltas;
-      FT_Memory   memory = load->face->memory;
-      FT_UInt     i;
+      FT_Vector*    deltas;
+      FT_Memory     memory       = load->face->memory;
+      FT_StreamRec  saved_stream = *(load->stream);
+      FT_UInt       i;
 
 
-      if ( ( error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(load->face),
-                                               load->glyph_index,
-                                               &deltas,
-                                               n_points ) ) )
+      /* TT_Vary_Get_Glyph_Deltas uses a frame, thus we have to save */
+      /* (and restore) the current one                               */
+      load->stream->cursor = 0;
+      load->stream->limit  = 0;
+
+      error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(load->face),
+                                        load->glyph_index,
+                                        &deltas,
+                                        n_points );
+
+      *(load->stream) = saved_stream;
+
+      if ( error )
         goto Exit;
 
       for ( i = 0; i < n_points; ++i )
@@ -863,7 +873,7 @@
 #endif
 
     FT_Error        error;
-    TT_Face         face   = (TT_Face)loader->face;
+    TT_Face         face = (TT_Face)loader->face;
     FT_ULong        offset;
     FT_Int          contours_count;
     FT_UInt         num_points, count;
@@ -872,9 +882,9 @@
     FT_Bool         opened_frame = 0;
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
-    struct FT_StreamRec_  inc_stream;
-    FT_Data               glyph_data;
-    FT_Bool               glyph_data_loaded = 0;
+    FT_StreamRec    inc_stream;
+    FT_Data         glyph_data;
+    FT_Bool         glyph_data_loaded = 0;
 #endif
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT