From 19510ddbf3bde2d60d047de0f3bbf7f6228449df Mon Sep 17 00:00:00 2001 From: oetiker Date: Fri, 10 Jun 2005 18:44:40 +0000 Subject: [PATCH] make --font more flexible: * TITLE:30: just alter the size of the title * DEFAULT:0:/tmp/funfont.ttf alter the font but not the size git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@616 a5681a0c-68f1-0310-ab6d-d61299d08faa --- doc/rrdgraph.pod | 9 ++++++++- src/rrd_graph.c | 23 ++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/doc/rrdgraph.pod b/doc/rrdgraph.pod index 121a65e..c4ee169 100644 --- a/doc/rrdgraph.pod +++ b/doc/rrdgraph.pod @@ -266,7 +266,7 @@ A green arrow is made by: C<--color ARROW:00FF00> Zoom the graphics by the given amount. The factor must be E 0 -[B<-n>|B<--font> IB<:>IB<:>I] +[B<-n>|B<--font> IB<:>IB<:>[I]] This lets you customize which font to use for the various text elements on the RRD graphs. C sets the default value for all @@ -275,6 +275,13 @@ for the vertical unit label, C for the graph legend. Use Times for the title: C<--font TITLE:13:/usr/lib/fonts/times.ttf> +If you do not give a font string you can modify just the sice of the default font: +C<--font TITLE:13:>. + +If you specify the size 0 then you can modify just the font without touching +the size. This is especially usefull for altering the default font without +resetting the default fontsizes: C<--font DEFAULT:0:/usr/lib/fonts/times.ttf>. + RRDtool comes with a preset default font. You can set the environment variable C if you want to change this. diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 8b8a962..ebd91fb 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -3152,20 +3152,17 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im) if(sscanf(optarg, "%10[A-Z]:%lf:%1000s", prop,&size,font) == 3){ - int sindex; + int sindex,propidx; if((sindex=text_prop_conv(prop)) != -1){ - im->text_prop[sindex].size=size; - strcpy(im->text_prop[sindex].font,font); - if (sindex==0) { /* the default */ - im->text_prop[TEXT_PROP_TITLE].size=size; - strcpy(im->text_prop[TEXT_PROP_TITLE].font,font); - im->text_prop[TEXT_PROP_AXIS].size=size; - strcpy(im->text_prop[TEXT_PROP_AXIS].font,font); - im->text_prop[TEXT_PROP_UNIT].size=size; - strcpy(im->text_prop[TEXT_PROP_UNIT].font,font); - im->text_prop[TEXT_PROP_LEGEND].size=size; - strcpy(im->text_prop[TEXT_PROP_LEGEND].font,font); - } + for (propidx=sindex;propidx 0){ + im->text_prop[propidx].size=size; + } + if (strlen(font) > 0){ + strcpy(im->text_prop[propidx].font,font); + } + if (propidx==sindex && sindex != 0) break; + } } else { rrd_set_error("invalid fonttag '%s'",prop); return; -- 2.11.0