Problem with TTF file

From: Date: Thu, 16 Oct 2008 19:14:43 +0000
Subject: Problem with TTF file
Groups: php.gd.devel 
Request: Send a blank email to php-gd-devel+get-483@lists.php.net to get a copy of this message
Hi All, I am having major problems with a PHP script that generates barcodes as PNG image. It is currently running without a problem on a website with an old version of Debian. However, now that I am moving the site to a new server, the script stops working. The function is pretty basic: function create_image() { header('Content-type: image/png'); $box = ImageTTFbbox($this->fontsize, 0, $this->fontfile, $this->article); $src_img = ImageCreate(($box[2]+11), (abs($box[7]-$box[1])+6)); $black = ImageColorAllocate($src_img, 0x00, 0x00, 0x00); $white = ImageColorAllocate($src_img, 0xff, 0xff, 0xff); ImageFill($src_img, 0, 0, $white); ImageColorTransparent($src_img, $white); ImageTTFText($src_img, $this->fontsize, 0, 3, abs($box[7]), $black, $this->fontfile, $this->article); ImagePNG($src_img); ImageDestroy($src_img); } Details can be found at 'phpclasses.org slash browse slash file slash 17681 dot html'. The problem is that the function only fails for one certain truetype file, the one that has the barcode in it. As a result, I get a bunch of the rectangles for each character, as it does for any character not in a character set. If I use any other truetype font, it displays ok. So, as a conclusion, there is a problem with the font. But than again, I use this font file for several years now. The GPL font file I use can be downloaded from 'grandzebu dot net slash informatique slash codbar slash ean13 dot ttf' and the string to put in $this->article for testing is 3FJQRLA*cbgahj+ I assume the problem is a mix of a problem both within GD and in the fontfile, even though the font works on any Windows or Linux GUI. Does anyone know how to find out what is causing this, or even better how to fix it again? The old (working) server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_perl/1.999.21 Perl/v5.8.4. GD Version: 2.0 or higher . The new (not so working) server: CentOS release 5.2 (Final) Linux 2.6.18-92.el5 #1 SMP. GD Version: bundled (2.0.34 compatible). Any other details required? Thanks in advance, Marco

« previous php.gd.devel (#483) next »