cvs: /php3/functions pdf.c

From: Date: Thu, 22 Jul 1999 02:41:26 +0000
Subject: cvs: /php3/functions pdf.c
Groups: php.dev 
Request: Send a blank email to php-dev+get-8941@lists.php.net to get a copy of this message
cschneid Wed Jul 21 22:41:26 1999 EDT Modified files: /php3/functions pdf.c Log: Use new PDF_findfont and PDF_setfont functions if PDFLIB2 is used to embed fonts when necessary. Index: php3/functions/pdf.c diff -u php3/functions/pdf.c:1.41 php3/functions/pdf.c:1.42 --- php3/functions/pdf.c:1.41 Fri Jul 16 07:27:11 1999 +++ php3/functions/pdf.c Wed Jul 21 22:41:25 1999 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdf.c,v 1.41 1999/07/16 11:27:11 steinm Exp $ */ +/* $Id: pdf.c,v 1.42 1999/07/22 02:41:25 cschneid Exp $ */ /* pdflib 0.6 is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997 Thomas Merz. */ @@ -692,7 +692,7 @@ Select the current font face, size and encoding */ PHP_FUNCTION(pdf_set_font) { pval *arg1, *arg2, *arg3, *arg4; - int id, type; + int id, type, font; PDF *pdf; PDF_TLS_VARS; @@ -719,24 +719,31 @@ #if HAVE_PDFLIB2 switch(arg4->value.lval) { case 0: - PDF_set_font(pdf, arg2->value.str.val, (float) arg3->value.dval, "builtin"); + font = PDF_findfont(pdf, arg2->value.str.val, "builtin", 1); break; case 1: - PDF_set_font(pdf, arg2->value.str.val, (float) arg3->value.dval, "pdfdoc"); + font = PDF_findfont(pdf, arg2->value.str.val, "pdfdoc", 1); break; case 2: - PDF_set_font(pdf, arg2->value.str.val, (float) arg3->value.dval, "macroman"); + font = PDF_findfont(pdf, arg2->value.str.val, "macroman", 1); break; case 3: - PDF_set_font(pdf, arg2->value.str.val, (float) arg3->value.dval, "macexpert"); + font = PDF_findfont(pdf, arg2->value.str.val, "macexpert", 1); break; case 4: - PDF_set_font(pdf, arg2->value.str.val, (float) arg3->value.dval, "winansi"); + font = PDF_findfont(pdf, arg2->value.str.val, "winansi", 1); break; default: php3_error(E_WARNING,"Encoding out of range, using 0"); - PDF_set_font(pdf, arg2->value.str.val, (float) arg3->value.dval, "builtin"); + font = PDF_findfont(pdf, arg2->value.str.val, "builtin", 1); } + + if (font < 0) { + php3_error(E_WARNING,"Font %s not found", arg2->value.str.val); + RETURN_FALSE; + } + + PDF_setfont(pdf, font, (float) arg3->value.dval); #else PDF_set_font(pdf, arg2->value.str.val, (float) arg3->value.dval, arg4->value.lval); #endif

« previous php.dev (#8941) next »