Bug 70872 - libgd was not built with TrueType font support
Summary: libgd was not built with TrueType font support
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gd
Version: 7.2
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Phil Knirsch
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-08-06 12:06 UTC by Xavier Del Collado i Pics
Modified: 2015-03-05 01:11 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2002-08-07 15:47:06 UTC

Attachments (Terms of Use)

Description Xavier Del Collado i Pics 2002-08-06 12:06:02 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461)

Description of problem:

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Edit this test 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; 

2. Compile with: gcc gdttf.c -lgd -ljpeg -lpng -lfreetype -lm
3. Execute:  ./a.out
4. You can see..."TTF returns libgd was not built with TrueType font support"

Additional info:

Packages installed ( and related to this bug ):


Comment 1 Xavier Del Collado i Pics 2002-08-06 20:20:24 UTC
Here is another example to see what happens:

1.- Edit this:
  Header("Content-type: image/png");
  if(!isset($s)) $s=11;
  $text="Hola pollo";
  $size = imagettfbbox($s,0,"/usr/share/fonts/times.ttf",$text);
  $dx = abs($size[2]-$size[0]);
  $dy = abs($size[5]-$size[3]);
  $im = imagecreate($dx+$xpad,$dy+$ypad);
  $blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
  $black = ImageColorAllocate($im, 0,0,0);
  $white = ImageColorAllocate($im, 255,255,255);
  ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), 
$black, "/usr/share/fonts/times.ttf", $text);
  ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, 
$white, "/usr/share/fonts/times.ttf", $text);
2.- Put it in apache ( apache-1.3.22-6 )

3.- See: ( http://lopitit.utopia.ct/button3.php ) - intranet, sorry... -

<b>Warning</b>:  libgd was not built with TrueType font support
 in <b>/home/www/html-lopitit.utopia.ct/button3.php</b> on line <b>5</b><br>
<b>Warning</b>:  libgd was not built with TrueType font support
 in <b>/home/www/html-lopitit.utopia.ct/button3.php</b> on line <b>16</b><br>
<b>Warning</b>:  libgd was not built with TrueType font support
 in <b>/home/www/html-lopitit.utopia.ct/button3.php</b> on line <b>17</b><br>

IHDR		n	PLTE,m/(IDATxcX5*!A'j!_?9AodIEND.B`


Comment 2 Xavier Del Collado i Pics 2002-08-07 07:58:07 UTC
Looking at gd source code ( gd-1.8.4-4.src.rpm ), seems that gd only supports 
FreeType 2. From gd.spec: 

* Fri Jul 20 2001 Bernhard Rosenkraenzer <bero@redhat.com> 1.8.4-3
- There's really no reason to link against both freetype 1.x and 2.x,
  especially when gd is configured to use just freetype 2.x. ;)

If you modify first example to use gdImageStringFT function instead 
gdImageStringTTF, you can verify that. Now works... great... but it isn't easy 
to modify every function from xxxxxTTF to xxxxxFT

But the main problem is PHP; last version released for RH7.2 is php-4.0.6-15 
which no support yyyyyyFT functions.

If you modify second example ( button4.php ) to use imageftbbox and ImageFTText 
functions instead imagettfbbox and ImageTTFText, you got:
# php button4.php 
X-Powered-By: PHP/4.0.6
Content-type: image/png

<b>Fatal error</b>:  Call to undefined function:  imageftbbox() in 
<b>button4.php</b> on line <b>5</b><br>

Sadly, yyyyyyFT functions in PHP are supported for (PHP 4 >= 4.1.0), as you can 
see at http://www.php.net/manual/en/function.imageftbbox.php

It seems that gd must support FreeType v.1 and FreeType v.2 

Comment 3 Xavier Del Collado i Pics 2002-08-07 15:47:02 UTC
1.- gd-1.8.4-4 uses by default ( defined at compile time ) FreeType v.2.
2.- gd-1.8.4-4 doesn't handle xxxxxxTTF functions.
3.- gd-1.8.4-4 handle xxxxxxFT functions.
4.- gd 2.0.1 does the same
4.- php-4.0.6-15 handle yyyyyyTTF functions.
5.- php-4.0.6-15 doesn't handle yyyyyyFT functions.
6.- php ( version >= 4.1.0 ) handle yyyyyyFT functions.

Perhaps would be better RH releases php4 >= 4.1.0 for 7.2

Comment 4 Phil Knirsch 2002-08-08 11:50:00 UTC
7.2 was the release where we made the switch from Freetype 1 to Freetype 2. All
these things have been addressed in 7.3, so i'd recommend to upgrade your system
to 7.3.

Read ya, Phil

Note You need to log in before you can comment on or make changes to this bug.