Jump to content

imagettfbbox problem


Artem Kozmin

Recommended Posts

I use imagettfbbox() function to get string width:

$bounds = imagettfbbox(10, $font_angle, $font_file, "This space is for
rent :)");
$width = $bounds[4] - $bounds[0];
$bounds = imagettfbbox(10, $font_angle, $font_file, "The Pyramid of Khufu");
$width = $bounds[4] - $bounds[0];

It returns 105 as width for two strings above.

if we change font size to 14, width of string "This space is for rent
:)" is 155, and width of string  "The Pyramid of Khufu" is 146.

Note these strings have same width in font size 10 and they have
different width in font size 14.
Is it problem with TTF font resize?

I use PHP 4.3.11 and GD bundled (2.0.28 compatible)
Best regards, Artem
Link to comment
https://forums.phpfreaks.com/topic/28265-imagettfbbox-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.