php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12065 "libgd was not built with TrueType font support" problem
Submitted: 2001-07-11 16:08 UTC Modified: 2001-07-16 08:24 UTC
From: rip at undernet dot org Assigned: wez (profile)
Status: Closed Package: GD related
PHP Version: 4.0.6 OS: FreeBSD 4.3
Private report: No CVE-ID: None
 [2001-07-11 16:08 UTC] rip at undernet dot org
<? imagettfbbox(5, 0, "x.ttf", "the text"); ?>
shows : Warning: libgd was not built with TrueType font support in /www/test2.php on line 1

phpinfo();
shows :
gd
GD Support enabled 
GD Version 1.6.2 or higher 
FreeType Support enabled 
FreeType Linkage with freetype 
JPG Support enabled 
PNG Support enabled 
WBMP Support enabled 

So basically I'd say something is not working correctly.
I have tried with PHP 4.0.6 on 2 FreeBSD servers I have.

Here's my configure line :
./configure --enable-inline-optimization --with-apxs --enable-calendar --enable-ftp --enable-track-vars --with-gd=/usr/local --with-freetype-dir=/usr/local --with-mysql

All looks ok during config & compilation of PHP.
Here's what shows:
checking whether to include GD support... yes
checking whether to enable truetype string function in gd... no
checking for freetype(2)... yes
checking whether to include include FreeType 1.x support... no
checking whether to include T1lib support... no
checking for gdImageString16 in -lgd... (cached) yes
checking for gdImagePaletteCopy in -lgd... (cached) yes
checking for gdImageCreateFromPng in -lgd... (cached) yes
checking for gdImageCreateFromGif in -lgd... (cached) no
...

I tried with --enable-gd-native-ttf and --enable-gd-imgstrttf, it's not better.

Also note that there is an error in the configure script :
> cat configure | grep -i native-tt
  --enable-gd-native-ttf    GD: Enable TrueType string function in gd"
# Check whether --enable-gd-native-tt or --disable-gd-native-tt was given.

It's confusing... --enable-gd-native-tt or --enable-gd-native-ttf ?

Thanks,
Philippe Bourcier

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-12 07:39 UTC] wez@php.net
That "libgd was not built with TrueType font support" message comes from the GD library itself, not PHP.

Did you compile the GD library with TrueType font support?

--Wez.
 [2001-07-12 18:26 UTC] wez@php.net
(Please use the web interface to reply!)
User Comment:

Heh, sure...
By default GD doesn't compile without freetype installed.

Today here's what I've tried :

FreeBSD 4.3 :

Apache 1.3.20 + PHP 4.04pl1 + lib GD 1.8.3 + freetype 1.3.1 << doesn't work

Apache 1.3.20 + PHP 4.06 + lib GD 1.8.3 + freetype 1.3.1 << doesn't work

Apache 1.3.20 + PHP 4.06 + lib GD 1.8.4 + freetype 2.0.4 << doesn't work

Apache 1.3.20 + PHP 4.06 + lib GD 2.0.1.beta + freetype 2.0.4 << doesn't work


Linux 2.2 :

Apache 1.3.20 + PHP 4.03pl1 + lib GD 1.8.3 + freetype 1.3.1 << worked

Apache 1.3.20 + PHP 4.06 + lib GD 1.8.4 + freetype 2.0.4 << doesn't work


The only difference in the version that works is PHP is not a dynamic module.
 [2001-07-12 18:28 UTC] wez@php.net
Are you really, really sure that GD is linked with freetype support??

"By default GD doesn't compile without freetype installed"
That statement is not correct in any of the GD sources that I have seen; you need to explicitly enable TTF/Freetype support in the makefiles.

Can you successfully run the GD test programs that work with TTF/Freetype? (if there are any).

--Wez.
 [2001-07-12 18:44 UTC] wez@php.net
Try this short program:

#include <stdio.h>
#include <stdlib.h>
#include "gd.h"

int
main (int argc, char **argv)
{
  gdImagePtr im;

  im = gdImageCreate(100,100);
  printf("TTF returns %s\n",
    gdImageStringTTF(im, NULL, 1, "dummy.ttf",
      12, 0, 0, 0, "test"));
  gdImageDestroy (im);
  return 0;
}

Then do:
gcc gdttf.c -lgd -ljpeg -lpng -lfreetype -lm

Try -lttf instead of -lfreetype, depending on which you have installed.

If you still get the "libgd was not built with TrueType font support", then you haven't build gd with TrueType font support.

If you get any other error, then something screwy is going on.

--Wez.
 [2001-07-12 19:35 UTC] rip at undernet dot org
oops... I had to reply here... sorry.

Re

True, for GD I always have this in the Makefile :
CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE
LIBS=-lgd -lpng -lz -ljpeg -lfreetype -lm

Can you successfully run the GD test programs that work with TTF/Freetype? (if there are any).

Yes.
I modified gdtestft.c to load the arial font instead of the "times" one by default.
http://www.documents.cyberabuse.org/fttest.png

Another proof of GD having freetype compiled with it is the phpinfo() result :

FreeType Support enabled 
FreeType Linkage with freetype 
(with freetype 2)

FreeType Support enabled 
FreeType Linkage with TTF library
(with freetype 1)

If phpinfo() says it's ok and then the function says it's bugged... then I say something is wrong.

 [2001-07-13 03:02 UTC] wez@php.net
The only thing that I can think of is that you have and older version of libgd.so or libgd.a hanging around that is mistakenly being linked in instead of the one you were expecting, and that configure found.

Please look around your system to see if that is the case; I would recommend moving the duplicates to some not in the lib path temporarily while compiling PHP and see if you still have the same problem.

--Wez.
 [2001-07-13 13:31 UTC] rip at undernet dot org
Re

No Way...

That's not the case.

And I have the same error on :
2 FreeBSD 4.3 box
1 linux 2.4.6 box

I say when you compile PHP 4.0.4/4.0.5/4.0.6 as a DSO module, truetype font support is screwed...
 [2001-07-14 08:44 UTC] wez@php.net
It's a GD 1.8.4 problem:
It has both ttf and freetype support in different files; you built it with freetype support, and PHP expects it to use TTF functions, which GD reports are not there.
This problem is not present in GD 2.0.1; the TTF functions call the FT functions instead.
I'll work up a patch for this case, so that PHP can try and stay ahead.
--Wez.
 [2001-07-14 08:59 UTC] wez@php.net
OK, try either using the latest CVS or changing the following line in ext/gd/gd.c of the PHP sources:

-# if HAVE_LIBGD20 & HAVE_LIBFREETYPE
+# if HAVE_LIBFREETYPE

(It's line 2761 for me in CVS; if you can't find it, look for gdImageStringTTF; it's just above it).

I hope that fixes the problem!

--Wez. 
 [2001-07-16 08:24 UTC] rip at undernet dot org
Re

I am now using :
Apache 1.3.20
PHP 4.0.6 + the GD patch
freetype2 2.0.3.1
gd 1.8.4.2

It works fine.

Thanks wez.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 23 18:01:23 2021 UTC