Hi,
I used imagettfbbox function for calculating text width and my code was:-
-----------------------------------------
$bbox = imagettfbbox($font_size, 0, $font_file, $text_string);
$width_text = abs($bbox[4] - $bbox[6]); # width of the text
$height_text = abs($bbox[7] - $bbox[1]); # height of the text
-----------------------------------------
I am getting height value correct, but wrong width value, the width value being returned is more than what is actual value, the error gap increases with font size and/or text length
Please tell me why is this happening and also the solution.
Thanks
Need help with imagettfbbox function
Moderator: General Moderators
-
nettest1234
- Forum Newbie
- Posts: 1
- Joined: Wed Jun 30, 2004 8:36 am