ref: 605946af6d3d0e7c7eaa0b99df329933604169f2
parent: 8f8ae8c52d7bb3b92909bc2e5ff91678b0f793aa
author: Werner Lemberg <[email protected]>
date: Mon Jul 11 12:14:36 EDT 2016
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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2016-07-11 Werner Lemberg <[email protected]>
+ 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 <[email protected]>
+
Handle properties in `FREETYPE_PROPERTIES' environment variable.
This commit covers the most important one.
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -532,11 +532,13 @@
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
/* */
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -113,7 +113,11 @@
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" ) )
{
FT_UInt* 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;
--- 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 */
@@ -4695,6 +4697,8 @@
TRUE,
TRUE );
}
+
+#endif
/*************************************************************************/
--- 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;
--- 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;