From:             hm2k
Operating system: CentOS4
PHP version:      5.2.13
Package:          GD related
Bug Type:         Bug
Bug description:imagettfbbox/imagettftext "Could not read font" error

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 bug report at http://bugs.php.net/bug.php?id=52403&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52403&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52403&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52403&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52403&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52403&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52403&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52403&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52403&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52403&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52403&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52403&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52403&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52403&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52403&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52403&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52403&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52403&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52403&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52403&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52403&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52403&r=mysqlcfg

Reply via email to