|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-07-07 05:10 UTC] kni at exactal dot com
Description: ------------ On my local Linux environment (running PHP 4.3.4 / GD bundled (2.0.15 compatible)) -- all is well. My script produces the following image: http://www.exactal.com/tmp/phpbugs/wrap-local.png In my live FreeBSD environment (running PHP 4.3.11 / GD bundled (2.0.28 compatible)) -- output from the same script is of lower quality: http://www.exactal.com/tmp/phpbugs/wrap-remote.png Note in particular poor character widths and character spacing (note also that imagettfbbox used to assess the type width returns a value that results in the type being truncated). This is reproducable with different font files, sizes, etc, and is more noticeable with smaller font sizes. Reproduce code: --------------- <?php $font_size = '11'; $font = "zapf.ttf"; $text = "environmentally sustainable"; $bbox=imagettfbbox($font_size,0,$font,$text); $left=($bbox[0]>$bbox[6])?$bbox[6]:$bbox[0]; // determine most far points $right=($bbox[2]>$bbox[4])?$bbox[2]:$bbox[4]; $width=$right-$left+$margin; // get total width $newImg = ImageCreateTrueColor($width,30); $background = imagecolorallocate($newImg, 255, 255, 255); ImageFill($newImg, 1, 1, $background); $foreground = imagecolorallocate($newImg, 0, 0, 0); imagettftext($newImg, $font_size, 0, 0, 20, $foreground, $font, $text); header("Content-type: image/png"); ImagePNG($newImg); ImageDestroy($newImg); ?> Expected result: ---------------- http://www.exactal.com/tmp/phpbugs/wrap-local.png Actual result: -------------- http://www.exactal.com/tmp/phpbugs/wrap-remote.png PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 04:00:02 2025 UTC |
Please use the bundled library ("configure --with-gd"). Take care to do not have the developement package of the system GD installed or available while configuring and installing. Which Freetype version do you have? --Pierre