diff --git a/ChangeLog b/ChangeLog index e19cb50f1..f644b5326 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2017-12-25 Ewald Hew + + Move PostScript drivers' property handlers to `base'. + + This reduces the amount of duplicated code across PostScript + drivers. + + * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c + ({cff,cid,t1}_property_{get,set}): Moved to... + * include/freetype/internal/ftpsprop.h: ...this new file. + (ps_property_{get,set}): New functions to replace moved ones. + + * src/base/ftpsprop.c: New file that implements above functions. + + * include/freetype/internal/internal.h + (FT_INTERNAL_POSTSCRIPT_PROPS_H): New macro. + + * src/cff/cffdrivr.c, src/cid/cidriver.c, src/type1/t1driver.c: + Updated. + + * src/base/Jamfile, src/base/rules.mk (BASE_SRC), src/base/ftbase.c: + Updated. + 2017-12-20 Werner Lemberg Speed up FT_Set_Var_{Design,Blend}_Coordinates if curr == new. diff --git a/include/freetype/internal/ftpsprop.h b/include/freetype/internal/ftpsprop.h index 97e313a94..cbd287469 100644 --- a/include/freetype/internal/ftpsprop.h +++ b/include/freetype/internal/ftpsprop.h @@ -4,6 +4,15 @@ /* */ /* Get and set properties of PostScript drivers (specification). */ /* */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ /***************************************************************************/ diff --git a/src/base/ftpsprop.c b/src/base/ftpsprop.c index a8bb050d9..b146eaba0 100644 --- a/src/base/ftpsprop.c +++ b/src/base/ftpsprop.c @@ -5,7 +5,15 @@ /* Get and set properties of PostScript drivers (body). */ /* See `ftdriver.h' for available properties. */ /* */ -/* Copyright */ +/* Copyright 2017 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ /***************************************************************************/ @@ -86,9 +94,11 @@ return error; } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) { -#if defined(CFF_CONFIG_OPTION_OLD_ENGINE) || defined(T1_CONFIG_OPTION_OLD_ENGINE) +#if defined( CFF_CONFIG_OPTION_OLD_ENGINE ) || \ + defined( T1_CONFIG_OPTION_OLD_ENGINE ) const char* module_name = module->clazz->module_name; #endif @@ -101,17 +111,20 @@ if ( !ft_strcmp( s, "adobe" ) ) driver->hinting_engine = FT_HINTING_ADOBE; + #ifdef CFF_CONFIG_OPTION_OLD_ENGINE else if ( !ft_strcmp( module_name, "cff" ) && - !ft_strcmp( s, "freetype" ) ) + !ft_strcmp( s, "freetype" ) ) driver->hinting_engine = FT_HINTING_FREETYPE; #endif + #ifdef T1_CONFIG_OPTION_OLD_ENGINE else if ( ( !ft_strcmp( module_name, "type1" ) || !ft_strcmp( module_name, "t1cid" ) ) && - !ft_strcmp( s, "freetype" ) ) + !ft_strcmp( s, "freetype" ) ) driver->hinting_engine = FT_HINTING_FREETYPE; #endif + else return FT_THROW( Invalid_Argument ); } @@ -124,7 +137,7 @@ if ( *hinting_engine == FT_HINTING_ADOBE #ifdef CFF_CONFIG_OPTION_OLD_ENGINE || ( *hinting_engine == FT_HINTING_FREETYPE && - !ft_strcmp( module_name, "cff" ) ) + !ft_strcmp( module_name, "cff" ) ) #endif #ifdef T1_CONFIG_OPTION_OLD_ENGINE || ( *hinting_engine == FT_HINTING_FREETYPE && @@ -139,6 +152,7 @@ return error; } } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) { #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES @@ -164,6 +178,7 @@ return error; } + else if ( !ft_strcmp( property_name, "random-seed" ) ) { FT_Int32 random_seed; @@ -221,6 +236,7 @@ return error; } + else if ( !ft_strcmp( property_name, "hinting-engine" ) ) { FT_UInt hinting_engine = driver->hinting_engine; @@ -231,6 +247,7 @@ return error; } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) { FT_Bool no_stem_darkening = driver->no_stem_darkening; @@ -247,3 +264,5 @@ return FT_THROW( Missing_Property ); } + +/* END */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index b55b2ea0d..4236c801c 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -821,6 +821,7 @@ * PROPERTY SERVICE * */ + FT_DEFINE_SERVICE_PROPERTIESREC( cff_service_properties, diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index d665d12a8..464ff49ab 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -176,6 +176,7 @@ * PROPERTY SERVICE * */ + FT_DEFINE_SERVICE_PROPERTIESREC( cid_service_properties, diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index f354ac1b8..57a91ae92 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -621,6 +621,7 @@ * PROPERTY SERVICE * */ + FT_DEFINE_SERVICE_PROPERTIESREC( t1_service_properties,