CVS update: php3/functions

From: Date: Mon, 24 May 1999 13:58:26 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5935@lists.php.net to get a copy of this message
Date: Monday May 24, 1999 @ 9:58 Author: jah Update of /repository/php3/functions In directory php:/tmp/cvs-serv4415/functions Modified Files: gd.c php3_gd.h Log Message: Added a few Postscript font functions and small fixes. Index: php3/functions/gd.c diff -u php3/functions/gd.c:1.109 php3/functions/gd.c:1.110 --- php3/functions/gd.c:1.109 Sun May 23 20:02:07 1999 +++ php3/functions/gd.c Mon May 24 09:58:25 1999 @@ -29,7 +29,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: gd.c,v 1.109 1999/05/24 00:02:07 jah Exp $ */ +/* $Id: gd.c,v 1.110 1999/05/24 13:58:25 jah Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -157,7 +157,9 @@ #if HAVE_LIBT1 {"imagepsloadfont", php3_imagepsloadfont, NULL}, {"imagepsfreefont", php3_imagepsfreefont, NULL}, - {"imagepsextfont", php3_imagepsextfont, NULL}, + {"imagepscopyfont", php3_imagepscopyfont, NULL}, + {"imagepsextendfont", php3_imagepsextendfont, NULL}, + {"imagepsslantfont", php3_imagepsslantfont, NULL}, {"imagepsbbox", php3_imagepsbbox, NULL}, {"imagepstext", php3_imagepstext, NULL}, #endif @@ -1853,10 +1855,56 @@ } } + T1_LoadFont(*f_ind); l_ind = php3_list_insert(f_ind, GD_GLOBAL(le_ps_font)); RETURN_LONG(l_ind); } +void php3_imagepscopyfont(INTERNAL_FUNCTION_PARAMETERS) { + pval *fnt; + int *nf_ind, *of_ind, l_ind, type; + + if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &fnt) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(fnt); + + of_ind = php3_list_find(fnt->value.lval, &type); + + if (type != GD_GLOBAL(le_ps_font)) { + php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); + RETURN_FALSE; + } + + nf_ind = emalloc(sizeof(int)); + *nf_ind = T1_CopyFont(*of_ind); + + if (*nf_ind < 0) { + switch (*nf_ind) { + case -1: + php3_error(E_WARNING, "FontID %d is not loaded in memory", *of_ind); + RETURN_FALSE; + break; + case -2: + php3_error(E_WARNING, "Tried to copy a logical font"); + RETURN_FALSE; + break; + case -3: + php3_error(E_WARNING, "Memory allocation fault in t1lib"); + RETURN_FALSE; + break; + default: + php3_error(E_WARNING, "An unknown error occurred in t1lib"); + RETURN_FALSE; + break; + } + } + + l_ind = php3_list_insert(nf_ind, GD_GLOBAL(le_ps_font)); + RETURN_LONG(l_ind); +} + void php3_imagepsfreefont(INTERNAL_FUNCTION_PARAMETERS) { pval *fnt; int type; @@ -1878,7 +1926,7 @@ RETURN_TRUE; } -void php3_imagepsextfont(INTERNAL_FUNCTION_PARAMETERS) { +void php3_imagepsextendfont(INTERNAL_FUNCTION_PARAMETERS) { pval *fnt, *ext; int type, *f_ind; @@ -1895,8 +1943,30 @@ php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); RETURN_FALSE; } + + if (T1_ExtendFont(*f_ind, ext->value.dval) != 0) RETURN_FALSE; + RETURN_TRUE; +} + +void php3_imagepsslantfont(INTERNAL_FUNCTION_PARAMETERS) { + pval *fnt, *slt; + int type, *f_ind; + + if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fnt, &slt) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(fnt); + convert_to_double(slt); + + f_ind = php3_list_find(fnt->value.lval, &type); + + if (type != GD_GLOBAL(le_ps_font)) { + php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); + RETURN_FALSE; + } - if (!T1_ExtendFont(*f_ind, ext->value.dval)) RETURN_FALSE; + if (T1_SlantFont(*f_ind, slt->value.dval) != 0) RETURN_FALSE; RETURN_TRUE; } Index: php3/functions/php3_gd.h diff -u php3/functions/php3_gd.h:1.27 php3/functions/php3_gd.h:1.28 --- php3/functions/php3_gd.h:1.27 Sun May 23 20:02:07 1999 +++ php3/functions/php3_gd.h Mon May 24 09:58:25 1999 @@ -29,7 +29,7 @@ */ -/* $Id: php3_gd.h,v 1.27 1999/05/24 00:02:07 jah Exp $ */ +/* $Id: php3_gd.h,v 1.28 1999/05/24 13:58:25 jah Exp $ */ #ifndef _PHP3_GD_H #define _PHP3_GD_H @@ -97,7 +97,9 @@ extern void php3_imagepsloadfont(INTERNAL_FUNCTION_PARAMETERS); extern void php3_imagepsfreefont(INTERNAL_FUNCTION_PARAMETERS); extern void _php3_free_ps_font(int *); -extern void php3_imagepsextfont(INTERNAL_FUNCTION_PARAMETERS); +extern void php3_imagepscopyfont(INTERNAL_FUNCTION_PARAMETERS); +extern void php3_imagepsextendfont(INTERNAL_FUNCTION_PARAMETERS); +extern void php3_imagepsslantfont(INTERNAL_FUNCTION_PARAMETERS); extern void php3_imagepsbbox(INTERNAL_FUNCTION_PARAMETERS); extern void php3_imagepstext(INTERNAL_FUNCTION_PARAMETERS); #endif -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5935) next »