Commit 605946af6d3d0e7c7eaa0b99df329933604169f2

Werner Lemberg 2016-07-11T16:14:36

Conditionally compile environment support. * include/freetype/internal/ftobjs.h, src/autofit/afmodule.c, src/base/ftobjs.c, src/cff/cffdrivr.c, src/truetype/ttdriver.c: Decorate with `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' where necessary.

diff --git a/ChangeLog b/ChangeLog
index 1a1b4a5..63d48ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2016-07-11  Werner Lemberg  <wl@gnu.org>
 
+	Conditionally compile environment support.
+
+	* include/freetype/internal/ftobjs.h, src/autofit/afmodule.c,
+	src/base/ftobjs.c, src/cff/cffdrivr.c, src/truetype/ttdriver.c:
+	Decorate with `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES' where
+	necessary.
+
+2016-07-11  Werner Lemberg  <wl@gnu.org>
+
 	Handle properties in `FREETYPE_PROPERTIES' environment variable.
 
 	This commit covers the most important one.
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 6b68d91..0a9f2d4 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -532,11 +532,13 @@ FT_BEGIN_HEADER
   ft_module_get_service( FT_Module    module,
                          const char*  service_id );
 
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
   FT_BASE( FT_Error )
   ft_property_string_set( FT_Library        library,
                           const FT_String*  module_name,
                           const FT_String*  property_name,
                           FT_String*        value );
+#endif
 
   /* */
 
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 4a6b049..e8f8ff4 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -113,6 +113,10 @@
     FT_Error   error  = FT_Err_Ok;
     AF_Module  module = (AF_Module)ft_module;
 
+#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+    FT_UNUSED( value_is_string );
+#endif
+
 
     if ( !ft_strcmp( property_name, "fallback-script" ) )
     {
@@ -120,8 +124,10 @@
       FT_UInt   ss;
 
 
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       if ( value_is_string )
         return FT_THROW( Invalid_Argument );
+#endif
 
       fallback_script = (FT_UInt*)value;
 
@@ -155,8 +161,10 @@
       FT_UInt*  default_script;
 
 
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       if ( value_is_string )
         return FT_THROW( Invalid_Argument );
+#endif
 
       default_script = (FT_UInt*)value;
 
@@ -170,8 +178,10 @@
       AF_FaceGlobals            globals;
 
 
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       if ( value_is_string )
         return FT_THROW( Invalid_Argument );
+#endif
 
       prop = (FT_Prop_IncreaseXHeight*)value;
 
@@ -184,6 +194,7 @@
 #ifdef AF_CONFIG_OPTION_USE_WARPER
     else if ( !ft_strcmp( property_name, "warping" ) )
     {
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       if ( value_is_string )
       {
         const char*  s = (const char*)value;
@@ -198,6 +209,7 @@
           return FT_THROW( Invalid_Argument );
       }
       else
+#endif
       {
         FT_Bool*  warping = (FT_Bool*)value;
 
@@ -212,6 +224,8 @@
     {
       FT_Int*  darken_params;
       FT_Int   x1, y1, x2, y2, x3, y3, x4, y4;
+
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       FT_Int   dp[8];
 
 
@@ -239,6 +253,7 @@
         darken_params = dp;
       }
       else
+#endif
         darken_params = (FT_Int*)value;
 
       x1 = darken_params[0];
@@ -269,6 +284,7 @@
     }
     else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
     {
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       if ( value_is_string )
       {
         const char*  s   = (const char*)value;
@@ -283,6 +299,7 @@
           return FT_THROW( Invalid_Argument );
       }
       else
+#endif
       {
         FT_Bool*  no_stem_darkening = (FT_Bool*)value;
 
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index c265855..7a78357 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4679,6 +4679,8 @@
   }
 
 
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+
   /* this variant is used for handling the FREETYPE_PROPERTIES */
   /* environment variable                                      */
 
@@ -4696,6 +4698,8 @@
                            TRUE );
   }
 
+#endif
+
 
   /*************************************************************************/
   /*************************************************************************/
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 2e2a437..67bf09d 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -665,11 +665,17 @@
     FT_Error    error  = FT_Err_Ok;
     CFF_Driver  driver = (CFF_Driver)module;
 
+#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+    FT_UNUSED( value_is_string );
+#endif
+
 
     if ( !ft_strcmp( property_name, "darkening-parameters" ) )
     {
       FT_Int*  darken_params;
       FT_Int   x1, y1, x2, y2, x3, y3, x4, y4;
+
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       FT_Int   dp[8];
 
 
@@ -697,6 +703,7 @@
         darken_params = dp;
       }
       else
+#endif
         darken_params = (FT_Int*)value;
 
       x1 = darken_params[0];
@@ -727,6 +734,7 @@
     }
     else if ( !ft_strcmp( property_name, "hinting-engine" ) )
     {
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       if ( value_is_string )
       {
         const char*  s = (const char*)value;
@@ -742,6 +750,7 @@
           return FT_THROW( Invalid_Argument );
       }
       else
+#endif
       {
         FT_UInt*  hinting_engine = (FT_UInt*)value;
 
@@ -759,6 +768,7 @@
     }
     else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
     {
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       if ( value_is_string )
       {
         const char*  s   = (const char*)value;
@@ -773,6 +783,7 @@
           return FT_THROW( Invalid_Argument );
       }
       else
+#endif
       {
         FT_Bool*  no_stem_darkening = (FT_Bool*)value;
 
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 3debf78..2659b9c 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -67,12 +67,17 @@
     FT_Error   error  = FT_Err_Ok;
     TT_Driver  driver = (TT_Driver)module;
 
+#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
+    FT_UNUSED( value_is_string );
+#endif
+
 
     if ( !ft_strcmp( property_name, "interpreter-version" ) )
     {
       FT_UInt  interpreter_version;
 
 
+#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
       if ( value_is_string )
       {
         const char*  s = (const char*)value;
@@ -81,6 +86,7 @@
         interpreter_version = (FT_UInt)ft_strtol( s, NULL, 10 );
       }
       else
+#endif
       {
         FT_UInt*  iv = (FT_UInt*)value;