cvs: /php4 ChangeLog /php4/ext/gd config.h.stub config.m4 gdttf.c
| From: | Sascha Schumann | Date: | Fri, 23 Jul 1999 15:56:47 +0000 |
| Subject: | cvs: /php4 ChangeLog /php4/ext/gd config.h.stub config.m4 gdttf.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-2627@lists.php.net to get a copy of this message | ||
sas Fri Jul 23 11:56:47 1999 EDT
Modified files:
/php4 ChangeLog
/php4/ext/gd config.h.stub config.m4 gdttf.c
Log:
gdttf update
Index: php4/ChangeLog
diff -u php4/ChangeLog:1.14 php4/ChangeLog:1.15
--- php4/ChangeLog:1.14 Fri Jul 23 11:22:36 1999
+++ php4/ChangeLog Fri Jul 23 11:56:46 1999
@@ -2,6 +2,7 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
??? ?? 1999, Version 4.0 Beta 2
+- Merged in gdttf stuff from php3 (Sascha)
- buildconf now checks your installation (Stig)
- XML module now built dynamically with --with-xml=shared (Stig)
- Added a check for freetype.h - fixed build on RedHat 6.0 (Zeev)
Index: php4/ext/gd/config.h.stub
diff -u php4/ext/gd/config.h.stub:1.1 php4/ext/gd/config.h.stub:1.2
--- php4/ext/gd/config.h.stub:1.1 Mon Apr 19 21:23:32 1999
+++ php4/ext/gd/config.h.stub Fri Jul 23 11:56:47 1999
@@ -4,3 +4,6 @@
/* Define if you have the gd version 1.3 library (-lgd). */
#define HAVE_LIBGD13 0
+#undef FREETYPE_4BIT_ANTIALIAS_HACK
+#undef HAVE_LIBFREETYPE
+#undef HAVE_LIBTTF
Index: php4/ext/gd/config.m4
diff -u php4/ext/gd/config.m4:1.4 php4/ext/gd/config.m4:1.5
--- php4/ext/gd/config.m4:1.4 Fri Jul 23 11:18:37 1999
+++ php4/ext/gd/config.m4 Fri Jul 23 11:56:47 1999
@@ -44,11 +44,62 @@
AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ])
])
if test "$ac_cv_lib_gd_gdImageLine" = "yes"; then
+ CHECK_TTF="yes"
+ AC_ARG_WITH(ttf,
+ [ --with-ttf[=DIR] Include Freetype support],[
+ if test $withval = "no" ; then
+ CHECK_TTF=""
+ else
+ CHECK_TTF="$withval"
+ fi
+ ])
+
+ AC_MSG_CHECKING(whether to include ttf support)
+ if test -n "$CHECK_TTF" ; then
+ for i in /usr /usr/local "$CHECK_TTF" ; do
+ if test -f "$i/include/truetype.h" ; then
+ FREETYPE_DIR="$i"
+ fi
+ if test -f "$i/include/freetype.h" ; then
+ TTF_DIR="$i"
+ fi
+ done
+ if test -n "$FREETYPE_DIR" ; then
+ AC_DEFINE(HAVE_LIBFREETYPE)
+ AC_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE_DIR/lib)
+ AC_ADD_INCLUDE($FREETYPE_DIR/include)
+ AC_MSG_RESULT(yes)
+ else
+ if test -n "$TTF_DIR" ; then
+ AC_DEFINE(HAVE_LIBTTF)
+ AC_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib)
+ AC_ADD_INCLUDE($TTF_DIR/include)
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
+ else
+ AC_MSG_RESULT(no)
+ fi
+
if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
GD_INCLUDE="-I/usr/pkg/include/gd"
+ fi
+
+ AC_MSG_CHECKING(whether to enable 4bit antialias hack with FreeType2)
+ AC_ARG_ENABLE(freetype-4bit-antialias-hack,
+ [ --enable-freetype-4bit-antialias-hack For the crazy with FreeType2.],[
+ if test "$enableval" = "yes" ; then
+ AC_DEFINE(FREETYPE_4BIT_ANTIALIAS_HACK, 1)
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
fi
- AC_CHECK_LIB(ttf, TT_Open_Face)
- AC_CHECK_HEADERS(freetype.h)
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
PHP_EXTENSION(gd)
EXTRA_LIBS="$EXTRA_LIBS $GD_LIBS"
INCLUDES="$INCLUDES $GD_INCLUDE"
Index: php4/ext/gd/gdttf.c
diff -u php4/ext/gd/gdttf.c:1.3 php4/ext/gd/gdttf.c:1.4
--- php4/ext/gd/gdttf.c:1.3 Fri Jul 23 11:18:37 1999
+++ php4/ext/gd/gdttf.c Fri Jul 23 11:56:47 1999
@@ -2,14 +2,14 @@
/* */
/* John Ellson ellson@lucent.com */
-/* $Id: gdttf.c,v 1.3 1999/07/23 15:18:37 zeev Exp $ */
+/* $Id: gdttf.c,v 1.4 1999/07/23 15:56:47 sas Exp $ */
#if WIN32|WINNT
#include "config.w32.h"
#else
#include "php_config.h"
#endif
-#ifdef ENABLE_GD_TTF
+#if HAVE_LIBTTF|HAVE_LIBFREETYPE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -17,7 +17,11 @@
#include <gd.h>
#include "gdttf.h"
#include "gdcache.h"
+#if HAVE_LIBFREETYPE
+#include <truetype.h>
+#else
#include <freetype.h>
+#endif
/* number of fonts cached before least recently used is replaced */
#define FONTCACHESIZE 6
@@ -31,7 +35,11 @@
#define BITMAPCACHESIZE 8
/* number of antialias color lookups cached */
+#if FREETYPE_4BIT_ANTIALIAS_HACK
+#define TWEENCOLORCACHESIZE 128
+#else
#define TWEENCOLORCACHESIZE 32
+#endif
/* ptsize below which anti-aliasing is ineffective */
#define MINANTIALIASPTSIZE 0
@@ -40,7 +48,11 @@
#define RESOLUTION 72
/* Number of colors used for anti-aliasing */
+#if FREETYPE_4BIT_ANTIALIAS_HACK
+#define NUMCOLORS 16
+#else
#define NUMCOLORS 4
+#endif
/* Line separation as a factor of font height.
No space between if LINESPACE = 1.00
@@ -379,7 +391,11 @@
a->cos_a = cos(a->angle);
a->engine = b->engine;
if ((err = TT_Open_Face(*b->engine, a->fontname, &a->face))) {
+#if HAVE_LIBFREETYPE
+ if (err == 0x008) { /* The FT2 oldapi is missing this code */
+#else
if (err == TT_Err_Could_Not_Open_File) {
+#endif
*error = "Could not find/open font";
}
else {
@@ -852,7 +868,7 @@
return (char *)NULL;
}
-#endif /* ENABLE_GD_TTF */
+#endif /* HAVE_LIBTTF|HAVE_LIBFREETYPE */
/*
* Local variables: