From 2ba18ca84084448eda3ad198989bace10d530575 Mon Sep 17 00:00:00 2001 From: ellson Date: Thu, 30 Oct 2008 22:06:59 +0000 Subject: [PATCH] partial fix for #1504 --- plugin/gd/gvtextlayout_gd.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/plugin/gd/gvtextlayout_gd.c b/plugin/gd/gvtextlayout_gd.c index 33b4658fd..ed8d4921a 100644 --- a/plugin/gd/gvtextlayout_gd.c +++ b/plugin/gd/gvtextlayout_gd.c @@ -97,7 +97,30 @@ char *gd_alternate_fontlist(char *font) } #endif /* HAVE_GD_FONTCONFIG */ -extern char* psfontResolve (PostscriptAlias* pa); +/* gd_psfontResolve: + * * Construct alias for postscript fontname. + * * NB. Uses a static array - non-reentrant. + * */ + +#define ADD_ATTR(a) \ + if (a) { \ + strcat(buf, comma ? " " : ", "); \ + comma = 1; \ + strcat(buf, a); \ + } + +char* gd_psfontResolve (PostscriptAlias* pa) +{ + static char buf[1024]; + int comma=0; + strcpy(buf, pa->family); + + ADD_ATTR(pa->weight); + ADD_ATTR(pa->stretch); + ADD_ATTR(pa->style); + + return buf; +} static boolean gd_textlayout(textpara_t * para, char **fontpath) { @@ -138,7 +161,7 @@ static boolean gd_textlayout(textpara_t * para, char **fontpath) #ifdef HAVE_GD_FONTCONFIG gdFTUseFontConfig(1); /* tell gd that we really want to use fontconfig, 'cos it s not the default */ if (para->postscript_alias) - fontlist = psfontResolve (para->postscript_alias); + fontlist = gd_psfontResolve (para->postscript_alias); else fontlist = para->fontname; #else -- 2.40.0