Browse Source

gdttf update

experimetnal/RETURN_REF_PATCH
Sascha Schumann 27 years ago
parent
commit
33f30aee64
  1. 1
      ChangeLog
  2. 3
      ext/gd/config.h.stub
  3. 55
      ext/gd/config.m4
  4. 20
      ext/gd/gdttf.c

1
ChangeLog

@ -2,6 +2,7 @@ PHP 4.0 CHANGE LOG ChangeLog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
??? ?? 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)

3
ext/gd/config.h.stub

@ -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

55
ext/gd/config.m4

@ -44,11 +44,62 @@ dnl A whole whack of possible places where this might be
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_CHECK_LIB(ttf, TT_Open_Face)
AC_CHECK_HEADERS(freetype.h)
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_MSG_RESULT(no)
])
PHP_EXTENSION(gd)
EXTRA_LIBS="$EXTRA_LIBS $GD_LIBS"
INCLUDES="$INCLUDES $GD_INCLUDE"

20
ext/gd/gdttf.c

@ -9,7 +9,7 @@
#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 @@ fontFetch ( char **error, void *key )
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 @@ gdttf(gdImage *im, int *brect, int fg, char *fontname,
return (char *)NULL;
}
#endif /* ENABLE_GD_TTF */
#endif /* HAVE_LIBTTF|HAVE_LIBFREETYPE */
/*
* Local variables:

Loading…
Cancel
Save