if stacking on nothing we should not try to figure out WHAT we stacked on since this...
[rrdtool.git] / src / rrd_graph.c
index 630486e..01e174c 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.2.0  Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.1  Copyright by Tobi Oetiker, 1997-2005
  ****************************************************************************
  * rrd__graph.c  produce graphs from data in rrdfiles
  ****************************************************************************/
@@ -30,7 +30,7 @@
 
 #ifndef RRD_DEFAULT_FONT
 /* there is special code later to pick Cour.ttf when running on windows */
-#define RRD_DEFAULT_FONT "VeraMono.ttf"
+#define RRD_DEFAULT_FONT "DejaVuSansMono-Roman.ttf"
 #endif
 
 text_prop_t text_prop[] = {   
@@ -2168,7 +2168,7 @@ graph_size_location(image_desc_t *im, int elements
                        im->text_prop[TEXT_PROP_AXIS].font,
                        im->text_prop[TEXT_PROP_AXIS].size,
                        im->tabwidth,
-                       "0", 0) * im->unitslength + im->text_prop[TEXT_PROP_AXIS].size * 2;
+                       "0", 0) * im->unitslength + Xspacing;
        }
     }
 
@@ -2237,8 +2237,8 @@ graph_size_location(image_desc_t *im, int elements
        im->yimg += Ytitle;
        im->yorigin += Ytitle;
     } else {
-       im->yimg += Yspacing;
-       im->yorigin += Yspacing;
+       im->yimg += 1.5*Yspacing;
+       im->yorigin += 1.5*Yspacing;
     }
     /* reserve space for padding below the graph */
     im->yimg += Yspacing;
@@ -2482,7 +2482,7 @@ graph_paint(image_desc_t *im, char ***calcpr)
                continue;
            }
             ytop = ytr(im,im->gdes[i].p_data[ii]);
-           if ( im->gdes[i].stack ) {
+           if ( lastgdes && im->gdes[i].stack ) {
                   ybase = ytr(im,lastgdes->p_data[ii]);
             } else {
                   ybase = ytr(im,areazero);
@@ -2867,13 +2867,15 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
            {"units-length",required_argument, 0, 'L'},
            {"step",       required_argument, 0,    'S'},
             {"tabwidth",   required_argument, 0,    'T'},            
+           {"font-render-mode", required_argument, 0, 'R'},
+           {"font-smoothing-threshold", required_argument, 0, 'B'},
            {0,0,0,0}};
        int option_index = 0;
        int opt;
         int col_start,col_end;
 
        opt = getopt_long(argc, argv, 
-                        "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMX:L:S:T:N",
+                        "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMX:L:S:T:NR:B:",
                          long_options, &option_index);
 
        if (opt == EOF)
@@ -3113,6 +3115,24 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
            im->title[150]='\0';
            break;
 
+       case 'R':
+               if ( strcmp( optarg, "normal" ) == 0 )
+                       im->canvas->aa_type = AA_NORMAL;
+               else if ( strcmp( optarg, "light" ) == 0 )
+                       im->canvas->aa_type = AA_LIGHT;
+               else if ( strcmp( optarg, "mono" ) == 0 )
+                       im->canvas->aa_type = AA_NONE;
+               else
+               {
+                       rrd_set_error("unknown font-render-mode '%s'", optarg );
+                       return;
+               }
+               break;
+
+       case 'B':
+           im->canvas->font_aa_threshold = atof(optarg);
+               break;
+
        case '?':
             if (optopt != 0)
                 rrd_set_error("unknown option '%c'", optopt);