php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71602 bounding box not accurate
Submitted: 2016-02-15 22:22 UTC Modified: 2016-02-24 00:00 UTC
From: treboralmasy1 at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: GD related
PHP Version: 5.6.18 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: treboralmasy1 at gmail dot com
New email:
PHP Version: OS:

 

 [2016-02-15 22:22 UTC] 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;
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-16 11:32 UTC] cmb@php.net
-Package: *General Issues +Package: GD related
 [2016-02-23 12:43 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2016-02-23 12:43 UTC] cmb@php.net
Duplicate of bug #53504.
 [2016-02-24 00:00 UTC] treboralmasy1 at gmail dot com
So this has been a known bug for 6 years?
 [2016-03-31 11:36 UTC] mplomer at gmx dot de
For proposed fix and further info/discussion, see bug #53504
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 21:01:29 2024 UTC