#29091 [Bgs->Opn]: PDFlib functions abort scripts even if I test return code

From: Date: Mon, 12 Jul 2004 06:14:13 +0000
Subject: #29091 [Bgs->Opn]: PDFlib functions abort scripts even if I test return code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-62078@lists.php.net to get a copy of this message
 ID:               29091
 User updated by:  ingconti at ingconti dot com
 Reported By:      ingconti at ingconti dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         PDF related
 Operating System: OSX 10.3.4
 PHP Version:      4.3.6
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2004-07-11 19:31:23] sniper@php.net

Please ask usage questions on php-generals@lists.php.net mailing list. 

------------------------------------------------------------------------

[2004-07-11 09:57:05] 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.




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29091&edit=1


Thread (4 messages)

« previous php.bugs (#62078) next »