]> granicus.if.org Git - php/commitdiff
Remove T1Lib support (see #69698)
authorKalle Sommer Nielsen <kalle@php.net>
Fri, 29 May 2015 07:18:36 +0000 (09:18 +0200)
committerKalle Sommer Nielsen <kalle@php.net>
Fri, 29 May 2015 07:18:36 +0000 (09:18 +0200)
# Also removes imagepscopyfont() which was never available (commented out)

NEWS
UPGRADING
ext/gd/config.m4
ext/gd/config.w32
ext/gd/gd.c
ext/gd/php_gd.h

diff --git a/NEWS b/NEWS
index 0e1a14b9732098ebf2321e1527d7ebd194913ee8..2cd1ee95b6029b2531ebb9d10910a47396636a84 100644 (file)
--- a/NEWS
+++ b/NEWS
 
 - GD:
   . Made fontFetch's path parser thread-safe. (Sara)
+  . Removed T1Lib support. (Kalle)
 
 - Fileinfo:
   . Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)
index 60ffaa7f058cc2fbaf4483dc39220176002ee095..288639b70e853859d58d43e815ce7f6d3955c923 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -645,6 +645,23 @@ For more details see https://wiki.php.net/rfc/removal_of_dead_sapis_and_exts
   . ZLIB_BLOCK
   . ZLIB_FINISH
 
+- GD
+  . T1Lib support removed, thrus lifting the optional dependency on T1Lib, the 
+    following is therefore not available anymore:
+
+    Functions:
+      - imagepsbbox()
+      - imagepsencodefont()
+      - imagepsextendedfont()
+      - imagepsfreefont()
+      - imagepsloadfont()
+      - imagepsslantfont()
+      - imagepstext()
+
+    Resources:
+      - 'gd PS font'
+      - 'gd PS encoding'
+
 ========================================
 11. Changes to INI File Handling
 ========================================
index e643e5273631f28ea9722986336fe6634aa0bbae..36688e127aba3b8bb62263691635e0fb123b0d03 100644 (file)
@@ -35,9 +35,6 @@ PHP_ARG_WITH(xpm-dir, for the location of libXpm,
 PHP_ARG_WITH(freetype-dir, for FreeType 2,
 [  --with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix], no, no)
 
-PHP_ARG_WITH(t1lib, for T1lib support,
-[  --with-t1lib[=DIR]        GD: Include T1lib support. T1lib version >= 5.0.0 required], no, no)
-
 PHP_ARG_ENABLE(gd-native-ttf, whether to enable truetype string function in GD,
 [  --enable-gd-native-ttf  GD: Enable TrueType string function], no, no)
 
@@ -209,30 +206,6 @@ AC_DEFUN([PHP_GD_FREETYPE2],[
   fi
 ])
 
-AC_DEFUN([PHP_GD_T1LIB],[
-  if test "$PHP_T1LIB" != "no"; then
-
-    for i in $PHP_T1LIB /usr/local /usr; do
-      test -f "$i/include/t1lib.h" && GD_T1_DIR=$i && break
-    done
-
-    if test -z "$GD_T1_DIR"; then
-      AC_MSG_ERROR([Your t1lib distribution is not installed correctly. Please reinstall it.])
-    fi
-
-    PHP_CHECK_LIBRARY(t1, T1_StrError,
-    [
-      AC_DEFINE(HAVE_LIBT1,1,[ ])
-      PHP_ADD_INCLUDE($GD_T1_DIR/include)
-      PHP_ADD_LIBRARY_WITH_PATH(t1, $GD_T1_DIR/$PHP_LIBDIR, GD_SHARED_LIBADD)
-    ],[
-      AC_MSG_ERROR([Problem with libt1.(a|so). Please check config.log for more information.])
-    ],[
-      -L$GD_T1_DIR/$PHP_LIBDIR
-    ])
-  fi
-])
-
 AC_DEFUN([PHP_GD_TTSTR],[
   if test "$PHP_GD_NATIVE_TTF" = "yes"; then
     AC_DEFINE(USE_GD_IMGSTRTTF, 1, [ ])
@@ -274,7 +247,6 @@ dnl Various checks for GD features
   PHP_GD_PNG
   PHP_GD_XPM
   PHP_GD_FREETYPE2
-  PHP_GD_T1LIB
   PHP_GD_JISX0208
 fi
 
@@ -343,7 +315,6 @@ dnl Various checks for GD features
   PHP_GD_PNG
   PHP_GD_XPM
   PHP_GD_FREETYPE2
-  PHP_GD_T1LIB
 
 dnl Header path
   for i in include/gd include gd ""; do
index da6d0d2ff510ce9f4ffd2bb2551807a7ff24bd3a..a51f027d38a602160223c20afaaa9c9d7cfb0eda 100644 (file)
@@ -2,7 +2,6 @@
 // vim:ft=javascript
 
 ARG_WITH("gd", "Bundled GD support", "yes,shared");
-ARG_WITH("t1lib", "t1lib support", "yes");
 ARG_WITH("libvpx", "vpx support", "yes");
 
 if (PHP_GD != "no") {
@@ -21,15 +20,6 @@ if (PHP_GD != "no") {
                CHECK_LIB("libXpm_a.lib", "gd", PHP_GD) &&
                CHECK_HEADER_ADD_INCLUDE("xpm.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\X11")
                ) {
-               if (PHP_T1LIB != "no") {
-                       if (CHECK_LIB("T1_StaticMD.lib", "gd", PHP_GD) &&
-                               CHECK_HEADER_ADD_INCLUDE("t1lib.h", "CFLAGS_GD", PHP_GD + ";" + PHP_PHP_BUILD + "\\include\\t1lib")
-                               ) {
-                               ADD_FLAG("CFLAGS_GD", "/D HAVE_LIBT1");
-                               } else {
-                               WARNING("t1lib not enabled; libraries and headers not found");
-                       }
-               }
 
                if (PHP_LIBVPX != "no") {
                        if (CHECK_LIB("vpxmt.lib", "gd", PHP_GD) &&
index 9105fe6609476fbb8df22553b5af3a842bbfc56e..70f98f6a507ec17fe52b068223419ac7f7205839 100644 (file)
 
 
 static int le_gd, le_gd_font;
-#if HAVE_LIBT1
-#include <t1lib.h>
-static int le_ps_font, le_ps_enc;
-static void php_free_ps_font(zend_resource *rsrc);
-static void php_free_ps_enc(zend_resource *rsrc);
-#endif
 
 #include <gd.h>
 #include <gdfontt.h>  /* 1 Tiny font */
@@ -730,61 +724,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagettftext, 0)
 ZEND_END_ARG_INFO()
 #endif
 
-#ifdef HAVE_LIBT1
-ZEND_BEGIN_ARG_INFO(arginfo_imagepsloadfont, 0)
-       ZEND_ARG_INFO(0, pathname)
-ZEND_END_ARG_INFO()
-
-/*
-ZEND_BEGIN_ARG_INFO(arginfo_imagepscopyfont, 0)
-       ZEND_ARG_INFO(0, font_index)
-ZEND_END_ARG_INFO()
-*/
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepsfreefont, 0)
-       ZEND_ARG_INFO(0, font_index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepsencodefont, 0)
-       ZEND_ARG_INFO(0, font_index)
-       ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepsextendfont, 0)
-       ZEND_ARG_INFO(0, font_index)
-       ZEND_ARG_INFO(0, extend)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepsslantfont, 0)
-       ZEND_ARG_INFO(0, font_index)
-       ZEND_ARG_INFO(0, slant)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepstext, 0, 0, 8)
-       ZEND_ARG_INFO(0, im)
-       ZEND_ARG_INFO(0, text)
-       ZEND_ARG_INFO(0, font)
-       ZEND_ARG_INFO(0, size)
-       ZEND_ARG_INFO(0, foreground)
-       ZEND_ARG_INFO(0, background)
-       ZEND_ARG_INFO(0, xcoord)
-       ZEND_ARG_INFO(0, ycoord)
-       ZEND_ARG_INFO(0, space)
-       ZEND_ARG_INFO(0, tightness)
-       ZEND_ARG_INFO(0, angle)
-       ZEND_ARG_INFO(0, antialias)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepsbbox, 0, 0, 3)
-       ZEND_ARG_INFO(0, text)
-       ZEND_ARG_INFO(0, font)
-       ZEND_ARG_INFO(0, size)
-       ZEND_ARG_INFO(0, space)
-       ZEND_ARG_INFO(0, tightness)
-       ZEND_ARG_INFO(0, angle)
-ZEND_END_ARG_INFO()
-#endif
-
 ZEND_BEGIN_ARG_INFO_EX(arginfo_image2wbmp, 0, 0, 1)
        ZEND_ARG_INFO(0, im)
        ZEND_ARG_INFO(0, filename)
@@ -1005,18 +944,6 @@ const zend_function_entry gd_functions[] = {
 #endif
 #endif
 
-#ifdef HAVE_LIBT1
-       PHP_FE(imagepsloadfont,                                                 arginfo_imagepsloadfont)
-       /*
-       PHP_FE(imagepscopyfont,                                                 arginfo_imagepscopyfont)
-       */
-       PHP_FE(imagepsfreefont,                                                 arginfo_imagepsfreefont)
-       PHP_FE(imagepsencodefont,                                               arginfo_imagepsencodefont)
-       PHP_FE(imagepsextendfont,                                               arginfo_imagepsextendfont)
-       PHP_FE(imagepsslantfont,                                                arginfo_imagepsslantfont)
-       PHP_FE(imagepstext,                                                             arginfo_imagepstext)
-       PHP_FE(imagepsbbox,                                                             arginfo_imagepsbbox)
-#endif
        PHP_FE(imagetypes,                                                              arginfo_imagetypes)
 
 #if defined(HAVE_GD_JPG)
@@ -1044,11 +971,7 @@ zend_module_entry gd_module_entry = {
        "gd",
        gd_functions,
        PHP_MINIT(gd),
-#if HAVE_LIBT1
-       PHP_MSHUTDOWN(gd),
-#else
        NULL,
-#endif
        NULL,
 #if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE
        PHP_RSHUTDOWN(gd),
@@ -1103,22 +1026,6 @@ void php_gd_error_method(int type, const char *format, va_list args)
 /* }}} */
 #endif
 
-/* {{{ PHP_MSHUTDOWN_FUNCTION
- */
-#if HAVE_LIBT1
-PHP_MSHUTDOWN_FUNCTION(gd)
-{
-       T1_CloseLib();
-#if HAVE_GD_BUNDLED && HAVE_LIBFREETYPE
-       gdFontCacheMutexShutdown();
-#endif
-       UNREGISTER_INI_ENTRIES();
-       return SUCCESS;
-}
-#endif
-/* }}} */
-
-
 /* {{{ PHP_MINIT_FUNCTION
  */
 PHP_MINIT_FUNCTION(gd)
@@ -1129,13 +1036,6 @@ PHP_MINIT_FUNCTION(gd)
 #if HAVE_GD_BUNDLED && HAVE_LIBFREETYPE
        gdFontCacheMutexSetup();
 #endif
-#if HAVE_LIBT1
-       T1_SetBitmapPad(8);
-       T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE);
-       T1_SetLogLevel(T1LOG_DEBUG);
-       le_ps_font = zend_register_list_destructors_ex(php_free_ps_font, NULL, "gd PS font", module_number);
-       le_ps_enc = zend_register_list_destructors_ex(php_free_ps_enc, NULL, "gd PS encoding", module_number);
-#endif
 #ifndef HAVE_GD_BUNDLED
        gdSetErrorMethod(php_gd_error_method);
 #endif
@@ -1318,10 +1218,6 @@ PHP_MINFO_FUNCTION(gd)
 #endif
 #endif
 
-#ifdef HAVE_LIBT1
-       php_info_print_table_row(2, "T1Lib Support", "enabled");
-#endif
-
        php_info_print_table_row(2, "GIF Read Support", "enabled");
        php_info_print_table_row(2, "GIF Create Support", "enabled");
 
@@ -1379,12 +1275,6 @@ PHP_FUNCTION(gd_info)
 #else
        add_assoc_bool(return_value, "FreeType Support", 0);
 #endif
-
-#ifdef HAVE_LIBT1
-       add_assoc_bool(return_value, "T1Lib Support", 1);
-#else
-       add_assoc_bool(return_value, "T1Lib Support", 0);
-#endif
        add_assoc_bool(return_value, "GIF Read Support", 1);
        add_assoc_bool(return_value, "GIF Create Support", 1);
 #ifdef HAVE_GD_JPG
@@ -4011,475 +3901,6 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
 /* }}} */
 #endif /* ENABLE_GD_TTF */
 
-#if HAVE_LIBT1
-
-/* {{{ php_free_ps_font
- */
-static void php_free_ps_font(zend_resource *rsrc)
-{
-       int *font = (int *)rsrc->ptr;
-
-       T1_DeleteFont(*font);
-       efree(font);
-}
-/* }}} */
-
-/* {{{ php_free_ps_enc
- */
-static void php_free_ps_enc(zend_resource *rsrc)
-{
-       char **enc = (char **)rsrc->ptr;
-
-       T1_DeleteEncoding(enc);
-}
-/* }}} */
-
-/* {{{ proto resource imagepsloadfont(string pathname)
-   Load a new font from specified file */
-PHP_FUNCTION(imagepsloadfont)
-{
-       zend_string *file;
-       int f_ind, *font;
-#ifdef PHP_WIN32
-       zend_stat_t st;
-#endif
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &file) == FAILURE) {
-               return;
-       }
-
-#ifdef PHP_WIN32
-       if (VCWD_STAT(file->val, &st) < 0) {
-               php_error_docref(NULL, E_WARNING, "Font file not found (%s)", file);
-               RETURN_FALSE;
-       }
-#endif
-
-       f_ind = T1_AddFont(file->val);
-
-       if (f_ind < 0) {
-               php_error_docref(NULL, E_WARNING, "T1Lib Error (%i): %s", f_ind, T1_StrError(f_ind));
-               RETURN_FALSE;
-       }
-
-       if (T1_LoadFont(f_ind)) {
-               php_error_docref(NULL, E_WARNING, "Couldn't load the font");
-               RETURN_FALSE;
-       }
-
-       font = (int *) emalloc(sizeof(int));
-       *font = f_ind;
-       RETURN_RES(zend_register_resource(font, le_gd));
-}
-/* }}} */
-
-/* {{{ proto int imagepscopyfont(int font_index)
-   Make a copy of a font for purposes like extending or reenconding */
-/* The function in t1lib which this function uses seem to be buggy...
-PHP_FUNCTION(imagepscopyfont)
-{
-       int l_ind, type;
-       gd_ps_font *nf_ind, *of_ind;
-       zend_long fnt;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &fnt) == FAILURE) {
-               return;
-       }
-
-       of_ind = zend_list_find(fnt, &type);
-
-       if (type != le_ps_font) {
-               php_error_docref(NULL, E_WARNING, "%ld is not a Type 1 font index", fnt);
-               RETURN_FALSE;
-       }
-
-       nf_ind = emalloc(sizeof(gd_ps_font));
-       nf_ind->font_id = T1_CopyFont(of_ind->font_id);
-
-       if (nf_ind->font_id < 0) {
-               l_ind = nf_ind->font_id;
-               efree(nf_ind);
-               switch (l_ind) {
-                       case -1:
-                               php_error_docref(NULL, E_WARNING, "FontID %d is not loaded in memory", l_ind);
-                               RETURN_FALSE;
-                               break;
-                       case -2:
-                               php_error_docref(NULL, E_WARNING, "Tried to copy a logical font");
-                               RETURN_FALSE;
-                               break;
-                       case -3:
-                               php_error_docref(NULL, E_WARNING, "Memory allocation fault in t1lib");
-                               RETURN_FALSE;
-                               break;
-                       default:
-                               php_error_docref(NULL, E_WARNING, "An unknown error occurred in t1lib");
-                               RETURN_FALSE;
-                               break;
-               }
-       }
-
-       nf_ind->extend = 1;
-       l_ind = zend_list_insert(nf_ind, le_ps_font);
-       RETURN_LONG(l_ind);
-}
-*/
-/* }}} */
-
-/* {{{ proto bool imagepsfreefont(resource font_index)
-   Free memory used by a font */
-PHP_FUNCTION(imagepsfreefont)
-{
-       zval *fnt;
-       int *f_ind;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &fnt) == FAILURE) {
-               return;
-       }
-
-       if ((f_ind = (int *)zend_fetch_resource(Z_RES_P(fnt), "Type 1 font", le_ps_font)) == NULL) {
-               RETURN_FALSE;
-       }
-
-       zend_list_close(Z_RES_P(fnt));
-       RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imagepsencodefont(resource font_index, string filename)
-   To change a fonts character encoding vector */
-PHP_FUNCTION(imagepsencodefont)
-{
-       zval *fnt;
-       char *enc, **enc_vector;
-       size_t enc_len;
-       int *f_ind;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp", &fnt, &enc, &enc_len) == FAILURE) {
-               return;
-       }
-
-       if ((f_ind = (int *)zend_fetch_resource(Z_RES_P(fnt), "Type 1 font", le_ps_font)) == NULL) {
-               RETURN_FALSE;
-       }
-
-       if ((enc_vector = T1_LoadEncoding(enc)) == NULL) {
-               php_error_docref(NULL, E_WARNING, "Couldn't load encoding vector from %s", enc);
-               RETURN_FALSE;
-       }
-
-       T1_DeleteAllSizes(*f_ind);
-       if (T1_ReencodeFont(*f_ind, enc_vector)) {
-               T1_DeleteEncoding(enc_vector);
-               php_error_docref(NULL, E_WARNING, "Couldn't re-encode font");
-               RETURN_FALSE;
-       }
-
-       zend_list_insert(enc_vector, le_ps_enc);
-
-       RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imagepsextendfont(resource font_index, float extend)
-   Extend or or condense (if extend < 1) a font */
-PHP_FUNCTION(imagepsextendfont)
-{
-       zval *fnt;
-       double ext;
-       int *f_ind;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "rd", &fnt, &ext) == FAILURE) {
-               return;
-       }
-
-       if ((f_ind = (int *)zend_fetch_resource(Z_RES_P(fnt), "Type 1 font", le_ps_font)) == NULL) {
-               RETURN_FALSE;
-       }
-
-       T1_DeleteAllSizes(*f_ind);
-
-       if (ext <= 0) {
-               php_error_docref(NULL, E_WARNING, "Second parameter %F out of range (must be > 0)", ext);
-               RETURN_FALSE;
-       }
-
-       if (T1_ExtendFont(*f_ind, ext) != 0) {
-               RETURN_FALSE;
-       }
-
-       RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto bool imagepsslantfont(resource font_index, float slant)
-   Slant a font */
-PHP_FUNCTION(imagepsslantfont)
-{
-       zval *fnt;
-       double slt;
-       int *f_ind;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "rd", &fnt, &slt) == FAILURE) {
-               return;
-       }
-
-       if ((f_ind = (int *)zend_fetch_resource(Z_RES_P(fnt), "Type 1 font", le_ps_font)) == NULL) {
-               RETURN_FALSE;
-       }
-
-       if (T1_SlantFont(*f_ind, slt) != 0) {
-               RETURN_FALSE;
-       }
-
-       RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto array imagepstext(resource image, string text, resource font, int size, int foreground, int background, int xcoord, int ycoord [, int space [, int tightness [, float angle [, int antialias])
-   Rasterize a string over an image */
-PHP_FUNCTION(imagepstext)
-{
-       zval *img, *fnt;
-       int i, j;
-       zend_long _fg, _bg, x, y, size, space = 0, aa_steps = 4, width = 0;
-       int *f_ind;
-       int h_lines, v_lines, c_ind;
-       int rd, gr, bl, fg_rd, fg_gr, fg_bl, bg_rd, bg_gr, bg_bl;
-       int fg_al, bg_al, al;
-       int aa[16];
-       int amount_kern, add_width;
-       double angle = 0.0, extend;
-       unsigned long aa_greys[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
-       gdImagePtr bg_img;
-       GLYPH *str_img;
-       T1_OUTLINE *char_path, *str_path;
-       T1_TMATRIX *transform = NULL;
-       zend_string *str;
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSrlllll|lldl", &img, &str, &fnt, &size, &_fg, &_bg, &x, &y, &space, &width, &angle, &aa_steps) == FAILURE) {
-               return;
-       }
-
-       if (aa_steps != 4 && aa_steps != 16) {
-               php_error_docref(NULL, E_WARNING, "Antialias steps must be 4 or 16");
-               RETURN_FALSE;
-       }
-
-       if ((bg_img = (gdImagePtr)zend_fetch_resource(Z_RES_P(img), "Image", le_gd)) == NULL) {
-               RETURN_FALSE;
-       }
-       if ((f_ind = (int *)zend_fetch_resource(Z_RES_P(fnt), "Type 1 font", le_ps_font)) == NULL) {
-               RETURN_FALSE;
-       }
-
-       /* Ensure that the provided colors are valid */
-       if (_fg < 0 || (!gdImageTrueColor(bg_img) && _fg > gdImageColorsTotal(bg_img))) {
-               php_error_docref(NULL, E_WARNING, "Foreground color index %pd out of range", _fg);
-               RETURN_FALSE;
-       }
-
-       if (_bg < 0 || (!gdImageTrueColor(bg_img) && _fg > gdImageColorsTotal(bg_img))) {
-               php_error_docref(NULL, E_WARNING, "Background color index %pd out of range", _bg);
-               RETURN_FALSE;
-       }
-
-       fg_rd = gdImageRed  (bg_img, _fg);
-       fg_gr = gdImageGreen(bg_img, _fg);
-       fg_bl = gdImageBlue (bg_img, _fg);
-       fg_al = gdImageAlpha(bg_img, _fg);
-
-       bg_rd = gdImageRed  (bg_img, _bg);
-       bg_gr = gdImageGreen(bg_img, _bg);
-       bg_bl = gdImageBlue (bg_img, _bg);
-       bg_al = gdImageAlpha(bg_img, _bg);
-
-       for (i = 0; i < aa_steps; i++) {
-               rd = bg_rd + (double) (fg_rd - bg_rd) / aa_steps * (i + 1);
-               gr = bg_gr + (double) (fg_gr - bg_gr) / aa_steps * (i + 1);
-               bl = bg_bl + (double) (fg_bl - bg_bl) / aa_steps * (i + 1);
-               al = bg_al + (double) (fg_al - bg_al) / aa_steps * (i + 1);
-               aa[i] = gdImageColorResolveAlpha(bg_img, rd, gr, bl, al);
-       }
-
-       T1_AASetBitsPerPixel(8);
-
-       switch (aa_steps) {
-               case 4:
-                       T1_AASetGrayValues(0, 1, 2, 3, 4);
-                       T1_AASetLevel(T1_AA_LOW);
-                       break;
-               case 16:
-                       T1_AAHSetGrayValues(aa_greys);
-                       T1_AASetLevel(T1_AA_HIGH);
-                       break;
-               default:
-                       php_error_docref(NULL, E_WARNING, "Invalid value %pd as number of steps for antialiasing", aa_steps);
-                       RETURN_FALSE;
-       }
-
-       if (angle) {
-               transform = T1_RotateMatrix(NULL, angle);
-       }
-
-       if (width) {
-               extend = T1_GetExtend(*f_ind);
-               str_path = T1_GetCharOutline(*f_ind, str->val[0], size, transform);
-
-               if (!str_path) {
-                       if (T1_errno) {
-                               php_error_docref(NULL, E_WARNING, "T1Lib Error: %s", T1_StrError(T1_errno));
-                       }
-                       RETURN_FALSE;
-               }
-
-               for (i = 1; i < str->len; i++) {
-                       amount_kern = (int) T1_GetKerning(*f_ind, str->val[i - 1], str->val[i]);
-                       amount_kern += str->val[i - 1] == ' ' ? space : 0;
-                       add_width = (int) (amount_kern + width) / extend;
-
-                       char_path = T1_GetMoveOutline(*f_ind, add_width, 0, 0, size, transform);
-                       str_path = T1_ConcatOutlines(str_path, char_path);
-
-                       char_path = T1_GetCharOutline(*f_ind, str->val[i], size, transform);
-                       str_path = T1_ConcatOutlines(str_path, char_path);
-               }
-               str_img = T1_AAFillOutline(str_path, 0);
-       } else {
-               str_img = T1_AASetString(*f_ind, str->val,  str->len, space, T1_KERNING, size, transform);
-       }
-       if (T1_errno) {
-               php_error_docref(NULL, E_WARNING, "T1Lib Error: %s", T1_StrError(T1_errno));
-               RETURN_FALSE;
-       }
-
-       h_lines = str_img->metrics.ascent -  str_img->metrics.descent;
-       v_lines = str_img->metrics.rightSideBearing - str_img->metrics.leftSideBearing;
-
-       for (i = 0; i < v_lines; i++) {
-               for (j = 0; j < h_lines; j++) {
-                       switch (str_img->bits[j * v_lines + i]) {
-                               case 0:
-                                       break;
-                               default:
-                                       c_ind = aa[str_img->bits[j * v_lines + i] - 1];
-                                       gdImageSetPixel(bg_img, x + str_img->metrics.leftSideBearing + i, y - str_img->metrics.ascent + j, c_ind);
-                                       break;
-                       }
-               }
-       }
-
-       array_init(return_value);
-
-       add_next_index_long(return_value, str_img->metrics.leftSideBearing);
-       add_next_index_long(return_value, str_img->metrics.descent);
-       add_next_index_long(return_value, str_img->metrics.rightSideBearing);
-       add_next_index_long(return_value, str_img->metrics.ascent);
-}
-/* }}} */
-
-/* {{{ proto array imagepsbbox(string text, resource font, int size [, int space, int tightness, float angle])
-   Return the bounding box needed by a string if rasterized */
-PHP_FUNCTION(imagepsbbox)
-{
-       zval *fnt;
-       zend_long sz = 0, sp = 0, wd = 0;
-       zend_string *str;
-       int i, space = 0, add_width = 0, char_width, amount_kern;
-       int cur_x, cur_y, dx, dy;
-       int x1, y1, x2, y2, x3, y3, x4, y4;
-       int *f_ind;
-       int per_char = 0;
-       int argc = ZEND_NUM_ARGS();
-       double angle = 0, sin_a = 0, cos_a = 0;
-       BBox char_bbox, str_bbox = {0, 0, 0, 0};
-
-       if (argc != 3 && argc != 6) {
-               ZEND_WRONG_PARAM_COUNT();
-       }
-
-       if (zend_parse_parameters(ZEND_NUM_ARGS(), "Srl|lld", &str, &fnt, &sz, &sp, &wd, &angle) == FAILURE) {
-               return;
-       }
-
-       if (argc == 6) {
-               space = sp;
-               add_width = wd;
-               angle = angle * M_PI / 180;
-               sin_a = sin(angle);
-               cos_a = cos(angle);
-               per_char =  add_width || angle ? 1 : 0;
-       }
-
-       if ((f_ind = (int *)zend_fetch_resource(Z_RES_P(fnt), "Type 1 font", le_ps_font)) == NULL) {
-               RETURN_FALSE;
-       }
-
-#define max(a, b) (a > b ? a : b)
-#define min(a, b) (a < b ? a : b)
-#define new_x(a, b) (int) ((a) * cos_a - (b) * sin_a)
-#define new_y(a, b) (int) ((a) * sin_a + (b) * cos_a)
-
-       if (per_char) {
-               space += T1_GetCharWidth(*f_ind, ' ');
-               cur_x = cur_y = 0;
-
-               for (i = 0; i < str->len; i++) {
-                       if (str->val[i] == ' ') {
-                               char_bbox.llx = char_bbox.lly = char_bbox.ury = 0;
-                               char_bbox.urx = char_width = space;
-                       } else {
-                               char_bbox = T1_GetCharBBox(*f_ind, str->val[i]);
-                               char_width = T1_GetCharWidth(*f_ind, str->val[i]);
-                       }
-                       amount_kern = i ? T1_GetKerning(*f_ind, str->val[i - 1], str->val[i]) : 0;
-
-                       /* Transfer character bounding box to right place */
-                       x1 = new_x(char_bbox.llx, char_bbox.lly) + cur_x;
-                       y1 = new_y(char_bbox.llx, char_bbox.lly) + cur_y;
-                       x2 = new_x(char_bbox.llx, char_bbox.ury) + cur_x;
-                       y2 = new_y(char_bbox.llx, char_bbox.ury) + cur_y;
-                       x3 = new_x(char_bbox.urx, char_bbox.ury) + cur_x;
-                       y3 = new_y(char_bbox.urx, char_bbox.ury) + cur_y;
-                       x4 = new_x(char_bbox.urx, char_bbox.lly) + cur_x;
-                       y4 = new_y(char_bbox.urx, char_bbox.lly) + cur_y;
-
-                       /* Find min & max values and compare them with current bounding box */
-                       str_bbox.llx = min(str_bbox.llx, min(x1, min(x2, min(x3, x4))));
-                       str_bbox.lly = min(str_bbox.lly, min(y1, min(y2, min(y3, y4))));
-                       str_bbox.urx = max(str_bbox.urx, max(x1, max(x2, max(x3, x4))));
-                       str_bbox.ury = max(str_bbox.ury, max(y1, max(y2, max(y3, y4))));
-
-                       /* Move to the next base point */
-                       dx = new_x(char_width + add_width + amount_kern, 0);
-                       dy = new_y(char_width + add_width + amount_kern, 0);
-                       cur_x += dx;
-                       cur_y += dy;
-                       /*
-                       printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", x1, y1, x2, y2, x3, y3, x4, y4, char_bbox.llx, char_bbox.lly, char_bbox.urx, char_bbox.ury, char_width, amount_kern, cur_x, cur_y, dx, dy);
-                       */
-               }
-
-       } else {
-               str_bbox = T1_GetStringBBox(*f_ind, str->val, str->len, space, T1_KERNING);
-       }
-
-       if (T1_errno) {
-               RETURN_FALSE;
-       }
-
-       array_init(return_value);
-       /*
-       printf("%d %d %d %d\n", str_bbox.llx, str_bbox.lly, str_bbox.urx, str_bbox.ury);
-       */
-       add_next_index_long(return_value, (int) ceil(((double) str_bbox.llx)*sz/1000));
-       add_next_index_long(return_value, (int) ceil(((double) str_bbox.lly)*sz/1000));
-       add_next_index_long(return_value, (int) ceil(((double) str_bbox.urx)*sz/1000));
-       add_next_index_long(return_value, (int) ceil(((double) str_bbox.ury)*sz/1000));
-}
-/* }}} */
-#endif
-
 /* {{{ proto bool image2wbmp(resource im [, string filename [, int threshold]])
    Output WBMP image to browser or file */
 PHP_FUNCTION(image2wbmp)
index 2af7887ebcec2ed2e9ee140d41b43e3f1fb7af52..f02c6aba34d3c8a1d097c80424c3406f741acf45 100644 (file)
@@ -70,9 +70,6 @@ extern zend_module_entry gd_module_entry;
 /* gd.c functions */
 PHP_MINFO_FUNCTION(gd);
 PHP_MINIT_FUNCTION(gd);
-#if HAVE_LIBT1
-PHP_MSHUTDOWN_FUNCTION(gd);
-#endif
 #if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE
 PHP_RSHUTDOWN_FUNCTION(gd);
 #endif