]> granicus.if.org Git - php/commitdiff
Drop superfluous ENABLE_GD_TTF
authorChristoph M. Becker <cmbecker69@gmx.de>
Sun, 21 Jul 2019 15:28:49 +0000 (17:28 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 22 Jul 2019 10:01:24 +0000 (12:01 +0200)
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.

ext/gd/config.m4
ext/gd/gd.c
ext/gd/php_gd.h

index 8271eb27b115964e744677ea4ec313f6799fee9f..2011aaf849e11ad6f71562fdb3cb205277b2e79d 100644 (file)
@@ -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
 ])
 
index a8a39fcc646b8027c4995611106b9d353a32e7d6..62c2ceefe94d4c2937bc3272f6036a870770a04c 100644 (file)
@@ -68,11 +68,9 @@ static int le_gd, le_gd_font;
 #include <gdfontl.h>  /* 4 Large font */
 #include <gdfontg.h>  /* 5 Giant font */
 
-#ifdef ENABLE_GD_TTF
-# ifdef HAVE_LIBFREETYPE
-#  include <ft2build.h>
-#  include FT_FREETYPE_H
-# endif
+#if HAVE_LIBFREETYPE
+# include <ft2build.h>
+# 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 */
index a3e80cd3d08778ca93bb3bba56a65f16a028c717..b4593f82ab9889e62dcfc2f48b9ab5f113206d4c 100644 (file)
 #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 */