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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
diff --git a/ChangeLog b/ChangeLog
index 851b378..23f1194 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-07-20 Chris Morgan <cmorgan@cybexintl.com>
+
+ 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 <elton328@gmail.com>
* src/base/ftpatent.c (FT_Face_SetUnpatentedHinting): Fix typo.
diff --git a/devel/ftoption.h b/devel/ftoption.h
index a84f650..4da0221 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -205,6 +205,17 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
+ /* 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 */
/* */
/* When compiling FreeType as a DLL, some systems/compilers need a */
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 17c1d1d..041e24a 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -205,6 +205,17 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
+ /* 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 */
/* */
/* When compiling FreeType as a DLL, some systems/compilers need a */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index c627c0b..5069afb 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 66c5d76..7e203be 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