php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31523 Character-spacing errors when rendering text with ImageTTFText
Submitted: 2005-01-12 22:25 UTC Modified: 2005-03-27 16:27 UTC
Votes:9
Avg. Score:4.3 ± 0.9
Reproduced:7 of 7 (100.0%)
Same Version:2 (28.6%)
Same OS:2 (28.6%)
From: schellekens at gmail dot com Assigned: edink (profile)
Status: Wont fix Package: GD related
PHP Version: 4CVS-2005-01-18 OS: win32 only
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: schellekens at gmail dot com
New email:
PHP Version: OS:

 

 [2005-01-12 22:25 UTC] schellekens at gmail dot com
Description:
------------
i noticed that in 4.3.9 for win32, rendering a text with ImageTTFText causes ugly character-spacing. rendering went better with version 4.3.3 which i used before.

look at these differences:
good (older)- http://www.europe-re.com/snd/right.png
wrong (4.3.9) - http://www.europe-re.com/snd/wrong.png 

it may seem a minor detail but it just looks plain ugly now. i also tested on Apache/1.3.26 (Unix) Debian GNU/Linux PHP/4.3.9-1.dotdeb.3 which rendered correctly.

Some info:

- PHP Version 4.3.9 (windows binary)
- Apache/1.3.28 (Win32) PHP/4.3.9 DAV/1.0.3-dev 

*** configure line missing in this windows build! ***

GD Support  enabled  
GD Version  bundled (2.0.28 compatible)  
FreeType Support  enabled  
FreeType Linkage  with freetype  
GIF Read Support  enabled  
GIF Create Support  enabled  
JPG Support  enabled  
PNG Support  enabled  
WBMP Support  enabled  
XBM Support  enabled  



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-14 14:49 UTC] schellekens at gmail dot com
hi again, here's an example script.  also 2 versions of the same script.

the wrong rendering using php 4.3.9 win32:
http://www.europe-re.com/snd/incorrect.png

the correct rendering using php 4.3.9 Debian:
http://www.europe-re.com/snd/correct.png

the script:

<?php
	// ================================
	// Parameters
	// ================================

	$imgw 	= 200;
	$imgh 	= 20;
	$fcol 	= "000000";
	$bcol 	= "e0e0e0";
	$fsiz 	= 8;
	$ftxt 	= "Beware of weird foggy bibberish spam";
	$xpos	= 10;
	$ypos	= 13;
	$ftyp	= str_replace("\\", "/", getcwd()) . "/fonts/arial.ttf";		// font to use

	// ================================
	// create from scratch
	// ================================

	$imgd	= ImageCreate ($imgw, $imgh);
	$bcol 	= ImageColorAllocate ($imgd, hexdec(substr($bcol, 0, 2)), hexdec(substr($bcol, 2, 2)), hexdec(substr($bcol, 4, 2)));
	$fcol 	= ImageColorAllocate ($imgd, hexdec(substr($fcol, 0, 2)), hexdec(substr($fcol, 2, 2)), hexdec(substr($fcol, 4, 2)));

	ImageFill ($imgd, 0, 0, $bcol);
	ImageTTFText ($imgd, $fsiz, $rota, $xpos+$xoff, $ypos, $fcol, $ftyp, $ftxt);

	// ================================
	// Output het plaatje
	// ================================

	header			("Content-type: image/png");
	ImagePNG 		($imgd);
	ImageDestroy 	($imgd);
	exit();
?>
 [2005-01-14 14:51 UTC] schellekens at gmail dot com
> also 2 versions of the same script.

i mean 2 rendering output images by the same script on win32 vs debian...
 [2005-01-14 23:48 UTC] sniper@php.net
Please add the configure line of PHP in the debian machine.

 [2005-01-15 15:10 UTC] schellekens at gmail dot com
To confuse things a bit: my provider upgraded our debian colocated server yesterday to php 4.3.10, so i give you the configure line of this version instead of 4.3.9. The situation hasn't changed though: good text rendering on the debian (both on 4.3.9 and 4.3.10) and bad rendering on 4.3.9-win32. I can't figure out why i don't get a configure line on my win32 version through phpinfo(), is this common?

Configure Command of PHP Version 4.3.10-1.dotdeb.0 (from phpinfo()):

'../configure' '--prefix=/usr' '--with-apxs=/usr/bin/apxs' '--with-regex=php' '--with-config-file-path=/etc/php4/apache' '--disable-rpath' '--enable-memory-limit' '--disable-debug' '--with-layout=GNU' '--enable-calendar' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-bcmath' '--with-bz2' '--enable-ctype' '--with-db2' '--with-iconv' '--enable-exif' '--enable-filepro' '--enable-ftp' '--enable-dbase' '--with-gettext' '--enable-mbstring' '--with-pcre-regex' '--enable-shmop' '--enable-sockets' '--enable-wddx' '--enable-tokenizer' '--disable-xml' '--with-expat-dir=/usr' '--with-xmlrpc' '--enable-yp' '--with-zlib' '--without-pgsql' '--with-kerberos=/usr' '--with-openssl=/usr' '--enable-dbx' '--with-mime-magic' '--with-exec-dir=/usr/lib/php4/libexec' '--disable-static' '--disable-cli' '--without-pear' '--with-curl=shared,/usr' '--with-dom=shared,/usr' '--with-dom-xslt=shared,/usr' '--with-dom-exslt=shared,/usr' '--with-zlib-dir=/usr' '--with-gd=shared' '--enable-gd-native-ttf' '--with-jpeg-dir=shared,/usr' '--with-xpm-dir=shared,/usr/X11R6' '--with-png-dir=shared,/usr' '--with-freetype-dir=shared,/usr' '--with-mcrypt=shared,/usr' '--with-ming=shared,/usr' '--with-gmp=shared,/usr' '--with-imap=shared,/usr' '--with-imap-ssl' '--with-ldap=shared,/usr' '--with-mcal=shared,/usr' '--with-mhash=shared,/usr' '--with-mm' '--with-mysql=shared,/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-pgsql=shared,/usr' '--with-unixODBC=shared,/usr' '--with-recode=shared,/usr' '--enable-xslt=shared' '--with-xslt-sablot=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-sybase-ct=shared,/usr' '--with-ttf=shared,/usr' '--with-t1lib=shared,/usr'
 [2005-01-17 19:35 UTC] schellekens at gmail dot com
hi, i tried with the cvs version 4.3.11-dev / GD Version 2.0.28, but no change in situation: still nasty character-spacing on win32 version. 

besides using a font/point-size of 8 in ImageTTFText() like in my example, i tried other sizes to be sure it's not some kind of rounding problem, and the ugly spacing kept appearing.
 [2005-01-18 12:19 UTC] sniper@php.net
Edin, please check the versions of freetype, etc. in the win32 build.

 [2005-03-06 01:38 UTC] seggluk at yahoo dot co dot uk
I confirm this bug :(
Problem will solve in the next win32 release?
 [2005-03-26 02:18 UTC] edink@php.net
We had some problem with the libraries that were crashing the PHP so we have upgraded all GD related libs to the latest versions. The crashes went away but some font rendereing is different and there is nothing we can do about it.
 [2005-03-27 16:27 UTC] schellekens at gmail dot com
so i understand the problem lies in windows version of the GD library?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 13:01:29 2024 UTC