Edit report at http://bugs.php.net/bug.php?id=52403&edit=1
ID: 52403 Updated by: ka...@php.net Reported by: h...@php.net Summary: imagettfbbox/imagettftext "Could not read font" error -Status: Open +Status: Duplicate Type: Bug Package: GD related Operating System: CentOS4 PHP Version: 5.2.13 -Block user comment: N +Block user comment: Y New Comment: Same issue as in bug #52404 Previous Comments: ------------------------------------------------------------------------ [2010-07-22 14:24:49] h...@php.net Description: ------------ Using the Vera.ttf font, which is part of the Image_Text PEAR package results in an odd error... The font can be found here: http://svn.php.net/viewvc/pear/packages/Image_Text/trunk/tests/Vera.ttf?view=log The error given by imagettfbbox() is "Could not read font". When tested with is_readable(), the font is indeed readable. When opening the Vera.ttf font file in windows, it produces the following error: "The requested file Vera.ttf was not a valid font file." It would appear that the file may well be corrupt, not that it "could not read". This error lead to a very confusing situation... I propose that the error should be more descriptive. Instead of "Could not read font", consider "Invalid font file". Test script: --------------- <?php $font = 'Vera.ttf'; $test = imagettfbbox(10, 10, $font, 'test'); echo "\n<br>What PHP version? ".phpversion(); $read = file_exists($font)?'Yes':'No'; echo "\n<br>Does font '$font' exist? ".$read; $read = is_readable($font)?'Yes':'No'; echo "\n<br>Is font '$font' readable? ".$read; ?> Expected result: ---------------- Warning: imagettfbbox() [function.imagettfbbox]: Could not read font in /home/share/www/dev/test/php/imagettfbbox.php on line 4 Actual result: -------------- Warning: imagettfbbox() [function.imagettfbbox]: Could not read font in /home/share/www/dev/test/php/imagettfbbox.php on line 4 What PHP version? 5.2.13 Does font 'Vera.ttf' exist? Yes Is font 'Vera.ttf' readable? Yes ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52403&edit=1