[PHP-DEV] Bug #1987: ImageTTFBBox does not return correct bounding box. From: animate2 <email protected>
Date: 08/07/99

From: animate2 <email protected>
Operating system: Linux 2.2.10
PHP version: 3.0.12
PHP Bug Type: Misbehaving function
Bug description: ImageTTFBBox does not return correct bounding box.

ImageTTFBBox doesn't return a correct bounding box. In many cases, an image created to be the size of a bounding box will not be tall enough and cuts off part of the text it is meant to contain (in most cases, the bottoms of g's, p's, and other characters with drop-down loopy things). In some occasions, the width of a bounding box will also be inadequate. The following function illustrates:

function GIFheadline ($font, $fontsize, $bulletgif, $text, $number) {
        $bounds = ImageTTFBBox($fontsize, 0, $font, $text);
        $imagewidth = abs($bounds[2] - $bounds[0]);
        $imageheight = abs($bounds[1] - $bounds[7]);
        $image = imagecreate($imagewidth, $imageheight);
        $textcolor = ImageColorAllocate($image, 98,128,190);
        imagettftext($image, $fontsize, 0, 0, $imageheight, $textcolor, $font, $text);
        imagegif($image, "$number.gif");
        }

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>