From: sta at netimage dot dk Operating system: FreeBSD 7.1 PHP version: 5.2.10 PHP Bug Type: GD related Bug description: TTF Bounding box wrong for letters below baseline
Description: ------------ Bug #43073 fixed the bounding box for rotated texts. Unfortunately the test case only used upper case ABCDEF for the test, an not any letters that protrude below the text baseline. Hence the returned bounding box is now wrong for text like ABCQÅqyp. The code below is directly from bug #43073, only the font, demo-text and font size has been changed. Reproduce code: --------------- <?php $font = '/dana/data/ni_lib/ni_shop/fonts/CONGSEB.TTF'; # Full path to any TTF Font $delta_t = 360.0 / 16; # Make 16 steps around $g = imagecreate(800, 800); $bgnd = imagecolorallocate($g, 255, 255, 255); $black = imagecolorallocate($g, 0, 0, 0); $x = 100; $y = 0; $cos_t = cos(deg2rad($delta_t)); $sin_t = sin(deg2rad($delta_t)); for($angle = 0.0; $angle < 360.0; $angle += $delta_t) { $bbox = imagettftext($g, 20, $angle, 400 + $x, 400 + $y, $black, $font, 'QÅDFqypådg!()/\%▓'); imagepolygon($g, $bbox, 4, $black); imagefilledellipse($g, $bbox [0], $bbox [1], 8, 8, $black); $temp = $cos_t * $x + $sin_t * $y; $y = $cos_t * $y - $sin_t * $x; $x = $temp; } header( "Content-type: image/png"); imagepng($g); Expected result: ---------------- That the rectangles contain the entire text, including the parts that protrude below the text baseline. Actual result: -------------- Lower part of eg "q" are outside the box. Images will be attached in a second. -- Edit bug report at http://bugs.php.net/?id=48732&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48732&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48732&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48732&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48732&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48732&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48732&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48732&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48732&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48732&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48732&r=support Expected behavior: http://bugs.php.net/fix.php?id=48732&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48732&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48732&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48732&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48732&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48732&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48732&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48732&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48732&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48732&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48732&r=mysqlcfg