I'm trying to render text aligned within the center of a box using imagettftext() and a standard Arial Bold font.
I'm developing the code on a Mac and the text aligns in the center of a box just the way I would expect. But then I deploy my code to a proper linux server and it seems the origin the text is render from is different and the kerning is off.
I have confirmed I'm on the latest and greatest version of php and php gd on both machines.
See example images below:
This is what happens on mac
This is what happens on linux
My question has anyone experience this before and know of a fix or workaround for this issue with out having to resort to actually just offsetting the text a couple of pixels on the linux server. Or is there something I'm missing when it comes to rendering text with the above function?
EDIT: I do use imagettfbbox() to get the size of the text I'm rendering to center it properly (I also have tried dummy rendering using imagettftext() to get the bounding box as well, the problem seems to be the origin imagettftext() renders too is strange)
EDIT 2: Maybe its a difference between implementations in freetype? though I would hope they use the same code base