Bug #71602 [Com]: bounding box not accurate

From: Date: Thu, 31 Mar 2016 11:36:01 +0000
Subject: Bug #71602 [Com]: bounding box not accurate
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200258@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71602&edit=1 ID: 71602 Comment by: mplomer at gmx dot de Reported by: treboralmasy1 at gmail dot com Summary: bounding box not accurate Status: Duplicate Type: Bug Package: GD related PHP Version: 5.6.18 Assigned To: cmb Block user comment: N Private report: N New Comment: For proposed fix and further info/discussion, see bug #53504 Previous Comments: ------------------------------------------------------------------------ [2016-02-24 00:00:27] treboralmasy1 at gmail dot com So this has been a known bug for 6 years? ------------------------------------------------------------------------ [2016-02-23 12:43:55] cmb@php.net Duplicate of bug #53504. ------------------------------------------------------------------------ [2016-02-15 22:22:03] treboralmasy1 at gmail dot com Description: ------------ --- From manual page: http://www.php.net/function.imagettfbbox --- The bounding box dimensions are not accurate sometimes being off by as much as a full character. Test script: --------------- <?php $text = 'hello there'; $box = imagettfbbox(12,0,'arial.ttf',$text); $width = abs($box[0]-$box[2]); $text = str_replace(' ','&nbsp;',$text); echo '<svg width="500" height="200"> <g transform="scale(5)"> <text x="0" y="20" style="font-family:arial; font-size:12pt;">'.$text.'</text> <rect x="0" y="10" width="'.$width.'" height="20" style="fill-opacity:0.5; fill:yellow;" /> </g> </svg>'; exit; ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71602&edit=1

« previous php.bugs (#200258) next »