Bug #52403 [Opn->Bgs]: imagettfbbox/imagettftext "Could not read font" error
| From: | pajoye@php.net | Date: | Mon, 18 Oct 2010 18:29:04 +0000 |
| Subject: | Bug #52403 [Opn->Bgs]: imagettfbbox/imagettftext "Could not read font" error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-155307@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52403&edit=1
ID: 52403
Updated by: pajoye@php.net
Reported by: hm2k@php.net
Summary: imagettfbbox/imagettftext "Could not read font"
error
-Status: Open
+Status: Bogus
Type: Bug
Package: GD related
Operating System: CentOS4
PHP Version: 5.2.13
-Block user comment: Y
+Block user comment: N
New Comment:
The message is correct. As some fonts are supported by some freetype
versions. It does not mean that the font file is invalid, but that ft
(gd) could not read it.
Previous Comments:
------------------------------------------------------------------------
[2010-10-18 18:32:39] hm2k@php.net
To put it very simply, it incorrectly says "Could not read font", when
it should say "Invalid font file".
Could somebody fix this or do you need me to supply a patch?
------------------------------------------------------------------------
[2010-07-27 14:56:55] hm2k@php.net
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
------------------------------------------------------------------------
[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