php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29091 PDFlib functions abort scripts even if I test return code
Submitted: 2004-07-11 09:57 UTC Modified: 2004-07-18 18:54 UTC
From: ingconti at ingconti dot com Assigned:
Status: Closed Package: PDF related
PHP Version: 4.3.6 OS: OSX 10.3.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ingconti at ingconti dot com
New email:
PHP Version: OS:

 

 [2004-07-11 09:57 UTC] ingconti at ingconti dot com
Description:
------------
I am evaluating PDFLib tobe used on OSX via PHP.
( i am currently using apache (standard for Apple on 
Panther 1.0.3.4) PHP 4.0.2 from entropy)

I spent some time investigating about fonts.
SUPPORT for OSX font is VERY POOR:

a) I tried using embedded font: helvetica and times work 
fine
b) If You use other fonts ALL the php scripts ABORT! 
without any error!

If You do:

$f="Symbol";
$font = pdf_findfont($pdf, $f, "builtin", 0); 
if($font)
{
	print "Font OK <br>";
}
else
	{
	// handle it!!
	}

with "Symbol" it works, but if font is not present $font is 
NOT set to NULL: ALL the script aborts!!
I expected i got $font == NULL so I can intercept error. NO 
WAY! script aborts!.

c) I tried to use 

$fontPath = "/Library/Fonts/Bkant.ttf";
//pdf_set_parameter($pdf,"FontOutline","MYFONT==/Library/
Fonts/Chalkboard.ttf");
pdf_set_parameter($pdf,"FontOutline","MYFONT==".$fontPath);
$font = pdf_findfont($pdf,"MYFONT","host",1);


it works ONLY on some type of TT fonts.

I works on:

Chalkboard.ttf

but NOT on other TTF regularly seen on osx.

d) I Tried to use windows TT fonts:

I see them in osx apps, but using in pdf_set_parameter, the 
cause script to abort...

THANKS.

Reproduce code:
---------------
If You do:

$f="Symbol";
$font = pdf_findfont($pdf, $f, "builtin", 0); 
if($font)
{
	print "Font OK <br>";
	pdf_setfont($pdf, $font,30); 
	pdf_set_text_pos($pdf, 30, $y);
	$y+=20; 
	pdf_show($pdf, $f);
}
else
	{
	// handle it!!
	}

if font is not present $font is NOT set to NULL: ALL the script aborts!!

try with "Charcoal" for example.

c) I tried to use 

$fontPath = "/Library/Fonts/Bkant.ttf";
//pdf_set_parameter($pdf,"FontOutline","MYFONT==/Library/Fonts/Chalkboard.ttf");
pdf_set_parameter($pdf,"FontOutline","MYFONT==".$fontPath);
$font = pdf_findfont($pdf,"MYFONT","host",1);


it works ONLY on some type of TT fonts.

I works on:

Chalkboard.ttf

but NOT on other TTF regularly seen on osx.

d) I Tried to use windows TT fonts:

I see them in osx apps, but using in pdf_set_parameter, the cause scritp to abort...


for Your conveninece.

THANKS.



Expected result:
----------------
if font is not found, i Wuold like to get:


$f="Charcoal";
$font = pdf_findfont($pdf, $f, "builtin", 0); 
if(!$font)
{
   print "not present";
}


instead of aborting php script.

Actual result:
--------------
I do NOT have a core dump, pache is currntly working.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-11 19:31 UTC] sniper@php.net
Please ask usage questions on php-generals@lists.php.net mailing list. 
 [2004-07-12 08:14 UTC] ingconti at ingconti dot com
I dicoverede WHy somem fonts do not appear: is a permission 
- related problem.

BUT the main problem remains: WHY i cannot trap the error 
and handle it?
I DO NOT get a null ref.. scripy aborts.
 [2004-07-18 18:54 UTC] iliaa@php.net
In latest cvs there a check inside pdf_findfont and if the 
font is not found the code will return FALSE. If it does 
not do that the problem is likely in libpdf itself. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC