---
 src/base/ftstream.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 2 deletions(-)

Index: freetype-2.3.7/src/base/ftstream.c
===================================================================
--- freetype-2.3.7.orig/src/base/ftstream.c
+++ freetype-2.3.7/src/base/ftstream.c
@@ -42,10 +42,21 @@
     stream->cursor = 0;
     stream->read   = 0;
     stream->close  = 0;
   }
 
+  FT_BASE_DEF( void )
+  FT_New_Memory_Stream( FT_Library, FT_Byte*, FT_ULong, FT_Stream ) __attribute__((weak));
+  FT_BASE_DEF( void )
+  FT_New_Memory_Stream( FT_Library  library,
+                        FT_Byte*    base,
+                        FT_ULong    size,
+                        FT_Stream   stream )
+  { 
+    stream->memory  = library->memory;
+    FT_Stream_OpenMemory( stream, (const FT_Byte*) base, size );
+  }
 
   FT_BASE_DEF( void )
   FT_Stream_Close( FT_Stream  stream )
   {
     if ( stream && stream->close )
@@ -82,10 +93,12 @@
     }
 
     return error;
   }
 
+  FT_BASE_DEF( FT_Error )
+  FT_Seek_Stream(FT_Stream, FT_ULong) __attribute__((weak, alias("FT_Stream_Seek")));
 
   FT_BASE_DEF( FT_Error )
   FT_Stream_Skip( FT_Stream  stream,
                   FT_Long    distance )
   {
@@ -93,10 +106,12 @@
       return FT_Err_Invalid_Stream_Operation;
 
     return FT_Stream_Seek( stream, (FT_ULong)( stream->pos + distance ) );
   }
 
+  FT_BASE_DEF( FT_Error )
+  FT_Skip_Stream(FT_Stream, FT_Long) __attribute__((weak, alias("FT_Stream_Skip")));
 
   FT_BASE_DEF( FT_Long )
   FT_Stream_Pos( FT_Stream  stream )
   {
     return stream->pos;
@@ -109,10 +124,12 @@
                   FT_ULong   count )
   {
     return FT_Stream_ReadAt( stream, stream->pos, buffer, count );
   }
 
+  FT_BASE_DEF( FT_Error )
+  FT_Read_Stream( FT_Stream, FT_Byte*, FT_ULong ) __attribute__((weak, alias("FT_Stream_Read")));
 
   FT_BASE_DEF( FT_Error )
   FT_Stream_ReadAt( FT_Stream  stream,
                     FT_ULong   pos,
                     FT_Byte*   buffer,
@@ -182,10 +199,12 @@
 
   Exit:
     return read_bytes;
   }
 
+  FT_BASE_DEF( FT_Error )
+  FT_Read_Stream_At( FT_Stream, FT_ULong, FT_Byte*, FT_ULong) __attribute__((weak, alias("FT_Stream_ReadAt")));
 
   FT_BASE_DEF( FT_Error )
   FT_Stream_ExtractFrame( FT_Stream  stream,
                           FT_ULong   count,
                           FT_Byte**  pbytes )
@@ -204,11 +223,13 @@
     }
 
     return error;
   }
 
-
+  FT_BASE_DEF( FT_Error )
+  FT_Extract_Frame( FT_Stream, FT_ULong, FT_Byte** ) __attribute__((weak, alias("FT_Stream_ExtractFrame")));
+ 
   FT_BASE_DEF( void )
   FT_Stream_ReleaseFrame( FT_Stream  stream,
                           FT_Byte**  pbytes )
   {
     if ( stream->read )
@@ -223,10 +244,12 @@
 #endif
     }
     *pbytes = 0;
   }
 
+  FT_BASE_DEF( void )
+  FT_Release_Frame( FT_Stream, FT_Byte** ) __attribute__((weak, alias("FT_Stream_ReleaseFrame")));
 
   FT_BASE_DEF( FT_Error )
   FT_Stream_EnterFrame( FT_Stream  stream,
                         FT_ULong   count )
   {
@@ -289,10 +312,12 @@
 
   Exit:
     return error;
   }
 
+  FT_BASE_DEF( FT_Error )
+  FT_Access_Frame( FT_Stream, FT_ULong ) __attribute__((weak, alias("FT_Stream_EnterFrame")));
 
   FT_BASE_DEF( void )
   FT_Stream_ExitFrame( FT_Stream  stream )
   {
     /* IMPORTANT: The assertion stream->cursor != 0 was removed, given    */
@@ -319,10 +344,12 @@
     }
     stream->cursor = 0;
     stream->limit  = 0;
   }
 
+  FT_BASE_DEF( void )
+  FT_Forget_Frame( FT_Stream ) __attribute__((weak, alias("FT_Stream_ExitFrame")));
 
   FT_BASE_DEF( FT_Char )
   FT_Stream_GetChar( FT_Stream  stream )
   {
     FT_Char  result;
@@ -335,10 +362,12 @@
       result = *stream->cursor++;
 
     return result;
   }
 
+  FT_BASE_DEF( FT_Char )
+  FT_Get_Char( FT_Stream ) __attribute__((weak, alias("FT_Stream_GetChar")));
 
   FT_BASE_DEF( FT_Short )
   FT_Stream_GetShort( FT_Stream  stream )
   {
     FT_Byte*  p;
@@ -354,10 +383,12 @@
     stream->cursor = p;
 
     return result;
   }
 
+  FT_BASE_DEF( FT_Short )
+  FT_Get_Short( FT_Stream ) __attribute__((weak, alias("FT_Stream_GetShort")));
 
   FT_BASE_DEF( FT_Short )
   FT_Stream_GetShortLE( FT_Stream  stream )
   {
     FT_Byte*  p;
@@ -373,10 +404,12 @@
     stream->cursor = p;
 
     return result;
   }
 
+  FT_BASE_DEF( FT_Short )
+  FT_Get_ShortLE( FT_Stream ) __attribute__((weak, alias("FT_Stream_GetShortLE")));
 
   FT_BASE_DEF( FT_Long )
   FT_Stream_GetOffset( FT_Stream  stream )
   {
     FT_Byte*  p;
@@ -391,10 +424,12 @@
       result       = FT_NEXT_OFF3( p );
     stream->cursor = p;
     return result;
   }
 
+  FT_BASE_DEF( FT_Long )
+  FT_Get_Offset( FT_Stream ) __attribute__((weak, alias("FT_Stream_GetOffset")));
 
   FT_BASE_DEF( FT_Long )
   FT_Stream_GetLong( FT_Stream  stream )
   {
     FT_Byte*  p;
@@ -409,10 +444,12 @@
       result       = FT_NEXT_LONG( p );
     stream->cursor = p;
     return result;
   }
 
+  FT_BASE_DEF( FT_Long )
+  FT_Get_Long( FT_Stream ) __attribute__((weak, alias("FT_Stream_GetLong")));
 
   FT_BASE_DEF( FT_Long )
   FT_Stream_GetLongLE( FT_Stream  stream )
   {
     FT_Byte*  p;
@@ -427,10 +464,12 @@
       result       = FT_NEXT_LONG_LE( p );
     stream->cursor = p;
     return result;
   }
 
+  FT_BASE_DEF( FT_Long )
+  FT_Get_LongLE( FT_Stream ) __attribute__((weak, alias("FT_Stream_GetLongLE")));
 
   FT_BASE_DEF( FT_Char )
   FT_Stream_ReadChar( FT_Stream  stream,
                       FT_Error*  error )
   {
@@ -463,10 +502,12 @@
                stream->pos, stream->size ));
 
     return 0;
   }
 
+  FT_BASE_DEF( FT_Char )
+  FT_Read_Char( FT_Stream, FT_Error* ) __attribute__((weak, alias("FT_Stream_ReadChar")));
 
   FT_BASE_DEF( FT_Short )
   FT_Stream_ReadShort( FT_Stream  stream,
                        FT_Error*  error )
   {
@@ -510,10 +551,13 @@
                stream->pos, stream->size ));
 
     return 0;
   }
 
+  FT_BASE_DEF( FT_Short )
+  FT_Read_Short( FT_Stream, FT_Error* ) __attribute__((weak, alias("FT_Stream_ReadShort")));
+
 
   FT_BASE_DEF( FT_Short )
   FT_Stream_ReadShortLE( FT_Stream  stream,
                          FT_Error*  error )
   {
@@ -557,10 +601,12 @@
                stream->pos, stream->size ));
 
     return 0;
   }
 
+  FT_BASE_DEF( FT_Short )
+  FT_Read_ShortLE( FT_Stream, FT_Error* ) __attribute__((weak, alias("FT_Stream_ReadShortLE")));
 
   FT_BASE_DEF( FT_Long )
   FT_Stream_ReadOffset( FT_Stream  stream,
                         FT_Error*  error )
   {
@@ -604,10 +650,12 @@
                stream->pos, stream->size ));
 
     return 0;
   }
 
+  FT_BASE_DEF( FT_Long )
+  FT_Read_Offset( FT_Stream, FT_Error* ) __attribute__((weak, alias("FT_Stream_ReadOffset")));
 
   FT_BASE_DEF( FT_Long )
   FT_Stream_ReadLong( FT_Stream  stream,
                       FT_Error*  error )
   {
@@ -650,10 +698,12 @@
     *error = FT_Err_Invalid_Stream_Operation;
 
     return 0;
   }
 
+  FT_BASE_DEF( FT_Long )
+  FT_Read_Long( FT_Stream, FT_Error* ) __attribute__((weak, alias("FT_Stream_ReadLong")));
 
   FT_BASE_DEF( FT_Long )
   FT_Stream_ReadLongLE( FT_Stream  stream,
                         FT_Error*  error )
   {
@@ -697,10 +747,13 @@
     *error = FT_Err_Invalid_Stream_Operation;
 
     return 0;
   }
 
+  FT_BASE_DEF( FT_Long )
+  FT_Read_LongLE( FT_Stream, FT_Error* ) __attribute__((weak, alias("FT_Stream_ReadLongLE")));
+
 
   FT_BASE_DEF( FT_Error )
   FT_Stream_ReadFields( FT_Stream              stream,
                         const FT_Frame_Field*  fields,
                         void*                  structure )
@@ -839,7 +892,8 @@
       FT_Stream_ExitFrame( stream );
 
     return error;
   }
 
-
+  FT_BASE_DEF( FT_Error )
+  FT_Read_Fields( FT_Stream, const FT_Frame_Field*, void* ) __attribute__((weak, alias("FT_Stream_ReadFields")));
 /* END */
