Search code examples
phpimagegd

PHP update kerning problem with imagettftext() and imagefttext() functions


Our dev server was recently upgraded to PHP v5.2.13. With that upgrade we have found that our png images are having kerning (letter spacing) problems. We've tried numerous fonts and haven't found a solution yet.

We are creating images using the GD library and writing text to the images using font files and the imagettftext() or imagefttext() functions.

Has anyone else run into this? Am I misunderstanding something or should this be submitted to PHP as a bug? Are there any cool workarounds I haven't thought of yet?

Here's an example of the new and old tahoma bold. Other fonts (bold and non-bold) have the same problem. Some letters and numbers seem like they're off-center or something like that.

Bad - new PHP

Good - old PHP v5.2.11 (the words are slightly different because this is our dev server and the other one is the live server)


Solution

  • "Tracking" is a similar term for how tight or loose text is set. You might have better luck googling for that, such as this result.