summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2e04261)
raw | patch | inline | side by side (parent: 2e04261)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 10 Jun 2005 18:44:40 +0000 (18:44 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Fri, 10 Jun 2005 18:44:40 +0000 (18:44 +0000) |
* 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
* 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 | patch | blob | history | |
src/rrd_graph.c | patch | blob | history |
diff --git a/doc/rrdgraph.pod b/doc/rrdgraph.pod
index 121a65ef618fb5e2d95849bb50bf4724d5f262dd..c4ee169faaa84e50a061f4ce4576a744907eb21e 100644 (file)
--- a/doc/rrdgraph.pod
+++ b/doc/rrdgraph.pod
Zoom the graphics by the given amount. The factor must be E<gt> 0
-[B<-n>|B<--font> I<FONTTAG>B<:>I<size>B<:>I<font>]
+[B<-n>|B<--font> I<FONTTAG>B<:>I<size>B<:>[I<font>]]
This lets you customize which font to use for the various text
elements on the RRD graphs. C<DEFAULT> sets the default value for all
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<RRD_DEFAULT_FONT> if you want to change this.
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index 8b8a962a5eb1a7ba74048094ef75357d02bd44b1..ebd91fb0c07d3aa2981db2f83e983c6d63aa8263 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
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<TEXT_PROP_LAST;propidx++){
+ if (size > 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;