From: Christoph M. Becker Date: Sun, 21 Jul 2019 15:28:49 +0000 (+0200) Subject: Drop superfluous ENABLE_GD_TTF X-Git-Tag: php-7.4.0beta1~17^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3d3404db7e8b82e171bfb119c69dc6770502ae4;p=php Drop superfluous ENABLE_GD_TTF If we `HAVE_LIBFREETYPE`, we define `ENABLE_GD_TTF` if it is not defined. Therefore we can check for `HAVE_LIBFREETYPE` in the first place. --- diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index 8271eb27b1..2011aaf849 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -109,7 +109,6 @@ AC_DEFUN([PHP_GD_FREETYPE2],[ PHP_EVAL_LIBLINE($FREETYPE2_LIBS, GD_SHARED_LIBADD) AC_DEFINE(HAVE_LIBFREETYPE, 1, [ ]) AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ]) - AC_DEFINE(ENABLE_GD_TTF, 1, [ ]) fi ]) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index a8a39fcc64..62c2ceefe9 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -68,11 +68,9 @@ static int le_gd, le_gd_font; #include /* 4 Large font */ #include /* 5 Giant font */ -#ifdef ENABLE_GD_TTF -# ifdef HAVE_LIBFREETYPE -# include -# include FT_FREETYPE_H -# endif +#if HAVE_LIBFREETYPE +# include +# include FT_FREETYPE_H #endif #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) @@ -83,7 +81,7 @@ static int le_gd, le_gd_font; #define M_PI 3.14159265358979323846 #endif -#ifdef ENABLE_GD_TTF +#if HAVE_LIBFREETYPE static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int, int); #endif @@ -724,7 +722,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagegetclip, 0) ZEND_ARG_INFO(0, im) ZEND_END_ARG_INFO() -#ifdef ENABLE_GD_TTF #if HAVE_LIBFREETYPE ZEND_BEGIN_ARG_INFO_EX(arginfo_imageftbbox, 0, 0, 4) ZEND_ARG_INFO(0, size) @@ -745,7 +742,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imagefttext, 0, 0, 8) ZEND_ARG_INFO(0, text) ZEND_ARG_INFO(0, extrainfo) /* ARRAY_INFO(0, extrainfo, 0) */ ZEND_END_ARG_INFO() -#endif ZEND_BEGIN_ARG_INFO(arginfo_imagettfbbox, 0) ZEND_ARG_INFO(0, size) @@ -991,7 +987,7 @@ static const zend_function_entry gd_functions[] = { PHP_FE(imagegetclip, arginfo_imagegetclip) PHP_FE(imagedashedline, arginfo_imagedashedline) -#ifdef ENABLE_GD_TTF +#if HAVE_LIBFREETYPE PHP_FE(imagettfbbox, arginfo_imagettfbbox) PHP_FE(imagettftext, arginfo_imagettftext) #if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE @@ -1284,9 +1280,8 @@ PHP_MINFO_FUNCTION(gd) #endif #endif -#ifdef ENABLE_GD_TTF - php_info_print_table_row(2, "FreeType Support", "enabled"); #if HAVE_LIBFREETYPE + php_info_print_table_row(2, "FreeType Support", "enabled"); php_info_print_table_row(2, "FreeType Linkage", "with freetype"); { char tmp[256]; @@ -1300,9 +1295,6 @@ PHP_MINFO_FUNCTION(gd) #endif php_info_print_table_row(2, "FreeType Version", tmp); } -#else - php_info_print_table_row(2, "FreeType Linkage", "with unknown library"); -#endif #endif php_info_print_table_row(2, "GIF Read Support", "enabled"); @@ -1358,13 +1350,9 @@ PHP_FUNCTION(gd_info) add_assoc_string(return_value, "GD Version", PHP_GD_VERSION_STRING); -#ifdef ENABLE_GD_TTF - add_assoc_bool(return_value, "FreeType Support", 1); #if HAVE_LIBFREETYPE + add_assoc_bool(return_value, "FreeType Support", 1); add_assoc_string(return_value, "FreeType Linkage", "with freetype"); -#else - add_assoc_string(return_value, "FreeType Linkage", "with unknown library"); -#endif #else add_assoc_bool(return_value, "FreeType Support", 0); #endif @@ -3977,14 +3965,14 @@ PHP_FUNCTION(imagegetclip) } /* }}} */ -#ifdef ENABLE_GD_TTF +#if HAVE_LIBFREETYPE #define TTFTEXT_DRAW 0 #define TTFTEXT_BBOX 1 #endif -#ifdef ENABLE_GD_TTF +#if HAVE_LIBFREETYPE -#if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE +#if HAVE_GD_FREETYPE /* {{{ proto array imageftbbox(float size, float angle, string font_file, string text [, array extrainfo]) Give the bounding box of a text using fonts via freetype2 */ PHP_FUNCTION(imageftbbox) @@ -4000,7 +3988,7 @@ PHP_FUNCTION(imagefttext) php_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW, 1); } /* }}} */ -#endif /* HAVE_GD_FREETYPE && HAVE_LIBFREETYPE */ +#endif /* HAVE_GD_FREETYPE */ /* {{{ proto array imagettfbbox(float size, float angle, string font_file, string text) Give the bounding box of a text using TrueType fonts */ @@ -4103,7 +4091,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int } } /* }}} */ -#endif /* ENABLE_GD_TTF */ +#endif /* HAVE_LIBFREETYPE */ /* {{{ proto bool image2wbmp(resource im [, string filename [, int foreground]]) Output WBMP image to browser or file */ diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index a3e80cd3d0..b4593f82ab 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -20,12 +20,6 @@ #ifndef PHP_GD_H #define PHP_GD_H -#if HAVE_LIBFREETYPE -# ifndef ENABLE_GD_TTF -# define ENABLE_GD_TTF -# endif -#endif - #if defined(HAVE_LIBGD) || defined(HAVE_GD_BUNDLED) /* open_basedir and safe_mode checks */