cvs: /php4/ext/pdf pdf.c

From: Date: Thu, 09 Sep 1999 06:19:01 +0000
Subject: cvs: /php4/ext/pdf pdf.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-4286@lists.php.net to get a copy of this message
steinm Thu Sep 9 02:19:01 1999 EDT Modified files: /php4/ext/pdf pdf.c Log: pdf_setfont got optional parameter to embed fonts Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.10 php4/ext/pdf/pdf.c:1.11 --- php4/ext/pdf/pdf.c:1.10 Thu Aug 19 02:43:43 1999 +++ php4/ext/pdf/pdf.c Thu Sep 9 02:19:00 1999 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdf.c,v 1.10 1999/08/19 06:43:43 steinm Exp $ */ +/* $Id: pdf.c,v 1.11 1999/09/09 06:19:00 steinm Exp $ */ /* pdflib 2.01 is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997 Thomas Merz. */ @@ -515,12 +515,26 @@ /* {{{ proto void pdf_set_font(int pdfdoc, string font, double size, int encoding) Select the current font face, size and encoding */ PHP_FUNCTION(pdf_set_font) { - pval *arg1, *arg2, *arg3, *arg4; - int id, type, font; + pval *arg1, *arg2, *arg3, *arg4, *arg5; + int id, type, font, embed; PDF *pdf; PDF_TLS_VARS; - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) { + switch (ARG_COUNT(ht)) { + case 4: + if (getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) { + WRONG_PARAM_COUNT; + } + embed = 0; + break; + case 5: + if (getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long(arg5); + embed = arg5->value.lval; + break; + default: WRONG_PARAM_COUNT; } @@ -542,23 +556,23 @@ switch(arg4->value.lval) { case 0: - font = PDF_findfont(pdf, arg2->value.str.val, "builtin", 1); + font = PDF_findfont(pdf, arg2->value.str.val, "builtin", embed); break; case 1: - font = PDF_findfont(pdf, arg2->value.str.val, "pdfdoc", 1); + font = PDF_findfont(pdf, arg2->value.str.val, "pdfdoc", embed); break; case 2: - font = PDF_findfont(pdf, arg2->value.str.val, "macroman", 1); + font = PDF_findfont(pdf, arg2->value.str.val, "macroman", embed); break; case 3: - font = PDF_findfont(pdf, arg2->value.str.val, "macexpert", 1); + font = PDF_findfont(pdf, arg2->value.str.val, "macexpert", embed); break; case 4: - font = PDF_findfont(pdf, arg2->value.str.val, "winansi", 1); + font = PDF_findfont(pdf, arg2->value.str.val, "winansi", embed); break; default: php3_error(E_WARNING,"Encoding out of range, using 0"); - font = PDF_findfont(pdf, arg2->value.str.val, "builtin", 1); + font = PDF_findfont(pdf, arg2->value.str.val, "builtin", embed); } if (font < 0) {

« previous php.version4 (#4286) next »