summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 360c1c4)
raw | patch | inline | side by side (parent: 360c1c4)
author | alex <alex@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 10 Mar 2002 14:53:04 +0000 (14:53 +0000) | ||
committer | alex <alex@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 10 Mar 2002 14:53:04 +0000 (14:53 +0000) |
the current change is just a hack
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@84 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@84 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_graph.c | patch | blob | history |
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index f4ad81a74b16647f90557a498a05571d18eb7b42..5597c496b6a53cf2584a49527ba8445dcdd70e6c 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
continue;
im->gdes[ii].leg_x = leg_x;
im->gdes[ii].leg_y = leg_y;
+printf("DEBUG: using font %s with width %lf\n",
+ im->text_prop[TEXT_PROP_LEGEND].font,
+ im->text_prop[TEXT_PROP_LEGEND].size);
leg_x +=
gfx_get_text_width(leg_x,im->text_prop[TEXT_PROP_LEGEND].font,
im->text_prop[TEXT_PROP_LEGEND].size,
}
break;
case 'n':{
- char *prop = "";
- double size = 1;
- char *font = "dummy";
-
- if(sscanf(optarg,
- "%10[A-Z]:%lf:%s",
- prop,&size,font) == 3){
- int sindex;
- if((sindex=text_prop_conv(prop)) != -1){
- im->text_prop[sindex].size=size;
- im->text_prop[sindex].font=font;
-
- } else {
- rrd_set_error("invalid color name '%s'",col_nam);
- }
- } else {
- rrd_set_error("invalid text property format");
- return;
- }
- break;
- }
+ /* originally this used char *prop = "" and
+ ** char *font = "dummy" however this results
+ ** in a SEG fault, at least on RH7.1
+ **
+ ** The current implementation isn't proper
+ ** either, font is never freed and prop uses
+ ** a fixed width string
+ */
+ char prop[100];
+ double size = 1;
+ char *font;
+
+ font=malloc(255);
+ if(sscanf(optarg,
+ "%10[A-Z]:%lf:%s",
+ prop,&size,font) == 3){
+ int sindex;
+ if((sindex=text_prop_conv(prop)) != -1){
+printf("DEBUG: setting all to the default of font %s with width %lf\n",
+font,size);
+ im->text_prop[sindex].size=size;
+ im->text_prop[sindex].font=font;
+ if (sindex==0) { /* the default */
+ im->text_prop[TEXT_PROP_TITLE].size=size;
+ im->text_prop[TEXT_PROP_TITLE].font=font;
+ im->text_prop[TEXT_PROP_AXIS].size=size;
+ im->text_prop[TEXT_PROP_AXIS].font=font;
+ im->text_prop[TEXT_PROP_UNIT].size=size;
+ im->text_prop[TEXT_PROP_UNIT].font=font;
+ im->text_prop[TEXT_PROP_LEGEND].size=size;
+ im->text_prop[TEXT_PROP_LEGEND].font=font;
+ }
+ } else {
+ rrd_set_error("invalid fonttag '%s'",prop);
+ return;
+ }
+ } else {
+ rrd_set_error("invalid text property format");
+ return;
+ }
+ break;
+ }
case 'm':
im->zoom= atof(optarg);
if (im->zoom <= 0.0) {