goblin2986
goblin2986

Reputation: 1009

imagettftext with uneven spaces

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

When I run this function I get the image with uneven spaces. like this: this is testin g o fall

alt text http://fb.prideofhome.com/11111.JPG

Upvotes: 1

Views: 1091

Answers (1)

Pekka
Pekka

Reputation: 449465

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.

Upvotes: 3

Related Questions