tags:

views:

120

answers:

2
<?php
imagettftext($im,15,0,470,$m,$black,$font,"this is testing of all");
?>

when i run this function i got the image with uneven spaces. like this: this is testin g o fall

alt text

does anybody know whats the problem is???

A: 

alt text

m getting this... my code is not showin here my code is imagettftext($im,15,0,470,$m,$black,$font,"this is testing of all");

bhaskaragr29
I edited this info into your original question (you can edit your question freely at any time). Answers should be reserved for actual answers - you can delete this one now.
Pekka
+1  A: 

This is a so-called kerning problem. TrueType fonts contain information about the spacing between certain pairs of characters to achieve a natural flow of letters.

From my experience, GD's TrueType function imagettftext() often doesn't use the kerning information contained in TrueType fonts, or does not use them well enough.

Try imagefttext() first. (notice the ft instead of the ttf) It makes use of the FreeType library.

If that doesn't improve the result, you may have to resort to ImageMagick if your server supports it. But try the Freetype functions first.

Pekka