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.
This commit is contained in:
Werner Lemberg 2016-07-11 16:14:36 +02:00
parent 8f8ae8c52d
commit 605946af6d
6 changed files with 49 additions and 0 deletions

View File

@ -1,3 +1,12 @@
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.

View File

@ -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
/* */

View File

@ -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;

View File

@ -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
/*************************************************************************/
/*************************************************************************/

View File

@ -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;

View File

@ -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;