Edit report at http://bugs.php.net/bug.php?id=52403&edit=1
ID: 52403
Comment by: hm2k@php.net
Reported by: hm2k@php.net
Summary: imagettfbbox/imagettftext "Could not read font"
error
Status: Open
Type: Bug
Package: GD related
Operating System: CentOS4
PHP Version: 5.2.13
Block user comment: Y
New Comment:
To clarify:
Expected result:
----------------
Warning: imagettfbbox() [function.imagettfbbox]: Invalid font file 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
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
Previous Comments:
------------------------------------------------------------------------
[2010-07-27 10:57:18] hm2k@php.net
Excuse me, but this is -NOT- the same bug.
Just because it's simply related does not make it the same.
The problem here is the error, not the TTF files, which is the problem
described in the other bug report.
Please check and try again.
------------------------------------------------------------------------
[2010-07-27 01:04:09] kalle@php.net
Same issue as in bug #52404
------------------------------------------------------------------------
[2010-07-22 14:24:49] hm2k@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