freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] [freetype2] master 605946a: Conditionally compile environ


From: Behdad Esfahbod
Subject: Re: [ft-devel] [freetype2] master 605946a: Conditionally compile environment support.
Date: Mon, 11 Jul 2016 09:43:18 -0700

Why conditional?  The more you can reduce the configuration options,
the better.  Specially the compile-time ones...

[But then again, I do appreciate how easy it is to disable certain
"modules" of the library.]

On Mon, Jul 11, 2016 at 7:14 AM, Werner LEMBERG <address@hidden> wrote:
> branch: master
> commit 605946af6d3d0e7c7eaa0b99df329933604169f2
> Author: Werner Lemberg <address@hidden>
> Commit: Werner Lemberg <address@hidden>
>
>     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.
> ---
>  ChangeLog                          |    9 +++++++++
>  include/freetype/internal/ftobjs.h |    2 ++
>  src/autofit/afmodule.c             |   17 +++++++++++++++++
>  src/base/ftobjs.c                  |    4 ++++
>  src/cff/cffdrivr.c                 |   11 +++++++++++
>  src/truetype/ttdriver.c            |    6 ++++++
>  6 files changed, 49 insertions(+)
>
> diff --git a/ChangeLog b/ChangeLog
> index 1a1b4a5..63d48ab 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,5 +1,14 @@
>  2016-07-11  Werner Lemberg  <address@hidden>
>
> +       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  <address@hidden>
> +
>         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;
>
>



-- 
behdad
http://behdad.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]