summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Steinmann <steinm@php.net>1999-10-07 16:00:48 +0000
committerUwe Steinmann <steinm@php.net>1999-10-07 16:00:48 +0000
commit60b2d65b2bc740365ea2a1d00a13a928ec00905f (patch)
tree4bb13337ecae01b70af9dc8cb299eff81d28a2b2
parentca6cf936b88844c7cb73265bcadbbc8552b61e4b (diff)
downloadphp-git-60b2d65b2bc740365ea2a1d00a13a928ec00905f.tar.gz
- new functions pdf_get_font, pdf_get_fontsize, pdf_get_fontname
-rw-r--r--ext/pdf/pdf.c83
-rw-r--r--ext/pdf/php3_pdf.h3
2 files changed, 86 insertions, 0 deletions
diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c
index 3d6d65afad..b5e8fd1767 100644
--- a/ext/pdf/pdf.c
+++ b/ext/pdf/pdf.c
@@ -101,6 +101,9 @@ function_entry pdf_functions[] = {
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)
@@ -587,6 +590,86 @@ PHP_FUNCTION(pdf_set_font) {
}
/* }}} */
+/* {{{ 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);
+}
+/* }}} */
+
/* {{{ proto void pdf_set_leading(int pdfdoc, double distance)
Sets distance between text lines */
PHP_FUNCTION(pdf_set_leading) {
diff --git a/ext/pdf/php3_pdf.h b/ext/pdf/php3_pdf.h
index f7393c3f15..6b7c48372d 100644
--- a/ext/pdf/php3_pdf.h
+++ b/ext/pdf/php3_pdf.h
@@ -55,6 +55,9 @@ PHP_FUNCTION(pdf_end_page);
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);