From b8c27b1e59b41a91b5a19b0e3cf3b02f5caefd7b Mon Sep 17 00:00:00 2001 From: oetiker Date: Thu, 11 Sep 2008 20:27:47 +0000 Subject: [PATCH] =?utf8?q?fixed=20processing=20of=20custom=20fonts=20Ren?= =?utf8?q?=C3=A9=20GARCIA=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1500 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_graph.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 08d0815d..cb0627cc 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -3678,11 +3678,17 @@ rrd_info_t *rrd_graph_v( static void rrd_set_font_desc ( image_desc_t *im,int prop,char *font, double size ){ - strncpy(im->text_prop[prop].font, font, sizeof(text_prop[prop].font) - 1); - im->text_prop[prop].font[sizeof(text_prop[prop].font) - 1] = '\0'; - im->text_prop[prop].size = size; - im->text_prop[prop].font_desc = pango_font_description_from_string( font ); - pango_font_description_set_size(im->text_prop[prop].font_desc, size * PANGO_SCALE); + if (font){ + strncpy(im->text_prop[prop].font, font, sizeof(text_prop[prop].font) - 1); + im->text_prop[prop].font[sizeof(text_prop[prop].font) - 1] = '\0'; + im->text_prop[prop].font_desc = pango_font_description_from_string( font ); + }; + if (size > 0){ + im->text_prop[prop].size = size; + }; + if (im->text_prop[prop].font_desc && im->text_prop[prop].size ){ + pango_font_description_set_size(im->text_prop[prop].font_desc, im->text_prop[prop].size * PANGO_SCALE); + }; } void rrd_graph_init( -- 2.30.2