cvs: /php4/ext/pdf pdf.c php3_pdf.h

From: Date: Thu, 07 Oct 1999 16:01:22 +0000
Subject: cvs: /php4/ext/pdf pdf.c php3_pdf.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-5299@lists.php.net to get a copy of this message
steinm Thu Oct 7 12:01:22 1999 EDT Modified files: /php4/ext/pdf pdf.c php3_pdf.h Log: - new functions pdf_get_font, pdf_get_fontsize, pdf_get_fontname Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.14 php4/ext/pdf/pdf.c:1.15 --- php4/ext/pdf/pdf.c:1.14 Tue Sep 14 10:47:12 1999 +++ php4/ext/pdf/pdf.c Thu Oct 7 12:00:47 1999 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdf.c,v 1.14 1999/09/14 14:47:12 steinm Exp $ */ +/* $Id: pdf.c,v 1.15 1999/10/07 16:00:47 steinm Exp $ */ /* pdflib 2.01 is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997 Thomas Merz. */ @@ -101,6 +101,9 @@ PHP_FE(pdf_set_text_pos, NULL) PHP_FE(pdf_set_char_spacing, NULL) PHP_FE(pdf_set_word_spacing, NULL) + PHP_FE(pdf_get_font, NULL) + PHP_FE(pdf_get_fontname, NULL) + PHP_FE(pdf_get_fontsize, NULL) PHP_FE(pdf_continue_text, NULL) PHP_FE(pdf_stringwidth, NULL) PHP_FE(pdf_save, NULL) @@ -584,6 +587,86 @@ PDF_setfont(pdf, font, (float) arg3->value.dval); RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto string pdf_get_font(int pdfdoc) + Gets the current font */ +PHP_FUNCTION(pdf_get_font) { + pval *arg1; + int id, type, font, embed; + PDF *pdf; + PDF_TLS_VARS; + + if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(arg1); + id=arg1->value.lval; + pdf = php3_list_find(id,&type); + if(!pdf || type!=PDF_GLOBAL(le_pdf)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + font = PDF_get_font(pdf); + + RETURN_LONG(font); +} +/* }}} */ + +/* {{{ proto string pdf_get_fontname(int pdfdoc) + Gets the current font name */ +PHP_FUNCTION(pdf_get_fontname) { + pval *arg1; + int id, type, embed; + char *fontname; + PDF *pdf; + PDF_TLS_VARS; + + if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(arg1); + id=arg1->value.lval; + pdf = php3_list_find(id,&type); + if(!pdf || type!=PDF_GLOBAL(le_pdf)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + fontname = (char *) PDF_get_fontname(pdf); + + RETURN_STRING(fontname, 1); +} +/* }}} */ + +/* {{{ proto string pdf_get_fontsize(int pdfdoc) + Gets the current font size */ +PHP_FUNCTION(pdf_get_fontsize) { + pval *arg1; + int id, type, embed; + float fontsize; + PDF *pdf; + PDF_TLS_VARS; + + if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(arg1); + id=arg1->value.lval; + pdf = php3_list_find(id,&type); + if(!pdf || type!=PDF_GLOBAL(le_pdf)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + fontsize = PDF_get_fontsize(pdf); + + RETURN_DOUBLE(fontsize); } /* }}} */ Index: php4/ext/pdf/php3_pdf.h diff -u php4/ext/pdf/php3_pdf.h:1.5 php4/ext/pdf/php3_pdf.h:1.6 --- php4/ext/pdf/php3_pdf.h:1.5 Fri Aug 6 06:41:59 1999 +++ php4/ext/pdf/php3_pdf.h Thu Oct 7 12:00:47 1999 @@ -26,7 +26,7 @@ | Authors: Uwe Steinmann | +----------------------------------------------------------------------+ */ -/* $Id: php3_pdf.h,v 1.5 1999/08/06 10:41:59 steinm Exp $ */ +/* $Id: php3_pdf.h,v 1.6 1999/10/07 16:00:47 steinm Exp $ */ #ifndef _PHP3_PDF_H #define _PHP3_PDF_H @@ -55,6 +55,9 @@ PHP_FUNCTION(pdf_show); PHP_FUNCTION(pdf_show_xy); PHP_FUNCTION(pdf_set_font); +PHP_FUNCTION(pdf_get_font); +PHP_FUNCTION(pdf_get_fontname); +PHP_FUNCTION(pdf_get_fontsize); PHP_FUNCTION(pdf_set_leading); PHP_FUNCTION(pdf_set_text_rendering); PHP_FUNCTION(pdf_set_horiz_scaling);

« previous php.version4 (#5299) next »