shithub: freetype+ttf2subf

Download patch

ref: 53b3fa1da5e3397388f3483ccc95910eca4a419d
parent: 4d57024d1c861443a981de6d7388548928349eee
author: David Turner <[email protected]>
date: Sun Feb 24 00:26:57 EST 2002

* renaming stream functions to the FT_Subject_Action scheme:

          FT_Seek_Stream         => FT_Stream_Seek
          FT_Skip_Stream         => FT_Stream_Skip
          FT_Read_Stream         => FT_Stream_Read
          FT_Read_Stream_At      => FT_Stream_Read_At
          FT_Access_Frame        => FT_Stream_Enter_Frame
          FT_Forget_Frame        => FT_Stream_Exit_Frame
          FT_Extract_Frame       => FT_Stream_Extract_Frame
          FT_Release_Frame       => FT_Stream_Release_Frame
          FT_Get_XXXX            => FT_Stream_Get_XXXX
          FT_Read_XXXX           => FT_Stream_Read_XXXX

          note also that:

          FT_New_Stream( filename, stream ) =>
            FT_Stream_Open( stream, filename )

          (the function doesn't create the FT_Stream structure, it simply
           initializes it for reading)

          FT_New_Memory_Stream( library, FT_Byte*  base, size, stream ) =>
            FT_Stream_Open_Memory( stream, const FT_Byte* base, size )

          FT_Done_Stream => FT_Stream_Close

          note that the name of the stream methods, defined in
          "include/freetype/ftsystem.h" have also been changed without
          problems:

            FT_Stream_IO    => FT_Stream_IOFunc
            FT_Stream_Close => FT_Stream_CloseFunc

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,43 @@
 2002-02-24  David Turner   <[email protected]>
 
+        * renaming stream functions to the FT_Subject_Action scheme:
+
+          FT_Seek_Stream         => FT_Stream_Seek
+          FT_Skip_Stream         => FT_Stream_Skip
+          FT_Read_Stream         => FT_Stream_Read
+          FT_Read_Stream_At      => FT_Stream_Read_At
+          FT_Access_Frame        => FT_Stream_Enter_Frame
+          FT_Forget_Frame        => FT_Stream_Exit_Frame
+          FT_Extract_Frame       => FT_Stream_Extract_Frame
+          FT_Release_Frame       => FT_Stream_Release_Frame
+          FT_Get_XXXX            => FT_Stream_Get_XXXX
+          FT_Read_XXXX           => FT_Stream_Read_XXXX
+
+          note also that:
+
+          FT_New_Stream( filename, stream ) =>
+            FT_Stream_Open( stream, filename )
+
+          (the function doesn't create the FT_Stream structure, it simply
+           initializes it for reading)
+
+          FT_New_Memory_Stream( library, FT_Byte*  base, size, stream ) =>
+            FT_Stream_Open_Memory( stream, const FT_Byte* base, size )
+
+          FT_Done_Stream => FT_Stream_Close
+
+          note that the name of the stream methods, defined in
+          "include/freetype/ftsystem.h" have also been changed without
+          problems:
+
+            FT_Stream_IO    => FT_Stream_IOFunc
+            FT_Stream_Close => FT_Stream_CloseFunc
+
+
+
+        * moving all memory and list management code to "src/base/ftutil.c"
+        (previously in "ftobjs.c" and "ftlist.c" respectively)
+
         * moving all code related to glyph loaders to "internal/ftgloadr.h"
         and "src/base/ftgloadr.c".
 
--- a/builds/amiga/src/base/ftsystem.c
+++ b/builds/amiga/src/base/ftsystem.c
@@ -307,8 +307,8 @@
   /* documentation is in ftobjs.h */
 
   FT_EXPORT_DEF( FT_Error )
-  FT_New_Stream( const char*  filepathname,
-                 FT_Stream    astream )
+  FT_Stream_Open( FT_Stream    stream,
+                  const char*  filepathname )
   {
 //  FILE*  file;
     BPTR   file;                // TetiSoft
@@ -315,7 +315,7 @@
     struct FileInfoBlock *fib;  // TetiSoft
 
 
-    if ( !astream )
+    if ( !stream )
       return FT_Err_Invalid_Stream_Handle;
 
 //  file = fopen( filepathname, "rb" );
@@ -322,7 +322,7 @@
     file = Open( filepathname, MODE_OLDFILE );  // TetiSoft
     if ( !file )
     {
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not open `%s'\n", filepathname ));
 
       return FT_Err_Cannot_Open_Resource;
@@ -335,7 +335,7 @@
     if ( !fib )
     {
       Close ( file );
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not open `%s'\n", filepathname ));
 
       return FT_Err_Cannot_Open_Resource;
@@ -344,26 +344,26 @@
     {
       FreeDosObject(DOS_FIB, fib);
       Close ( file );
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not open `%s'\n", filepathname ));
 
       return FT_Err_Cannot_Open_Resource;
     }
-    astream->size = fib->fib_Size;
+    stream->size = fib->fib_Size;
     FreeDosObject(DOS_FIB, fib);
 
-//  astream->descriptor.pointer = file;
-    astream->descriptor.pointer = (void *)file;
+//  stream->descriptor.pointer = file;
+    stream->descriptor.pointer = (void *)file;
 
-    astream->pathname.pointer   = (char*)filepathname;
-    astream->pos                = 0;
+    stream->pathname.pointer   = (char*)filepathname;
+    stream->pos                = 0;
 
-    astream->read  = ft_io_stream;
-    astream->close = ft_close_stream;
+    stream->read  = ft_io_stream;
+    stream->close = ft_close_stream;
 
-    FT_TRACE1(( "FT_New_Stream:" ));
+    FT_TRACE1(( "FT_Stream_Open:" ));
     FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
-                filepathname, astream->size ));
+                filepathname, stream->size ));
 
     return FT_Err_Ok;
   }
@@ -374,13 +374,13 @@
 
   extern FT_Int
   ft_mem_debug_init( FT_Memory  memory );
-  
+
   extern void
   ft_mem_debug_done( FT_Memory  memory );
-  
-#endif  
-      
 
+#endif
+
+
   /* documentation is in ftobjs.h */
 
   FT_EXPORT_DEF( FT_Memory )
@@ -411,7 +411,7 @@
         memory->free    = ft_free;
 #ifdef FT_DEBUG_MEMORY
         ft_mem_debug_init( memory );
-#endif    
+#endif
       }
     }
 
@@ -426,7 +426,7 @@
   {
 #ifdef FT_DEBUG_MEMORY
     ft_mem_debug_done( memory );
-#endif  
+#endif
 
 #ifdef __GNUC__
     DeletePool( memory->user );
--- a/builds/unix/ftsystem.c
+++ b/builds/unix/ftsystem.c
@@ -204,8 +204,8 @@
   /* documentation is in ftobjs.h */
 
   FT_EXPORT_DEF( FT_Error )
-  FT_New_Stream( const char*  filepathname,
-                 FT_Stream    stream )
+  FT_Stream_Open( FT_Stream    stream,
+                  const char*  filepathname )
   {
     int          file;
     struct stat  stat_buf;
@@ -218,7 +218,7 @@
     file = open( filepathname, O_RDONLY );
     if ( file < 0 )
     {
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not open `%s'\n", filepathname ));
       return FT_Err_Cannot_Open_Resource;
     }
@@ -238,7 +238,7 @@
 
     if ( fstat( file, &stat_buf ) < 0 )
     {
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not `fstat' file `%s'\n", filepathname ));
       goto Fail_Map;
     }
@@ -254,7 +254,7 @@
 
     if ( (long)stream->base == -1 )
     {
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not `mmap' file `%s'\n", filepathname ));
       goto Fail_Map;
     }
@@ -267,7 +267,7 @@
     stream->close = ft_close_stream;
     stream->read  = 0;
 
-    FT_TRACE1(( "FT_New_Stream:" ));
+    FT_TRACE1(( "FT_Stream_Open:" ));
     FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
                 filepathname, stream->size ));
 
@@ -288,13 +288,13 @@
 
   extern FT_Int
   ft_mem_debug_init( FT_Memory  memory );
-  
+
   extern void
   ft_mem_debug_done( FT_Memory  memory );
-  
-#endif  
-      
 
+#endif
+
+
   /* documentation is in ftobjs.h */
 
   FT_EXPORT_DEF( FT_Memory )
@@ -312,7 +312,7 @@
       memory->free    = ft_free;
 #ifdef FT_DEBUG_MEMORY
       ft_mem_debug_init( memory );
-#endif    
+#endif
     }
 
     return memory;
@@ -326,7 +326,7 @@
   {
 #ifdef FT_DEBUG_MEMORY
     ft_mem_debug_done( memory );
-#endif  
+#endif
     memory->free( memory, memory );
   }
 
--- a/builds/vms/ftsystem.c
+++ b/builds/vms/ftsystem.c
@@ -204,8 +204,8 @@
   /* documentation is in ftobjs.h */
 
   FT_EXPORT_DEF( FT_Error )
-  FT_New_Stream( const char*  filepathname,
-                 FT_Stream    stream )
+  FT_Stream_Open( FT_Stream    stream,
+                  const char*  filepathname )
   {
     int          file;
     struct stat  stat_buf;
@@ -218,7 +218,7 @@
     file = open( filepathname, O_RDONLY );
     if ( file < 0 )
     {
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not open `%s'\n", filepathname ));
       return FT_Err_Cannot_Open_Resource;
     }
@@ -225,7 +225,7 @@
 
     if ( fstat( file, &stat_buf ) < 0 )
     {
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not `fstat' file `%s'\n", filepathname ));
       goto Fail_Map;
     }
@@ -241,7 +241,7 @@
 
     if ( (long)stream->base == -1 )
     {
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not `mmap' file `%s'\n", filepathname ));
       goto Fail_Map;
     }
@@ -254,7 +254,7 @@
     stream->close = ft_close_stream;
     stream->read  = 0;
 
-    FT_TRACE1(( "FT_New_Stream:" ));
+    FT_TRACE1(( "FT_Stream_Open:" ));
     FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
                 filepathname, stream->size ));
 
@@ -275,13 +275,13 @@
 
   extern FT_Int
   ft_mem_debug_init( FT_Memory  memory );
-  
+
   extern void
   ft_mem_debug_done( FT_Memory  memory );
-  
-#endif  
-      
 
+#endif
+
+
   /* documentation is in ftobjs.h */
 
   FT_EXPORT_DEF( FT_Memory )
@@ -299,7 +299,7 @@
       memory->free    = ft_free;
 #ifdef FT_DEBUG_MEMORY
       ft_mem_debug_init( memory );
-#endif    
+#endif
     }
 
     return memory;
@@ -313,7 +313,7 @@
   {
 #ifdef FT_DEBUG_MEMORY
     ft_mem_debug_done( memory );
-#endif  
+#endif
     memory->free( memory, memory );
   }
 
--- a/include/freetype/ftsystem.h
+++ b/include/freetype/ftsystem.h
@@ -197,7 +197,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* @functype:                                                            */
-  /*    FT_Stream_IO                                                       */
+  /*    FT_Stream_IoFunc                                                   */
   /*                                                                       */
   /* @description:                                                         */
   /*    A function used to seek and read data from a given input stream.   */
@@ -219,16 +219,16 @@
   /*    with a `count' of 0.                                               */
   /*                                                                       */
   typedef unsigned long
-  (*FT_Stream_IO)( FT_Stream       stream,
-                   unsigned long   offset,
-                   unsigned char*  buffer,
-                   unsigned long   count );
+  (*FT_Stream_IoFunc)( FT_Stream       stream,
+                       unsigned long   offset,
+                       unsigned char*  buffer,
+                       unsigned long   count );
 
 
   /*************************************************************************/
   /*                                                                       */
   /* @functype:                                                            */
-  /*    FT_Stream_Close                                                    */
+  /*    FT_Stream_CloseFunc                                                */
   /*                                                                       */
   /* @description:                                                         */
   /*    A function used to close a given input stream.                     */
@@ -237,7 +237,7 @@
   /*   stream :: A handle to the target stream.                            */
   /*                                                                       */
   typedef void
-  (*FT_Stream_Close)( FT_Stream  stream );
+  (*FT_Stream_CloseFunc)( FT_Stream  stream );
 
 
   /*************************************************************************/
@@ -281,18 +281,18 @@
   /*                                                                       */
   struct  FT_StreamRec_
   {
-    unsigned char*   base;
-    unsigned long    size;
-    unsigned long    pos;
+    unsigned char*       base;
+    unsigned long        size;
+    unsigned long        pos;
 
-    FT_StreamDesc    descriptor;
-    FT_StreamDesc    pathname;
-    FT_Stream_IO     read;
-    FT_Stream_Close  close;
+    FT_StreamDesc        descriptor;
+    FT_StreamDesc        pathname;
+    FT_Stream_IoFunc     read;
+    FT_Stream_CloseFunc  close;
 
-    FT_Memory        memory;
-    unsigned char*   cursor;
-    unsigned char*   limit;
+    FT_Memory            memory;
+    unsigned char*       cursor;
+    unsigned char*       limit;
   };
 
 
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -638,43 +638,6 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    FT_New_Stream                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Creates a new stream object.                                       */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    filepathname :: The name of the stream (usually a file) to be      */
-  /*                    opened.                                            */
-  /*                                                                       */
-  /*    stream       :: A pointer to the stream object.                    */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
-  FT_EXPORT( FT_Error )
-  FT_New_Stream( const char*  filepathname,
-                 FT_Stream    astream );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    FT_Done_Stream                                                     */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Closes and destroys a stream object.                               */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    stream :: The stream to be closed and destroyed.                   */
-  /*                                                                       */
-  FT_EXPORT( void )
-  FT_Done_Stream( FT_Stream  stream );
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
   /*    FT_New_Memory                                                      */
   /*                                                                       */
   /* <Description>                                                         */
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -27,6 +27,15 @@
 FT_BEGIN_HEADER
 
 
+
+
+
+
+
+
+
+
+
   /* format of an 8-bit frame_op value = [ xxxxx | e | s ] */
   /* s is set to 1 if the value is signed,                 */
   /* e is set to 1 if the value is little-endian           */
@@ -258,174 +267,234 @@
 
 #define GET_Char()      FT_GET_MACRO( FT_Get_Char, FT_Char )
 #define GET_Byte()      FT_GET_MACRO( FT_Get_Char, FT_Byte )
-#define GET_Short()     FT_GET_MACRO( FT_Get_Short, FT_Short )
-#define GET_UShort()    FT_GET_MACRO( FT_Get_Short, FT_UShort )
-#define GET_Offset()    FT_GET_MACRO( FT_Get_Offset, FT_Long )
-#define GET_UOffset()   FT_GET_MACRO( FT_Get_Offset, FT_ULong )
-#define GET_Long()      FT_GET_MACRO( FT_Get_Long, FT_Long )
-#define GET_ULong()     FT_GET_MACRO( FT_Get_Long, FT_ULong )
-#define GET_Tag4()      FT_GET_MACRO( FT_Get_Long, FT_ULong )
+#define GET_Short()     FT_GET_MACRO( FT_Stream_Get_Short, FT_Short )
+#define GET_UShort()    FT_GET_MACRO( FT_Stream_Get_Short, FT_UShort )
+#define GET_Offset()    FT_GET_MACRO( FT_Stream_Get_Offset, FT_Long )
+#define GET_UOffset()   FT_GET_MACRO( FT_Stream_Get_Offset, FT_ULong )
+#define GET_Long()      FT_GET_MACRO( FT_Stream_Get_Long, FT_Long )
+#define GET_ULong()     FT_GET_MACRO( FT_Stream_Get_Long, FT_ULong )
+#define GET_Tag4()      FT_GET_MACRO( FT_Stream_Get_Long, FT_ULong )
 
-#define GET_ShortLE()   FT_GET_MACRO( FT_Get_ShortLE, FT_Short )
-#define GET_UShortLE()  FT_GET_MACRO( FT_Get_ShortLE, FT_UShort )
-#define GET_LongLE()    FT_GET_MACRO( FT_Get_LongLE, FT_Long )
-#define GET_ULongLE()   FT_GET_MACRO( FT_Get_LongLE, FT_ULong )
+#define GET_ShortLE()   FT_GET_MACRO( FT_Stream_Get_ShortLE, FT_Short )
+#define GET_UShortLE()  FT_GET_MACRO( FT_Stream_Get_ShortLE, FT_UShort )
+#define GET_LongLE()    FT_GET_MACRO( FT_Stream_Get_LongLE, FT_Long )
+#define GET_ULongLE()   FT_GET_MACRO( FT_Stream_Get_LongLE, FT_ULong )
 
 #define FT_READ_MACRO( func, type, var )        \
           ( var = (type)func( stream, &error ), \
             error != FT_Err_Ok )
 
-#define READ_Byte( var )      FT_READ_MACRO( FT_Read_Char, FT_Byte, var )
-#define READ_Char( var )      FT_READ_MACRO( FT_Read_Char, FT_Char, var )
-#define READ_Short( var )     FT_READ_MACRO( FT_Read_Short, FT_Short, var )
-#define READ_UShort( var )    FT_READ_MACRO( FT_Read_Short, FT_UShort, var )
-#define READ_Offset( var )    FT_READ_MACRO( FT_Read_Offset, FT_Long, var )
-#define READ_UOffset( var )   FT_READ_MACRO( FT_Read_Offset, FT_ULong, var )
-#define READ_Long( var )      FT_READ_MACRO( FT_Read_Long, FT_Long, var )
-#define READ_ULong( var )     FT_READ_MACRO( FT_Read_Long, FT_ULong, var )
+#define READ_Byte( var )      FT_READ_MACRO( FT_Stream_Read_Char, FT_Byte, var )
+#define READ_Char( var )      FT_READ_MACRO( FT_Stream_Read_Char, FT_Char, var )
+#define READ_Short( var )     FT_READ_MACRO( FT_Stream_Read_Short, FT_Short, var )
+#define READ_UShort( var )    FT_READ_MACRO( FT_Stream_Read_Short, FT_UShort, var )
+#define READ_Offset( var )    FT_READ_MACRO( FT_Stream_Read_Offset, FT_Long, var )
+#define READ_UOffset( var )   FT_READ_MACRO( FT_Stream_Read_Offset, FT_ULong, var )
+#define READ_Long( var )      FT_READ_MACRO( FT_Stream_Read_Long, FT_Long, var )
+#define READ_ULong( var )     FT_READ_MACRO( FT_Stream_Read_Long, FT_ULong, var )
 
-#define READ_ShortLE( var )   FT_READ_MACRO( FT_Read_ShortLE, FT_Short, var )
-#define READ_UShortLE( var )  FT_READ_MACRO( FT_Read_ShortLE, FT_UShort, var )
-#define READ_LongLE( var )    FT_READ_MACRO( FT_Read_LongLE, FT_Long, var )
-#define READ_ULongLE( var )   FT_READ_MACRO( FT_Read_LongLE, FT_ULong, var )
+#define READ_ShortLE( var )   FT_READ_MACRO( FT_Stream_Read_ShortLE, FT_Short, var )
+#define READ_UShortLE( var )  FT_READ_MACRO( FT_Stream_Read_ShortLE, FT_UShort, var )
+#define READ_LongLE( var )    FT_READ_MACRO( FT_Stream_Read_LongLE, FT_Long, var )
+#define READ_ULongLE( var )   FT_READ_MACRO( FT_Stream_Read_LongLE, FT_ULong, var )
 
 
+
+
+#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
+
+ /* initialize a stream for reading a regular system stream */
+  FT_EXPORT( FT_Error )
+  FT_Stream_Open( FT_Stream    stream,
+                  const char*  filepathname );
+
+#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
+
+
+ /* initialize a stream for reading in-memory data */
   FT_BASE( void )
-  FT_New_Memory_Stream( FT_Library  library,
-                        FT_Byte*    base,
-                        FT_ULong    size,
-                        FT_Stream   stream );
+  FT_Stream_Open_Memory( FT_Stream       stream,
+                         const FT_Byte*  base,
+                         FT_ULong        size );
 
+ /* close a stream (does not destroy the stream structure) */
+  FT_BASE( void )
+  FT_Stream_Close( FT_Stream  stream );
+
+
+ /* seek within a stream. position is relative to start of stream */
   FT_BASE( FT_Error )
-  FT_Seek_Stream( FT_Stream  stream,
+  FT_Stream_Seek( FT_Stream  stream,
                   FT_ULong   pos );
 
+ /* skip bytes in a stream */
   FT_BASE( FT_Error )
-  FT_Skip_Stream( FT_Stream  stream,
+  FT_Stream_Skip( FT_Stream  stream,
                   FT_Long    distance );
 
+ /* return current stream position */
   FT_BASE( FT_Long )
   FT_Stream_Pos( FT_Stream  stream );
 
 
+ /* read bytes from a stream into a user-allocated buffer, returns an */
+ /* error if all bytes could not be read..                            */
   FT_BASE( FT_Error )
-  FT_Read_Stream( FT_Stream  stream,
+  FT_Stream_Read( FT_Stream  stream,
                   FT_Byte*   buffer,
                   FT_ULong   count );
 
+ /* read bytes from a stream at a given position */
   FT_BASE( FT_Error )
-  FT_Read_Stream_At( FT_Stream  stream,
+  FT_Stream_Read_At( FT_Stream  stream,
                      FT_ULong   pos,
                      FT_Byte*   buffer,
                      FT_ULong   count );
 
+ /* enter a frame of 'count' consecutive bytes in a stream. returns an */
+ /* error if the frame could not be read/accessed. The caller can use  */
+ /* the FT_Stream_Get_XXX function to retrieve frame data without      */
+ /* error checks..                                                     */
+ /*                                                                    */
+ /* you must _always_ call FT_Stream_Exit_Frame once you've entered    */
+ /* a stream frame !!                                                  */
+ /*                                                                    */
   FT_BASE( FT_Error )
-  FT_Access_Frame( FT_Stream  stream,
-                   FT_ULong   count );
+  FT_Stream_Enter_Frame( FT_Stream  stream,
+                         FT_ULong   count );
 
+ /* exit a stream frame..                                              */
+ /*                                                                    */
   FT_BASE( void )
-  FT_Forget_Frame( FT_Stream  stream );
+  FT_Stream_Exit_Frame( FT_Stream  stream );
 
+ /* extract a stream frame. if the stream is disk-based, a heap block  */
+ /* is allocated and the frame bytes are read into it. if the stream   */
+ /* is memory-based, this function simply set a pointer to the data    */
+ /*                                                                    */
+ /* useful to optimize access to memory-based streams transparently.   */
+ /*                                                                    */
+ /* all extracted frames must be "freed" with a call to the function   */
+ /* FT_Stream_Release_Frame                                            */
+ /*                                                                    */
   FT_BASE( FT_Error )
-  FT_Extract_Frame( FT_Stream  stream,
+  FT_Stream_Extract_Frame( FT_Stream  stream,
                     FT_ULong   count,
                     FT_Byte**  pbytes );
 
+ /* release an extract frame (see FT_Stream_Extract_Frame)             */
+ /*                                                                    */
   FT_BASE( void )
-  FT_Release_Frame( FT_Stream  stream,
+  FT_Stream_Release_Frame( FT_Stream  stream,
                     FT_Byte**  pbytes );
 
+ /* read a byte from an entered frame                                  */
   FT_BASE( FT_Char )
-  FT_Get_Char( FT_Stream  stream );
+  FT_Stream_Get_Char( FT_Stream  stream );
 
+ /* read a 16-bit big-endian integer from an entered frame             */
   FT_BASE( FT_Short )
-  FT_Get_Short( FT_Stream  stream );
+  FT_Stream_Get_Short( FT_Stream  stream );
 
+ /* read a 24-bit big-endian integer from an entered frame             */
   FT_BASE( FT_Long )
-  FT_Get_Offset( FT_Stream  stream );
+  FT_Stream_Get_Offset( FT_Stream  stream );
 
+ /* read a 32-bit big-endian integer from an entered frame             */
   FT_BASE( FT_Long )
-  FT_Get_Long( FT_Stream  stream );
+  FT_Stream_Get_Long( FT_Stream  stream );
 
+ /* read a 16-bit little-endian integer from an entered frame          */
   FT_BASE( FT_Short )
-  FT_Get_ShortLE( FT_Stream  stream );
+  FT_Stream_Get_ShortLE( FT_Stream  stream );
 
+ /* read a 32-bit little-endian integer from an entered frame          */
   FT_BASE( FT_Long )
-  FT_Get_LongLE( FT_Stream  stream );
+  FT_Stream_Get_LongLE( FT_Stream  stream );
 
 
+ /* read a byte from a stream                                          */
   FT_BASE( FT_Char )
-  FT_Read_Char( FT_Stream  stream,
-                FT_Error*  error );
+  FT_Stream_Read_Char( FT_Stream  stream,
+                       FT_Error*  error );
 
+ /* read a 16-bit big-endian integer from a stream                     */
   FT_BASE( FT_Short )
-  FT_Read_Short( FT_Stream  stream,
-                 FT_Error*  error );
+  FT_Stream_Read_Short( FT_Stream  stream,
+                        FT_Error*  error );
 
+ /* read a 24-bit big-endian integer from a stream                     */
   FT_BASE( FT_Long )
-  FT_Read_Offset( FT_Stream  stream,
-                  FT_Error*  error );
+  FT_Stream_Read_Offset( FT_Stream  stream,
+                         FT_Error*  error );
 
+ /* read a 32-bit big-endian integer from a stream                     */
   FT_BASE( FT_Long )
-  FT_Read_Long( FT_Stream  stream,
-                FT_Error*  error );
+  FT_Stream_Read_Long( FT_Stream  stream,
+                       FT_Error*  error );
 
+ /* read a 16-bit little-endian integer from a stream                  */
   FT_BASE( FT_Short )
-  FT_Read_ShortLE( FT_Stream  stream,
-                   FT_Error*  error );
+  FT_Stream_Read_ShortLE( FT_Stream  stream,
+                          FT_Error*  error );
 
+ /* read a 32-bit little-endian integer from a stream                  */
   FT_BASE( FT_Long )
-  FT_Read_LongLE( FT_Stream  stream,
-                  FT_Error*  error );
+  FT_Stream_Read_LongLE( FT_Stream  stream,
+                         FT_Error*  error );
 
+ /* read a structure from a stream. The structure must be described    */
+ /* by an array of FT_Frame_Field records..                            */
   FT_BASE( FT_Error )
-  FT_Read_Fields( FT_Stream              stream,
-                  const FT_Frame_Field*  fields,
-                  void*                  structure );
+  FT_Stream_Read_Fields( FT_Stream              stream,
+                         const FT_Frame_Field*  fields,
+                         void*                  structure );
 
 
+
+
 #define USE_Stream( resource, stream )                       \
           FT_SET_ERROR( FT_Open_Stream( resource, stream ) )
 
 #define DONE_Stream( stream )      \
-          FT_Done_Stream( stream )
+          FT_Stream_Close( stream )
 
 
 #define ACCESS_Frame( size )                              \
-          FT_SET_ERROR( FT_Access_Frame( stream, size ) )
+          FT_SET_ERROR( FT_Stream_Enter_Frame( stream, size ) )
 
 #define FORGET_Frame()              \
-          FT_Forget_Frame( stream )
+          FT_Stream_Exit_Frame( stream )
 
 #define EXTRACT_Frame( size, bytes )                              \
-          FT_SET_ERROR( FT_Extract_Frame( stream, size,           \
+          FT_SET_ERROR( FT_Stream_Extract_Frame( stream, size,           \
                                           (FT_Byte**)&(bytes) ) )
 
 #define RELEASE_Frame( bytes )                            \
-          FT_Release_Frame( stream, (FT_Byte**)&(bytes) )
+          FT_Stream_Release_Frame( stream, (FT_Byte**)&(bytes) )
 
 #define FILE_Seek( position )                                \
-          FT_SET_ERROR( FT_Seek_Stream( stream, position ) )
+          FT_SET_ERROR( FT_Stream_Seek( stream, position ) )
 
 #define FILE_Skip( distance )                                \
-          FT_SET_ERROR( FT_Skip_Stream( stream, distance ) )
+          FT_SET_ERROR( FT_Stream_Skip( stream, distance ) )
 
 #define FILE_Pos()                \
           FT_Stream_Pos( stream )
 
 #define FILE_Read( buffer, count )                        \
-          FT_SET_ERROR( FT_Read_Stream( stream,           \
+          FT_SET_ERROR( FT_Stream_Read( stream,           \
                                         (FT_Byte*)buffer, \
                                         count ) )
 
 #define FILE_Read_At( position, buffer, count )              \
-          FT_SET_ERROR( FT_Read_Stream_At( stream,           \
+          FT_SET_ERROR( FT_Stream_Read_At( stream,           \
                                            position,         \
                                            (FT_Byte*)buffer, \
                                            count ) )
 
 #define READ_Fields( fields, object )  \
-        ( ( error = FT_Read_Fields( stream, fields, object ) ) != FT_Err_Ok )
+        ( ( error = FT_Stream_Read_Fields( stream, fields, object ) ) != FT_Err_Ok )
 
 
 FT_END_HEADER
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -10,8 +10,8 @@
 
   if $(FT2_MULTI)
   {
-    _sources = ftcalc ftgloadr ftlist ftobjs ftstream ftoutln ftnames fttrigon
-               ftdbgmem ;
+    _sources = ftutil ftdbgmem ftstream ftcalc fttrigon ftgloadr ftoutln
+               ftobjs ftnames ;
   }
   else
   {
--- a/src/base/ftapi.c
+++ b/src/base/ftapi.c
@@ -2011,7 +2011,7 @@
 
 
   FT_BASE_DEF( void )
-  FT_New_Memory_Stream( FT_Library  library,
+  FT_Stream_OpenMemory( FT_Library  library,
                         FT_Byte*    base,
                         FT_ULong    size,
                         FT_Stream   stream )
@@ -2021,7 +2021,7 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Seek_Stream( FT_Stream  stream,
+  FT_Stream_Seek( FT_Stream  stream,
                   FT_ULong   pos )
   {
     return FT_Stream_Seek( stream, pos );
@@ -2029,7 +2029,7 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Skip_Stream( FT_Stream  stream,
+  FT_Stream_Skip( FT_Stream  stream,
                   FT_Long    distance )
   {
     return FT_Stream_Skip( stream, distance );
@@ -2037,7 +2037,7 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Read_Stream( FT_Stream  stream,
+  FT_Stream_Read( FT_Stream  stream,
                   FT_Byte*   buffer,
                   FT_ULong   count )
   {
@@ -2046,7 +2046,7 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Read_Stream_At( FT_Stream  stream,
+  FT_Stream_Read_At( FT_Stream  stream,
                      FT_ULong   pos,
                      FT_Byte*   buffer,
                      FT_ULong   count )
@@ -2056,7 +2056,7 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Extract_Frame( FT_Stream  stream,
+  FT_Stream_Extract_Frame( FT_Stream  stream,
                     FT_ULong   count,
                     FT_Byte**  pbytes )
   {
@@ -2065,7 +2065,7 @@
 
 
   FT_BASE_DEF( void )
-  FT_Release_Frame( FT_Stream  stream,
+  FT_Stream_Release_Frame( FT_Stream  stream,
                     FT_Byte**  pbytes )
   {
     FT_Stream_Release_Frame( stream, pbytes );
@@ -2072,7 +2072,7 @@
   }                    
 
   FT_BASE_DEF( FT_Error )
-  FT_Access_Frame( FT_Stream  stream,
+  FT_Stream_Enter_Frame( FT_Stream  stream,
                    FT_ULong   count )
   {
     return FT_Stream_Enter_Frame( stream, count );
@@ -2080,7 +2080,7 @@
 
 
   FT_BASE_DEF( void )
-  FT_Forget_Frame( FT_Stream  stream )
+  FT_Stream_Exit_Frame( FT_Stream  stream )
   {
     FT_Stream_Exit_Frame( stream );
   }
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -20,14 +20,14 @@
 
 #define  FT_MAKE_OPTION_SINGLE_OBJECT
 
+#include "ftutil.c"
+#include "ftdbgmem.c"
+#include "ftstream.c"
 #include "ftcalc.c"
 #include "fttrigon.c"
+#include "ftoutln.c"
 #include "ftgloadr.c"
 #include "ftobjs.c"
-#include "ftstream.c"
-#include "ftlist.c"
-#include "ftoutln.c"
 #include "ftnames.c"
-#include "ftdbgmem.c"
 
 /* END */
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -465,7 +465,7 @@
       if ( ALLOC( stream, sizeof ( *stream ) ) )
         goto Exit;
 
-      FT_New_Memory_Stream( library,
+      FT_Stream_OpenMemory( library,
                             base,
                             size,
                             stream );
@@ -518,7 +518,7 @@
       (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
     else
     {
-      FT_Done_Stream( stream );
+      FT_Stream_Close( stream );
       FREE( stream );
     }
     return error;
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -33,121 +33,6 @@
   /*************************************************************************/
   /****                                                                 ****/
   /****                                                                 ****/
-  /****                           M E M O R Y                           ****/
-  /****                                                                 ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
-  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
-  /* messages during execution.                                            */
-  /*                                                                       */
-#undef  FT_COMPONENT
-#define FT_COMPONENT  trace_memory
-
-
-  /* documentation is in ftmemory.h */
-
-  FT_BASE_DEF( FT_Error )
-  FT_Alloc( FT_Memory  memory,
-            FT_Long    size,
-            void*     *P )
-  {
-    FT_ASSERT( P != 0 );
-
-    if ( size > 0 )
-    {
-      *P = memory->alloc( memory, size );
-      if ( !*P )
-      {
-        FT_ERROR(( "FT_Alloc:" ));
-        FT_ERROR(( " Out of memory? (%ld requested)\n",
-                   size ));
-
-        return FT_Err_Out_Of_Memory;
-      }
-      MEM_Set( *P, 0, size );
-    }
-    else
-      *P = NULL;
-
-    FT_TRACE7(( "FT_Alloc:" ));
-    FT_TRACE7(( " size = %ld, block = 0x%08p, ref = 0x%08p\n",
-                size, *P, P ));
-
-    return FT_Err_Ok;
-  }
-
-
-  /* documentation is in ftmemory.h */
-
-  FT_BASE_DEF( FT_Error )
-  FT_Realloc( FT_Memory  memory,
-              FT_Long    current,
-              FT_Long    size,
-              void**     P )
-  {
-    void*  Q;
-
-
-    FT_ASSERT( P != 0 );
-
-    /* if the original pointer is NULL, call FT_Alloc() */
-    if ( !*P )
-      return FT_Alloc( memory, size, P );
-
-    /* if the new block if zero-sized, clear the current one */
-    if ( size <= 0 )
-    {
-      FT_Free( memory, P );
-      return FT_Err_Ok;
-    }
-
-    Q = memory->realloc( memory, current, size, *P );
-    if ( !Q )
-      goto Fail;
-
-    if ( size > current )
-      memset( (char*)Q + current, 0, size - current );
-
-    *P = Q;
-    return FT_Err_Ok;
-
-  Fail:
-    FT_ERROR(( "FT_Realloc:" ));
-    FT_ERROR(( " Failed (current %ld, requested %ld)\n",
-               current, size ));
-    return FT_Err_Out_Of_Memory;
-  }
-
-
-  /* documentation is in ftmemory.h */
-
-  FT_BASE_DEF( void )
-  FT_Free( FT_Memory  memory,
-           void**     P )
-  {
-    FT_TRACE7(( "FT_Free:" ));
-    FT_TRACE7(( " Freeing block 0x%08p, ref 0x%08p\n",
-                P, P ? *P : (void*)0 ));
-
-    if ( P && *P )
-    {
-      memory->free( memory, *P );
-      *P = 0;
-    }
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****                                                                 ****/
   /****                           S T R E A M                           ****/
   /****                                                                 ****/
   /****                                                                 ****/
@@ -156,19 +41,10 @@
   /*************************************************************************/
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    ft_new_input_stream                                                */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Creates a new input stream object from an FT_Open_Args structure.  */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The function expects a valid `astream' parameter.                  */
-  /*                                                                       */
+ /* create a new input stream from a FT_Open_Args structure */
+ /*                                                         */
   static FT_Error
-  ft_new_input_stream( FT_Library     library,
+  ft_input_stream_new( FT_Library     library,
                        FT_Open_Args*  args,
                        FT_Stream*     astream )
   {
@@ -190,22 +66,23 @@
 
     stream->memory = memory;
 
-    /* now, look at the stream flags */
     if ( args->flags & ft_open_memory )
     {
-      error = 0;
-      FT_New_Memory_Stream( library,
+      /* create a memory-based stream */
+      FT_Stream_Open_Memory( stream,
                             (FT_Byte*)args->memory_base,
-                            args->memory_size,
-                            stream );
+                            args->memory_size );
     }
     else if ( args->flags & ft_open_pathname )
     {
-      error = FT_New_Stream( args->pathname, stream );
+      /* create a normal system stream */
+      error = FT_Stream_Open( stream, args->pathname );
       stream->pathname.pointer = args->pathname;
     }
     else if ( ( args->flags & ft_open_stream ) && args->stream )
     {
+      /* use an existing, user-provided stream */
+
       /* in this case, we do not need to allocate a new stream object */
       /* since the caller is responsible for closing it himself       */
       FREE( stream );
@@ -216,6 +93,8 @@
 
     if ( error )
       FREE( stream );
+    else
+      stream->memory = memory;  /* just to be certain */
 
     *astream = stream;
 
@@ -224,37 +103,20 @@
   }
 
 
-  /* documentation is in ftobjs.h */
 
-  FT_EXPORT_DEF( void )
-  FT_Done_Stream( FT_Stream  stream )
-  {
-    if ( stream && stream->close )
-    {
-      stream->close( stream );
-      stream->close = 0;
-    }
-  }
-
-
   static void
-  ft_done_stream( FT_Stream*  astream,
-                  FT_Int      external )
+  ft_input_stream_free( FT_Stream  stream,
+                        FT_Int     external )
   {
-    FT_Stream  stream = *astream;
-
-
-    if ( stream->close )
-      stream->close( stream );
-
-    if ( !external )
+    if ( stream )
     {
       FT_Memory  memory = stream->memory;
 
+      FT_Stream_Close( stream );
 
-      FREE( stream );
+      if ( !external )
+        FREE( stream );
     }
-    *astream = 0;
   }
 
 
@@ -262,351 +124,11 @@
 #define FT_COMPONENT  trace_objs
 
 
-#if 0
-
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
   /****                                                                 ****/
-  /****                     G L Y P H   L O A D E R                     ****/
-  /****                                                                 ****/
-  /****                                                                 ****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* The glyph loader is a simple object which is used to load a set of    */
-  /* glyphs easily.  It is critical for the correct loading of composites. */
-  /*                                                                       */
-  /* Ideally, one can see it as a stack of abstract `glyph' objects.       */
-  /*                                                                       */
-  /*   loader.base     Is really the bottom of the stack.  It describes a  */
-  /*                   single glyph image made of the juxtaposition of     */
-  /*                   several glyphs (those `in the stack').              */
-  /*                                                                       */
-  /*   loader.current  Describes the top of the stack, on which a new      */
-  /*                   glyph can be loaded.                                */
-  /*                                                                       */
-  /*   Rewind          Clears the stack.                                   */
-  /*   Prepare         Set up `loader.current' for addition of a new glyph */
-  /*                   image.                                              */
-  /*   Add             Add the `current' glyph image to the `base' one,    */
-  /*                   and prepare for another one.                        */
-  /*                                                                       */
-  /* The glyph loader is now a base object.  Each driver used to           */
-  /* re-implement it in one way or the other, which wasted code and        */
-  /* energy.                                                               */
-  /*                                                                       */
-  /*************************************************************************/
-
-
-  /* create a new glyph loader */
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader_New( FT_Memory         memory,
-                      FT_GlyphLoader*  *aloader )
-  {
-    FT_GlyphLoader*  loader;
-    FT_Error         error;
-
-
-    if ( !ALLOC( loader, sizeof ( *loader ) ) )
-    {
-      loader->memory = memory;
-      *aloader       = loader;
-    }
-    return error;
-  }
-
-
-  /* rewind the glyph loader - reset counters to 0 */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader_Rewind( FT_GlyphLoader*  loader )
-  {
-    FT_GlyphLoad*  base    = &loader->base;
-    FT_GlyphLoad*  current = &loader->current;
-
-
-    base->outline.n_points   = 0;
-    base->outline.n_contours = 0;
-    base->num_subglyphs      = 0;
-
-    *current = *base;
-  }
-
-
-  /* reset the glyph loader, frees all allocated tables */
-  /* and starts from zero                               */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader_Reset( FT_GlyphLoader*  loader )
-  {
-    FT_Memory memory = loader->memory;
-
-
-    FREE( loader->base.outline.points );
-    FREE( loader->base.outline.tags );
-    FREE( loader->base.outline.contours );
-    FREE( loader->base.extra_points );
-    FREE( loader->base.subglyphs );
-
-    loader->max_points    = 0;
-    loader->max_contours  = 0;
-    loader->max_subglyphs = 0;
-
-    FT_GlyphLoader_Rewind( loader );
-  }
-
-
-  /* delete a glyph loader */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader_Done( FT_GlyphLoader*  loader )
-  {
-    if ( loader )
-    {
-      FT_Memory memory = loader->memory;
-
-
-      FT_GlyphLoader_Reset( loader );
-      FREE( loader );
-    }
-  }
-
-
-  /* re-adjust the `current' outline fields */
-  static void
-  FT_GlyphLoader_Adjust_Points( FT_GlyphLoader*  loader )
-  {
-    FT_Outline*  base    = &loader->base.outline;
-    FT_Outline*  current = &loader->current.outline;
-
-
-    current->points   = base->points   + base->n_points;
-    current->tags     = base->tags     + base->n_points;
-    current->contours = base->contours + base->n_contours;
-
-    /* handle extra points table - if any */
-    if ( loader->use_extra )
-      loader->current.extra_points =
-        loader->base.extra_points + base->n_points;
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader_Create_Extra( FT_GlyphLoader*  loader )
-  {
-    FT_Error   error;
-    FT_Memory  memory = loader->memory;
-
-
-    if ( !ALLOC_ARRAY( loader->base.extra_points,
-                       loader->max_points, FT_Vector ) )
-    {
-      loader->use_extra = 1;
-      FT_GlyphLoader_Adjust_Points( loader );
-    }
-    return error;
-  }
-
-
-  /* re-adjust the `current' subglyphs field */
-  static void
-  FT_GlyphLoader_Adjust_Subglyphs( FT_GlyphLoader*  loader )
-  {
-    FT_GlyphLoad* base    = &loader->base;
-    FT_GlyphLoad* current = &loader->current;
-
-
-    current->subglyphs = base->subglyphs + base->num_subglyphs;
-  }
-
-
-  /* Ensure that we can add `n_points' and `n_contours' to our glyph. this */
-  /* function reallocates its outline tables if necessary.  Note that it   */
-  /* DOESN'T change the number of points within the loader!                */
-  /*                                                                       */
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader_Check_Points( FT_GlyphLoader*  loader,
-                               FT_UInt          n_points,
-                               FT_UInt          n_contours )
-  {
-    FT_Memory    memory  = loader->memory;
-    FT_Error     error   = FT_Err_Ok;
-    FT_Outline*  base    = &loader->base.outline;
-    FT_Outline*  current = &loader->current.outline;
-    FT_Bool      adjust  = 1;
-
-    FT_UInt      new_max, old_max;
-
-
-    /* check points & tags */
-    new_max = base->n_points + current->n_points + n_points;
-    old_max = loader->max_points;
-
-    if ( new_max > old_max )
-    {
-      new_max = ( new_max + 7 ) & -8;
-
-      if ( REALLOC_ARRAY( base->points, old_max, new_max, FT_Vector ) ||
-           REALLOC_ARRAY( base->tags,   old_max, new_max, FT_Byte   ) )
-       goto Exit;
-
-      if ( loader->use_extra &&
-           REALLOC_ARRAY( loader->base.extra_points, old_max,
-                          new_max, FT_Vector ) )
-       goto Exit;
-
-      adjust = 1;
-      loader->max_points = new_max;
-    }
-
-    /* check contours */
-    old_max = loader->max_contours;
-    new_max = base->n_contours + current->n_contours +
-              n_contours;
-    if ( new_max > old_max )
-    {
-      new_max = ( new_max + 3 ) & -4;
-      if ( REALLOC_ARRAY( base->contours, old_max, new_max, FT_Short ) )
-        goto Exit;
-
-      adjust = 1;
-      loader->max_contours = new_max;
-    }
-
-    if ( adjust )
-      FT_GlyphLoader_Adjust_Points( loader );
-
-  Exit:
-    return error;
-  }
-
-
-  /* Ensure that we can add `n_subglyphs' to our glyph. this function */
-  /* reallocates its subglyphs table if necessary.  Note that it DOES */
-  /* NOT change the number of subglyphs within the loader!            */
-  /*                                                                  */
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader_Check_Subglyphs( FT_GlyphLoader*  loader,
-                                  FT_UInt          n_subs )
-  {
-    FT_Memory  memory = loader->memory;
-    FT_Error   error  = FT_Err_Ok;
-    FT_UInt    new_max, old_max;
-
-    FT_GlyphLoad*  base    = &loader->base;
-    FT_GlyphLoad*  current = &loader->current;
-
-
-    new_max = base->num_subglyphs + current->num_subglyphs + n_subs;
-    old_max = loader->max_subglyphs;
-    if ( new_max > old_max )
-    {
-      new_max = ( new_max + 1 ) & -2;
-      if ( REALLOC_ARRAY( base->subglyphs, old_max, new_max, FT_SubGlyph ) )
-        goto Exit;
-
-      loader->max_subglyphs = new_max;
-
-      FT_GlyphLoader_Adjust_Subglyphs( loader );
-    }
-
-  Exit:
-    return error;
-  }
-
-
-  /* prepare loader for the addition of a new glyph on top of the base one */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader_Prepare( FT_GlyphLoader*  loader )
-  {
-    FT_GlyphLoad*  current = &loader->current;
-
-
-    current->outline.n_points   = 0;
-    current->outline.n_contours = 0;
-    current->num_subglyphs      = 0;
-
-    FT_GlyphLoader_Adjust_Points   ( loader );
-    FT_GlyphLoader_Adjust_Subglyphs( loader );
-  }
-
-
-  /* add current glyph to the base image - and prepare for another */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader_Add( FT_GlyphLoader*  loader )
-  {
-    FT_GlyphLoad*  base    = &loader->base;
-    FT_GlyphLoad*  current = &loader->current;
-
-    FT_UInt        n_curr_contours = current->outline.n_contours;
-    FT_UInt        n_base_points   = base->outline.n_points;
-    FT_UInt        n;
-
-
-    base->outline.n_points =
-      (short)( base->outline.n_points + current->outline.n_points );
-    base->outline.n_contours =
-      (short)( base->outline.n_contours + current->outline.n_contours );
-
-    base->num_subglyphs += current->num_subglyphs;
-
-    /* adjust contours count in newest outline */
-    for ( n = 0; n < n_curr_contours; n++ )
-      current->outline.contours[n] =
-        (short)( current->outline.contours[n] + n_base_points );
-
-    /* prepare for another new glyph image */
-    FT_GlyphLoader_Prepare( loader );
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader_Copy_Points( FT_GlyphLoader*  target,
-                              FT_GlyphLoader*  source )
-  {
-    FT_Error  error;
-    FT_UInt   num_points   = source->base.outline.n_points;
-    FT_UInt   num_contours = source->base.outline.n_contours;
-
-
-    error = FT_GlyphLoader_Check_Points( target, num_points, num_contours );
-    if ( !error )
-    {
-      FT_Outline*  out = &target->base.outline;
-      FT_Outline*  in  = &source->base.outline;
-
-
-      MEM_Copy( out->points, in->points,
-                num_points * sizeof ( FT_Vector ) );
-      MEM_Copy( out->tags, in->tags,
-                num_points * sizeof ( char ) );
-      MEM_Copy( out->contours, in->contours,
-                num_contours * sizeof ( short ) );
-
-      /* do we need to copy the extra points? */
-      if ( target->use_extra && source->use_extra )
-        MEM_Copy( target->base.extra_points, source->base.extra_points,
-                  num_points * sizeof ( FT_Vector ) );
-
-      out->n_points   = (short)num_points;
-      out->n_contours = (short)num_contours;
-
-      FT_GlyphLoader_Adjust_Points( target );
-    }
-
-    return error;
-  }
-
-#endif
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /****                                                                 ****/
-  /****                                                                 ****/
   /****               FACE, SIZE & GLYPH SLOT OBJECTS                   ****/
   /****                                                                 ****/
   /****                                                                 ****/
@@ -1064,10 +586,11 @@
       clazz->done_face( face );
 
     /* close the stream for this face if needed */
-    ft_done_stream(
-      &face->stream,
+    ft_input_stream_free( face->stream,
       ( face->face_flags & FT_FACE_FLAG_EXTERNAL_STREAM ) != 0 );
 
+    face->stream = 0;
+
     /* get rid of it */
     if ( face->internal )
     {
@@ -1225,7 +748,7 @@
 
 
     /* test for valid `library' delayed to */
-    /* ft_new_input_stream()               */
+    /* ft_input_stream_new()               */
 
     if ( !aface || !args )
       return FT_Err_Invalid_Argument;
@@ -1236,7 +759,7 @@
                                args->stream                     );
 
     /* create input stream */
-    error = ft_new_input_stream( library, args, &stream );
+    error = ft_input_stream_new( library, args, &stream );
     if ( error )
       goto Exit;
 
@@ -1269,7 +792,7 @@
       else
         error = FT_Err_Invalid_Handle;
 
-      ft_done_stream( &stream, external_stream );
+      ft_input_stream_free( stream, external_stream );
       goto Fail;
     }
     else
@@ -1310,7 +833,7 @@
       error = FT_Err_Unknown_File_Format;
 
   Fail2:
-      ft_done_stream( &stream, external_stream );
+      ft_input_stream_free( stream, external_stream );
       goto Fail;
     }
 
@@ -1419,7 +942,7 @@
     FT_Driver_Class*  clazz;
 
 
-    /* test for valid `parameters' delayed to ft_new_input_stream() */
+    /* test for valid `parameters' delayed to ft_input_stream_new() */
 
     if ( !face )
       return FT_Err_Invalid_Face_Handle;
@@ -1428,7 +951,7 @@
     if ( !driver )
       return FT_Err_Invalid_Driver_Handle;
 
-    error = ft_new_input_stream( driver->root.library, parameters, &stream );
+    error = ft_input_stream_new( driver->root.library, parameters, &stream );
     if ( error )
       goto Exit;
 
@@ -1441,7 +964,7 @@
       error = clazz->attach_file( face, stream );
 
     /* close the attached stream */
-    ft_done_stream( &stream,
+    ft_input_stream_free( stream,
                     (FT_Bool)( parameters->stream &&
                                ( parameters->flags & ft_open_stream ) ) );
 
@@ -2635,6 +2158,9 @@
 
     if ( !memory )
       return FT_Err_Invalid_Argument;
+
+    /* init debugging support */
+    ft_debug_init();
 
     /* first of all, allocate the library object */
     if ( ALLOC( library, sizeof ( *library ) ) )
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -32,13 +32,11 @@
 
 
   FT_BASE_DEF( void )
-  FT_New_Memory_Stream( FT_Library  library,
-                        FT_Byte*    base,
-                        FT_ULong    size,
-                        FT_Stream   stream )
+  FT_Stream_Open_Memory( FT_Stream       stream,
+                         const FT_Byte*  base,
+                         FT_ULong        size )
   {
-    stream->memory = library->memory;
-    stream->base   = base;
+    stream->base   = (FT_Byte*) base;
     stream->size   = size;
     stream->pos    = 0;
     stream->cursor = 0;
@@ -47,8 +45,19 @@
   }
 
 
+  FT_BASE_DEF( void )
+  FT_Stream_Close( FT_Stream  stream )
+  {
+    if ( stream && stream->close )
+    {
+      stream->close( stream );
+      stream->close = NULL;
+    }
+  }
+
+
   FT_BASE_DEF( FT_Error )
-  FT_Seek_Stream( FT_Stream  stream,
+  FT_Stream_Seek( FT_Stream  stream,
                   FT_ULong   pos )
   {
     FT_Error  error;
@@ -60,7 +69,7 @@
     {
       if ( stream->read( stream, pos, 0, 0 ) )
       {
-        FT_ERROR(( "FT_Seek_Stream:" ));
+        FT_ERROR(( "FT_Stream_Seek:" ));
         FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                    pos, stream->size ));
 
@@ -72,7 +81,7 @@
     /* note that seeking to the first position after the file is valid */
     else if ( pos > stream->size )
     {
-      FT_ERROR(( "FT_Seek_Stream:" ));
+      FT_ERROR(( "FT_Stream_Seek:" ));
       FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                  pos, stream->size ));
 
@@ -87,10 +96,10 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Skip_Stream( FT_Stream  stream,
+  FT_Stream_Skip( FT_Stream  stream,
                   FT_Long    distance )
   {
-    return FT_Seek_Stream( stream, (FT_ULong)( stream->pos + distance ) );
+    return FT_Stream_Seek( stream, (FT_ULong)( stream->pos + distance ) );
   }
 
 
@@ -102,16 +111,16 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Read_Stream( FT_Stream  stream,
+  FT_Stream_Read( FT_Stream  stream,
                   FT_Byte*   buffer,
                   FT_ULong   count )
   {
-    return FT_Read_Stream_At( stream, stream->pos, buffer, count );
+    return FT_Stream_Read_At( stream, stream->pos, buffer, count );
   }
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Read_Stream_At( FT_Stream  stream,
+  FT_Stream_Read_At( FT_Stream  stream,
                      FT_ULong   pos,
                      FT_Byte*   buffer,
                      FT_ULong   count )
@@ -122,7 +131,7 @@
 
     if ( pos >= stream->size )
     {
-      FT_ERROR(( "FT_Read_Stream_At:" ));
+      FT_ERROR(( "FT_Stream_Read_At:" ));
       FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                  pos, stream->size ));
 
@@ -144,7 +153,7 @@
 
     if ( read_bytes < count )
     {
-      FT_ERROR(( "FT_Read_Stream_At:" ));
+      FT_ERROR(( "FT_Stream_Read_At:" ));
       FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n",
                  count, read_bytes ));
 
@@ -156,7 +165,7 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Extract_Frame( FT_Stream  stream,
+  FT_Stream_Extract_Frame( FT_Stream  stream,
                     FT_ULong   count,
                     FT_Byte**  pbytes )
   {
@@ -163,12 +172,12 @@
     FT_Error  error;
 
 
-    error = FT_Access_Frame( stream, count );
+    error = FT_Stream_Enter_Frame( stream, count );
     if ( !error )
     {
       *pbytes = (FT_Byte*)stream->cursor;
 
-      /* equivalent to FT_Forget_Frame(), with no memory block release */
+      /* equivalent to FT_Stream_Exit_Frame(), with no memory block release */
       stream->cursor = 0;
       stream->limit  = 0;
     }
@@ -178,7 +187,7 @@
 
 
   FT_BASE_DEF( void )
-  FT_Release_Frame( FT_Stream  stream,
+  FT_Stream_Release_Frame( FT_Stream  stream,
                     FT_Byte**  pbytes )
   {
     if ( stream->read )
@@ -193,7 +202,7 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Access_Frame( FT_Stream  stream,
+  FT_Stream_Enter_Frame( FT_Stream  stream,
                    FT_ULong   count )
   {
     FT_Error  error = FT_Err_Ok;
@@ -217,7 +226,7 @@
                                  stream->base, count );
       if ( read_bytes < count )
       {
-        FT_ERROR(( "FT_Access_Frame:" ));
+        FT_ERROR(( "FT_Stream_Enter_Frame:" ));
         FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n",
                    count, read_bytes ));
 
@@ -234,7 +243,7 @@
       if ( stream->pos >= stream->size        ||
            stream->pos + count > stream->size )
       {
-        FT_ERROR(( "FT_Access_Frame:" ));
+        FT_ERROR(( "FT_Stream_Enter_Frame:" ));
         FT_ERROR(( " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n",
                    stream->pos, count, stream->size ));
 
@@ -254,7 +263,7 @@
 
 
   FT_BASE_DEF( void )
-  FT_Forget_Frame( FT_Stream  stream )
+  FT_Stream_Exit_Frame( FT_Stream  stream )
   {
     /* IMPORTANT: The assertion stream->cursor != 0 was removed, given    */
     /*            that it is possible to access a frame of length 0 in    */
@@ -263,7 +272,7 @@
     /*                                                                    */
     /*  In this case, the loader code handles the 0-length table          */
     /*  gracefully; however, stream.cursor is really set to 0 by the      */
-    /*  FT_Access_Frame() call, and this is not an error.                 */
+    /*  FT_Stream_Enter_Frame() call, and this is not an error.                 */
     /*                                                                    */
     FT_ASSERT( stream );
 
@@ -296,7 +305,7 @@
 
 
   FT_BASE_DEF( FT_Short )
-  FT_Get_Short( FT_Stream  stream )
+  FT_Stream_Get_Short( FT_Stream  stream )
   {
     FT_Byte*  p;
     FT_Short  result;
@@ -315,7 +324,7 @@
 
 
   FT_BASE_DEF( FT_Short )
-  FT_Get_ShortLE( FT_Stream  stream )
+  FT_Stream_Get_ShortLE( FT_Stream  stream )
   {
     FT_Byte*  p;
     FT_Short  result;
@@ -334,7 +343,7 @@
 
 
   FT_BASE_DEF( FT_Long )
-  FT_Get_Offset( FT_Stream  stream )
+  FT_Stream_Get_Offset( FT_Stream  stream )
   {
     FT_Byte*  p;
     FT_Long   result;
@@ -352,7 +361,7 @@
 
 
   FT_BASE_DEF( FT_Long )
-  FT_Get_Long( FT_Stream  stream )
+  FT_Stream_Get_Long( FT_Stream  stream )
   {
     FT_Byte*  p;
     FT_Long   result;
@@ -370,7 +379,7 @@
 
 
   FT_BASE_DEF( FT_Long )
-  FT_Get_LongLE( FT_Stream  stream )
+  FT_Stream_Get_LongLE( FT_Stream  stream )
   {
     FT_Byte*  p;
     FT_Long   result;
@@ -388,7 +397,7 @@
 
 
   FT_BASE_DEF( FT_Char )
-  FT_Read_Char( FT_Stream  stream,
+  FT_Stream_Read_Char( FT_Stream  stream,
                 FT_Error*  error )
   {
     FT_Byte  result = 0;
@@ -416,7 +425,7 @@
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
-    FT_ERROR(( "FT_Read_Char:" ));
+    FT_ERROR(( "FT_Stream_Read_Char:" ));
     FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
 
@@ -425,8 +434,8 @@
 
 
   FT_BASE_DEF( FT_Short )
-  FT_Read_Short( FT_Stream  stream,
-                 FT_Error*  error )
+  FT_Stream_Read_Short( FT_Stream  stream,
+                        FT_Error*  error )
   {
     FT_Byte   reads[2];
     FT_Byte*  p = 0;
@@ -463,7 +472,7 @@
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
-    FT_ERROR(( "FT_Read_Short:" ));
+    FT_ERROR(( "FT_Stream_Read_Short:" ));
     FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
 
@@ -472,7 +481,7 @@
 
 
   FT_BASE_DEF( FT_Short )
-  FT_Read_ShortLE( FT_Stream  stream,
+  FT_Stream_Read_ShortLE( FT_Stream  stream,
                    FT_Error*  error )
   {
     FT_Byte   reads[2];
@@ -510,7 +519,7 @@
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
-    FT_ERROR(( "FT_Read_Short:" ));
+    FT_ERROR(( "FT_Stream_Read_Short:" ));
     FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
 
@@ -519,7 +528,7 @@
 
 
   FT_BASE_DEF( FT_Long )
-  FT_Read_Offset( FT_Stream  stream,
+  FT_Stream_Read_Offset( FT_Stream  stream,
                   FT_Error*  error )
   {
     FT_Byte   reads[3];
@@ -557,7 +566,7 @@
 
   Fail:
     *error = FT_Err_Invalid_Stream_Operation;
-    FT_ERROR(( "FT_Read_Offset:" ));
+    FT_ERROR(( "FT_Stream_Read_Offset:" ));
     FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
 
@@ -566,7 +575,7 @@
 
 
   FT_BASE_DEF( FT_Long )
-  FT_Read_Long( FT_Stream  stream,
+  FT_Stream_Read_Long( FT_Stream  stream,
                 FT_Error*  error )
   {
     FT_Byte   reads[4];
@@ -603,7 +612,7 @@
     return result;
 
   Fail:
-    FT_ERROR(( "FT_Read_Long:" ));
+    FT_ERROR(( "FT_Stream_Read_Long:" ));
     FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
     *error = FT_Err_Invalid_Stream_Operation;
@@ -613,7 +622,7 @@
 
 
   FT_BASE_DEF( FT_Long )
-  FT_Read_LongLE( FT_Stream  stream,
+  FT_Stream_Read_LongLE( FT_Stream  stream,
                   FT_Error*  error )
   {
     FT_Byte   reads[4];
@@ -650,7 +659,7 @@
     return result;
 
   Fail:
-    FT_ERROR(( "FT_Read_Long:" ));
+    FT_ERROR(( "FT_Stream_Read_Long:" ));
     FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                stream->pos, stream->size ));
     *error = FT_Err_Invalid_Stream_Operation;
@@ -660,9 +669,9 @@
 
 
   FT_BASE_DEF( FT_Error )
-  FT_Read_Fields( FT_Stream              stream,
-                  const FT_Frame_Field*  fields,
-                  void*                  structure )
+  FT_Stream_Read_Fields( FT_Stream              stream,
+                         const FT_Frame_Field*  fields,
+                         void*                  structure )
   {
     FT_Error  error;
     FT_Bool   frame_accessed = 0;
@@ -683,7 +692,7 @@
       switch ( fields->value )
       {
       case ft_frame_start:  /* access a new frame */
-        error = FT_Access_Frame( stream, fields->offset );
+        error = FT_Stream_Enter_Frame( stream, fields->offset );
         if ( error )
           goto Exit;
 
@@ -795,7 +804,7 @@
   Exit:
     /* close the frame if it was opened by this read */
     if ( frame_accessed )
-      FT_Forget_Frame( stream );
+      FT_Stream_Exit_Frame( stream );
 
     return error;
   }
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -158,7 +158,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    ft_close_stream                                                    */
+  /*    ft_ansi_stream_close                                               */
   /*                                                                       */
   /* <Description>                                                         */
   /*    The function to close a stream.                                    */
@@ -167,7 +167,7 @@
   /*    stream :: A pointer to the stream object.                          */
   /*                                                                       */
   FT_CALLBACK_DEF( void )
-  ft_close_stream( FT_Stream  stream )
+  ft_ansi_stream_close( FT_Stream  stream )
   {
     fclose( STREAM_FILE( stream ) );
 
@@ -180,7 +180,7 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
-  /*    ft_io_stream                                                       */
+  /*    ft_ansi_stream_io                                                  */
   /*                                                                       */
   /* <Description>                                                         */
   /*    The function to open a stream.                                     */
@@ -198,10 +198,10 @@
   /*    The number of bytes actually read.                                 */
   /*                                                                       */
   FT_CALLBACK_DEF( unsigned long )
-  ft_io_stream( FT_Stream       stream,
-                unsigned long   offset,
-                unsigned char*  buffer,
-                unsigned long   count )
+  ft_ansi_stream_io( FT_Stream       stream,
+                     unsigned long   offset,
+                     unsigned char*  buffer,
+                     unsigned long   count )
   {
     FILE*  file;
 
@@ -217,19 +217,19 @@
   /* documentation is in ftobjs.h */
 
   FT_EXPORT_DEF( FT_Error )
-  FT_New_Stream( const char*  filepathname,
-                 FT_Stream    astream )
+  FT_Stream_Open( FT_Stream    stream,
+                  const char*  filepathname )
   {
     FILE*  file;
 
 
-    if ( !astream )
+    if ( !stream )
       return FT_Err_Invalid_Stream_Handle;
 
     file = fopen( filepathname, "rb" );
     if ( !file )
     {
-      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( "FT_Stream_Open:" ));
       FT_ERROR(( " could not open `%s'\n", filepathname ));
 
       return FT_Err_Cannot_Open_Resource;
@@ -236,19 +236,19 @@
     }
 
     fseek( file, 0, SEEK_END );
-    astream->size = ftell( file );
+    stream->size = ftell( file );
     fseek( file, 0, SEEK_SET );
 
-    astream->descriptor.pointer = file;
-    astream->pathname.pointer   = (char*)filepathname;
-    astream->pos                = 0;
+    stream->descriptor.pointer = file;
+    stream->pathname.pointer   = (char*)filepathname;
+    stream->pos                = 0;
 
-    astream->read  = ft_io_stream;
-    astream->close = ft_close_stream;
+    stream->read  = ft_ansi_stream_io;
+    stream->close = ft_ansi_stream_close;
 
-    FT_TRACE1(( "FT_New_Stream:" ));
+    FT_TRACE1(( "FT_Stream_Open:" ));
     FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
-                filepathname, astream->size ));
+                filepathname, stream->size ));
 
     return FT_Err_Ok;
   }
@@ -259,13 +259,13 @@
 
   extern FT_Int
   ft_mem_debug_init( FT_Memory  memory );
-  
+
   extern void
   ft_mem_debug_done( FT_Memory  memory );
-  
-#endif  
-      
-      
+
+#endif
+
+
   /* documentation is in ftobjs.h */
 
   FT_EXPORT_DEF( FT_Memory )
@@ -283,7 +283,7 @@
       memory->free    = ft_free;
 #ifdef FT_DEBUG_MEMORY
       ft_mem_debug_init( memory );
-#endif    
+#endif
     }
 
     return memory;
@@ -297,7 +297,7 @@
   {
 #ifdef FT_DEBUG_MEMORY
     ft_mem_debug_done( memory );
-#endif  
+#endif
     memory->free( memory, memory );
   }
 
--- a/src/base/ftutil.c
+++ b/src/base/ftutil.c
@@ -1,6 +1,7 @@
 #include <ft2build.h>
 #include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_UTIL_H
+#include FT_INTERNAL_MEMORY_H
+#include FT_LIST_H
 
 
   /*************************************************************************/
@@ -32,7 +33,7 @@
             FT_Long    size,
             void*     *P )
   {
-    FT_Assert( P != 0 );
+    FT_ASSERT( P != 0 );
 
     if ( size > 0 )
     {
@@ -69,7 +70,7 @@
     void*  Q;
 
 
-    FT_Assert( P != 0 );
+    FT_ASSERT( P != 0 );
 
     /* if the original pointer is NULL, call FT_Alloc() */
     if ( !*P )
@@ -307,456 +308,4 @@
     list->tail = 0;
   }
 
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                                                               *****/
-  /*****                    G L Y P H   L O A D E R                    *****/
-  /*****                                                               *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* The glyph loader is a simple object which is used to load a set of    */
-  /* glyphs easily.  It is critical for the correct loading of composites. */
-  /*                                                                       */
-  /* Ideally, one can see it as a stack of abstract `glyph' objects.       */
-  /*                                                                       */
-  /*   loader.base     Is really the bottom of the stack.  It describes a  */
-  /*                   single glyph image made of the juxtaposition of     */
-  /*                   several glyphs (those `in the stack').              */
-  /*                                                                       */
-  /*   loader.current  Describes the top of the stack, on which a new      */
-  /*                   glyph can be loaded.                                */
-  /*                                                                       */
-  /*   Rewind          Clears the stack.                                   */
-  /*   Prepare         Set up `loader.current' for addition of a new glyph */
-  /*                   image.                                              */
-  /*   Add             Add the `current' glyph image to the `base' one,    */
-  /*                   and prepare for another one.                        */
-  /*                                                                       */
-  /* The glyph loader is now a base object.  Each driver used to           */
-  /* re-implement it in one way or the other, which wasted code and        */
-  /* energy.                                                               */
-  /*                                                                       */
-  /*************************************************************************/
-
-
-  /* create a new glyph loader */
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader _New( FT_Memory         memory,
-                      FT_GlyphLoader   *aloader )
-  {
-    FT_GlyphLoader   loader;
-    FT_Error         error;
-
-
-    if ( !ALLOC( loader, sizeof ( *loader ) ) )
-    {
-      loader->memory = memory;
-      *aloader       = loader;
-    }
-    return error;
-  }
-
-
-  /* rewind the glyph loader - reset counters to 0 */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader _Rewind( FT_GlyphLoader   loader )
-  {
-    FT_GlyphLoad*  base    = &loader->base;
-    FT_GlyphLoad*  current = &loader->current;
-
-
-    base->outline.n_points   = 0;
-    base->outline.n_contours = 0;
-    base->num_subglyphs      = 0;
-
-    *current = *base;
-  }
-
-
-  /* reset the glyph loader, frees all allocated tables */
-  /* and starts from zero                               */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader _Reset( FT_GlyphLoader   loader )
-  {
-    FT_Memory memory = loader->memory;
-
-
-    FREE( loader->base.outline.points );
-    FREE( loader->base.outline.tags );
-    FREE( loader->base.outline.contours );
-    FREE( loader->base.extra_points );
-    FREE( loader->base.subglyphs );
-
-    loader->max_points    = 0;
-    loader->max_contours  = 0;
-    loader->max_subglyphs = 0;
-
-    FT_GlyphLoader _Rewind( loader );
-  }
-
-
-  /* delete a glyph loader */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader _Done( FT_GlyphLoader   loader )
-  {
-    if ( loader )
-    {
-      FT_Memory memory = loader->memory;
-
-
-      FT_GlyphLoader _Reset( loader );
-      FREE( loader );
-    }
-  }
-
-
-  /* re-adjust the `current' outline fields */
-  static void
-  FT_GlyphLoader _Adjust_Points( FT_GlyphLoader   loader )
-  {
-    FT_Outline*  base    = &loader->base.outline;
-    FT_Outline*  current = &loader->current.outline;
-
-
-    current->points   = base->points   + base->n_points;
-    current->tags     = base->tags     + base->n_points;
-    current->contours = base->contours + base->n_contours;
-
-    /* handle extra points table - if any */
-    if ( loader->use_extra )
-      loader->current.extra_points =
-        loader->base.extra_points + base->n_points;
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader _Create_Extra( FT_GlyphLoader   loader )
-  {
-    FT_Error   error;
-    FT_Memory  memory = loader->memory;
-
-
-    if ( !ALLOC_ARRAY( loader->base.extra_points,
-                       loader->max_points, FT_Vector ) )
-    {
-      loader->use_extra = 1;
-      FT_GlyphLoader _Adjust_Points( loader );
-    }
-    return error;
-  }
-
-
-  /* re-adjust the `current' subglyphs field */
-  static void
-  FT_GlyphLoader _Adjust_Subglyphs( FT_GlyphLoader   loader )
-  {
-    FT_GlyphLoad* base    = &loader->base;
-    FT_GlyphLoad* current = &loader->current;
-
-
-    current->subglyphs = base->subglyphs + base->num_subglyphs;
-  }
-
-
-  /* Ensure that we can add `n_points' and `n_contours' to our glyph. this */
-  /* function reallocates its outline tables if necessary.  Note that it   */
-  /* DOESN'T change the number of points within the loader!                */
-  /*                                                                       */
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader _Check_Points( FT_GlyphLoader   loader,
-                               FT_UInt          n_points,
-                               FT_UInt          n_contours )
-  {
-    FT_Memory    memory  = loader->memory;
-    FT_Error     error   = FT_Err_Ok;
-    FT_Outline*  base    = &loader->base.outline;
-    FT_Outline*  current = &loader->current.outline;
-    FT_Bool      adjust  = 1;
-
-    FT_UInt      new_max, old_max;
-
-
-    /* check points & tags */
-    new_max = base->n_points + current->n_points + n_points;
-    old_max = loader->max_points;
-
-    if ( new_max > old_max )
-    {
-      new_max = ( new_max + 7 ) & -8;
-
-      if ( REALLOC_ARRAY( base->points, old_max, new_max, FT_Vector ) ||
-           REALLOC_ARRAY( base->tags,   old_max, new_max, FT_Byte   ) )
-       goto Exit;
-
-      if ( loader->use_extra &&
-           REALLOC_ARRAY( loader->base.extra_points, old_max,
-                          new_max, FT_Vector ) )
-       goto Exit;
-
-      adjust = 1;
-      loader->max_points = new_max;
-    }
-
-    /* check contours */
-    old_max = loader->max_contours;
-    new_max = base->n_contours + current->n_contours +
-              n_contours;
-    if ( new_max > old_max )
-    {
-      new_max = ( new_max + 3 ) & -4;
-      if ( REALLOC_ARRAY( base->contours, old_max, new_max, FT_Short ) )
-        goto Exit;
-
-      adjust = 1;
-      loader->max_contours = new_max;
-    }
-
-    if ( adjust )
-      FT_GlyphLoader _Adjust_Points( loader );
-
-  Exit:
-    return error;
-  }
-
-
-  /* Ensure that we can add `n_subglyphs' to our glyph. this function */
-  /* reallocates its subglyphs table if necessary.  Note that it DOES */
-  /* NOT change the number of subglyphs within the loader!            */
-  /*                                                                  */
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader _Check_Subglyphs( FT_GlyphLoader   loader,
-                                  FT_UInt          n_subs )
-  {
-    FT_Memory  memory = loader->memory;
-    FT_Error   error  = FT_Err_Ok;
-    FT_UInt    new_max, old_max;
-
-    FT_GlyphLoad*  base    = &loader->base;
-    FT_GlyphLoad*  current = &loader->current;
-
-
-    new_max = base->num_subglyphs + current->num_subglyphs + n_subs;
-    old_max = loader->max_subglyphs;
-    if ( new_max > old_max )
-    {
-      new_max = ( new_max + 1 ) & -2;
-      if ( REALLOC_ARRAY( base->subglyphs, old_max, new_max, FT_SubGlyph ) )
-        goto Exit;
-
-      loader->max_subglyphs = new_max;
-
-      FT_GlyphLoader _Adjust_Subglyphs( loader );
-    }
-
-  Exit:
-    return error;
-  }
-
-
-  /* prepare loader for the addition of a new glyph on top of the base one */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader _Prepare( FT_GlyphLoader   loader )
-  {
-    FT_GlyphLoad*  current = &loader->current;
-
-
-    current->outline.n_points   = 0;
-    current->outline.n_contours = 0;
-    current->num_subglyphs      = 0;
-
-    FT_GlyphLoader _Adjust_Points   ( loader );
-    FT_GlyphLoader _Adjust_Subglyphs( loader );
-  }
-
-
-  /* add current glyph to the base image - and prepare for another */
-  FT_BASE_DEF( void )
-  FT_GlyphLoader _Add( FT_GlyphLoader   loader )
-  {
-    FT_GlyphLoad*  base    = &loader->base;
-    FT_GlyphLoad*  current = &loader->current;
-
-    FT_UInt        n_curr_contours = current->outline.n_contours;
-    FT_UInt        n_base_points   = base->outline.n_points;
-    FT_UInt        n;
-
-
-    base->outline.n_points =
-      (short)( base->outline.n_points + current->outline.n_points );
-    base->outline.n_contours =
-      (short)( base->outline.n_contours + current->outline.n_contours );
-
-    base->num_subglyphs += current->num_subglyphs;
-
-    /* adjust contours count in newest outline */
-    for ( n = 0; n < n_curr_contours; n++ )
-      current->outline.contours[n] =
-        (short)( current->outline.contours[n] + n_base_points );
-
-    /* prepare for another new glyph image */
-    FT_GlyphLoader _Prepare( loader );
-  }
-
-
-  FT_BASE_DEF( FT_Error )
-  FT_GlyphLoader _Copy_Points( FT_GlyphLoader   target,
-                              FT_GlyphLoader   source )
-  {
-    FT_Error  error;
-    FT_UInt   num_points   = source->base.outline.n_points;
-    FT_UInt   num_contours = source->base.outline.n_contours;
-
-
-    error = FT_GlyphLoader _Check_Points( target, num_points, num_contours );
-    if ( !error )
-    {
-      FT_Outline*  out = &target->base.outline;
-      FT_Outline*  in  = &source->base.outline;
-
-
-      MEM_Copy( out->points, in->points,
-                num_points * sizeof ( FT_Vector ) );
-      MEM_Copy( out->tags, in->tags,
-                num_points * sizeof ( char ) );
-      MEM_Copy( out->contours, in->contours,
-                num_contours * sizeof ( short ) );
-
-      /* do we need to copy the extra points? */
-      if ( target->use_extra && source->use_extra )
-        MEM_Copy( target->base.extra_points, source->base.extra_points,
-                  num_points * sizeof ( FT_Vector ) );
-
-      out->n_points   = (short)num_points;
-      out->n_contours = (short)num_contours;
-
-      FT_GlyphLoader _Adjust_Points( target );
-    }
-
-    return error;
-  }
-
-
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*****                                                               *****/
-  /*****                                                               *****/
-  /*****                          S T R E A M S                        *****/
-  /*****                                                               *****/
-  /*****                                                               *****/
-  /*************************************************************************/
-  /*************************************************************************/
-  /*************************************************************************/
-
-#undef  FT_COMPONENT
-#define FT_COMPONENT  trace_stream
-
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    ft_new_input_stream                                                */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Creates a new input stream object from an FT_Open_Args structure.  */
-  /*                                                                       */
-  /* <Note>                                                                */
-  /*    The function expects a valid `astream' parameter.                  */
-  /*                                                                       */
-  FT_EXPORT_DEF( FT_Error )
-  FT_Stream_Open( FT_Library     library,
-                  FT_Open_Args*  args,
-                  FT_Stream*     astream )
-  {
-    FT_Error   error;
-    FT_Memory  memory;
-    FT_Stream  stream;
-
-
-    if ( !library )
-      return FT_Err_Invalid_Library_Handle;
-
-    if ( !args )
-      return FT_Err_Invalid_Argument;
-
-    *astream = 0;
-    memory   = library->memory;
-    if ( ALLOC( stream, sizeof ( *stream ) ) )
-      goto Exit;
-
-    stream->memory = memory;
-
-    /* now, look at the stream flags */
-    if ( args->flags & ft_open_memory )
-    {
-      error = 0;
-      FT_New_Memory_Stream( library,
-                            (FT_Byte*)args->memory_base,
-                            args->memory_size,
-                            stream );
-    }
-    else if ( args->flags & ft_open_pathname )
-    {
-      error = FT_Stream_New( args->pathname, stream );
-      stream->pathname.pointer = args->pathname;
-    }
-    else if ( ( args->flags & ft_open_stream ) && args->stream )
-    {
-      /* in this case, we do not need to allocate a new stream object */
-      /* since the caller is responsible for closing it himself       */
-      FREE( stream );
-      stream = args->stream;
-    }
-    else
-      error = FT_Err_Invalid_Argument;
-
-    if ( error )
-      FREE( stream );
-
-    *astream = stream;
-
-  Exit:
-    return error;
-  }
-
-
-  /* documentation is in ftobjs.h */
-
-  FT_EXPORT_DEF( void )
-  FT_Stream_Done( FT_Stream  stream )
-  {
-    if ( stream && stream->close )
-    {
-      stream->close( stream );
-      stream->close = 0;
-    }
-  }
-
-
-  static void
-  ft_done_stream( FT_Stream*  astream,
-                  FT_Int      external )
-  {
-    FT_Stream  stream = *astream;
-
-
-    if ( stream->close )
-      stream->close( stream );
-
-    if ( !external )
-    {
-      FT_Memory  memory = stream->memory;
-
-
-      FREE( stream );
-    }
-    *astream = 0;
-  }
 
--- a/src/base/rules.mk
+++ b/src/base/rules.mk
@@ -34,11 +34,11 @@
 #
 BASE_SRC := $(BASE_)ftcalc.c   \
             $(BASE_)fttrigon.c \
-            $(BASE_)ftgloadr.c \
-            $(BASE_)ftlist.c   \
-            $(BASE_)ftobjs.c   \
+            $(BASE_)ftutil.c   \
             $(BASE_)ftstream.c \
+            $(BASE_)ftgloadr.c \
             $(BASE_)ftoutln.c  \
+            $(BASE_)ftobjs.c   \
             $(BASE_)ftnames.c  \
             $(BASE_)ftdbgmem.c
 
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -408,7 +408,7 @@
     if ( nprops & 3 )
     {
       i = 4 - ( nprops & 3 );
-      FT_Skip_Stream( stream, i );
+      FT_Stream_Skip( stream, i );
     }
 
     if ( PCF_BYTE_ORDER( format ) == MSBFirst )
@@ -423,7 +423,7 @@
     if ( ALLOC( strings, string_size * sizeof ( char ) ) )
       goto Bail;
 
-    error = FT_Read_Stream( stream, (FT_Byte*)strings, string_size );
+    error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size );
     if ( error )
       goto Bail;
 
@@ -568,7 +568,7 @@
     if ( error )
       return error;
 
-    error = FT_Access_Frame( stream, 8 );
+    error = FT_Stream_Enter_Frame( stream, 8 );
     if ( error )
       return error;
 
@@ -578,7 +578,7 @@
     else
       nbitmaps  = GET_ULongLE();
 
-    FT_Forget_Frame( stream );
+    FT_Stream_Exit_Frame( stream );
 
     if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
       return PCF_Err_Invalid_File_Format;
@@ -660,7 +660,7 @@
     if ( error )
       return error;
 
-    error = FT_Access_Frame( stream, 14 );
+    error = FT_Stream_Enter_Frame( stream, 14 );
     if ( error )
       return error;
 
@@ -683,7 +683,7 @@
       face->defaultChar = GET_ShortLE();
     }
 
-    FT_Forget_Frame( stream );
+    FT_Stream_Exit_Frame( stream );
 
     if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
       return PCF_Err_Invalid_File_Format;
@@ -696,7 +696,7 @@
     if ( ALLOC( tmpEncoding, nencoding * sizeof ( PCF_EncodingRec ) ) )
       return PCF_Err_Out_Of_Memory;
 
-    error = FT_Access_Frame( stream, 2 * nencoding );
+    error = FT_Stream_Enter_Frame( stream, 2 * nencoding );
     if ( error )
       goto Bail;
 
@@ -721,7 +721,7 @@
       FT_TRACE4(( "enc n. %d ; Uni %ld ; Glyph %d\n",
                   i, tmpEncoding[j - 1].enc, encodingOffset ));
     }
-    FT_Forget_Frame( stream );
+    FT_Stream_Exit_Frame( stream );
 
     if ( ALLOC( encoding, (--j) * sizeof ( PCF_EncodingRec ) ) )
       goto Bail;
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -1285,7 +1285,7 @@
                                range->image_format, metrics, stream );
 
     case 8:  /* compound format */
-      FT_Skip_Stream( stream, 1L );
+      FT_Stream_Skip( stream, 1L );
       /* fallthrough */
 
     case 9: