[Resolved] GD Library - imagettfbbox() function help needed
Posted: Sun Apr 08, 2007 7:54 am
Hi,
I'm getting angry today I have spent too much time on this one for nothing
For some reason I get different $text_width for letters '9' and '8' :S
I've tried all these and actually all these code did the same - no difference:
Does anyone have a solution for this? I need to get the width of the text to align my texts properly.
Now the texts are being offset by 0-3 pixels depending on the letters :S
I'm getting angry today I have spent too much time on this one for nothing
For some reason I get different $text_width for letters '9' and '8' :S
I've tried all these and actually all these code did the same - no difference:
Code: Select all
$image_data = imagettfbbox(8,0,$font,$highest.'0');
$text_width = max($text_data[2],$text_data[4])-min($text_data[0],$text_data[6]);
$image_data = imagettfbbox(8,0,$font,$highest.'0');
$text_width = abs($image_data[2]-$image_data[0]);
$image_data = imagettfbbox(8,0,$font,$highest.'0');
$text_width = abs($image_data[2])+abs($image_data[0]);Now the texts are being offset by 0-3 pixels depending on the letters :S