diff --git a/ChangeLog b/ChangeLog index 851b378c4..23f1194c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-07-20 Chris Morgan + + Add FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT. + + Useful for embedded systems which don't need file stream support. + + * src/base/ftsystem.c, src/base/ftobjs.c (FT_Stream_New): Implement + it. + 2011-07-20 Elton Chung * src/base/ftpatent.c (FT_Face_SetUnpatentedHinting): Fix typo. diff --git a/devel/ftoption.h b/devel/ftoption.h index a84f650af..4da0221db 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -203,6 +203,17 @@ FT_BEGIN_HEADER #define FT_CONFIG_OPTION_USE_BZIP2 + /*************************************************************************/ + /* */ + /* Define to disable the use of file stream functions and types, FILE, */ + /* fopen() etc. Enables the use of smaller system libraries on embedded */ + /* systems that have multiple system libraries, some with or without */ + /* file stream support, in the cases where file stream support is not */ + /* necessary such as memory loading of font files. */ + /* */ +/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ + + /*************************************************************************/ /* */ /* DLL export compilation */ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 17c1d1d1c..041e24a31 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -203,6 +203,17 @@ FT_BEGIN_HEADER /* #define FT_CONFIG_OPTION_USE_BZIP2 */ + /*************************************************************************/ + /* */ + /* Define to disable the use of file stream functions and types, FILE, */ + /* fopen() etc. Enables the use of smaller system libraries on embedded */ + /* systems that have multiple system libraries, some with or without */ + /* file stream support, in the cases where file stream support is not */ + /* necessary such as memory loading of font files. */ + /* */ +/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ + + /*************************************************************************/ /* */ /* DLL export compilation */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index c627c0b5b..5069afb2c 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -155,6 +155,9 @@ (const FT_Byte*)args->memory_base, args->memory_size ); } + +#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT + else if ( args->flags & FT_OPEN_PATHNAME ) { /* create a normal system stream */ @@ -170,6 +173,9 @@ FT_FREE( stream ); stream = args->stream; } + +#endif + else error = FT_Err_Invalid_Argument; diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index 66c5d76a9..7e203bef8 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* ANSI-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2006, 2008, 2009, 2010 by */ +/* Copyright 1996-2002, 2006, 2008-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -137,6 +137,7 @@ /* */ /*************************************************************************/ +#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT /*************************************************************************/ /* */ @@ -267,6 +268,7 @@ return FT_Err_Ok; } +#endif /* !FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ #ifdef FT_DEBUG_MEMORY