X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_graph.c;h=01e174ce7cb0ed5fcdf38ed5ede01350a72cd951;hp=5efe82753acd4ac28e973b182e95e827b411b4b4;hb=db40632e1c55e32f618d14f75a8698d87cc6b974;hpb=705c8b1988cda51a6d8d34215e3fbf3c12a9aa2a diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 5efe827..01e174c 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -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[] = { @@ -1938,7 +1938,7 @@ grid_paint(image_desc_t *im) /* yaxis unit description */ gfx_new_text( im->canvas, - 7, (im->yorigin - im->ysize/2), + 12, (im->yorigin - im->ysize/2), im->graph_col[GRC_FONT], im->text_prop[TEXT_PROP_UNIT].font, im->text_prop[TEXT_PROP_UNIT].size, im->tabwidth, @@ -1948,7 +1948,7 @@ grid_paint(image_desc_t *im) /* graph title */ gfx_new_text( im->canvas, - im->ximg/2, im->text_prop[TEXT_PROP_TITLE].size*1.2, + im->ximg/2, im->text_prop[TEXT_PROP_TITLE].size*1.3+4, im->graph_col[GRC_FONT], im->text_prop[TEXT_PROP_TITLE].font, im->text_prop[TEXT_PROP_TITLE].size, im->tabwidth, 0.0, @@ -2117,8 +2117,8 @@ graph_size_location(image_desc_t *im, int elements ** | |..............legends......................| ** +-+-------------------------------------------+ */ - int Xvertical=0, Yvertical=0, - Xtitle =0, Ytitle =0, + int Xvertical=0, + Ytitle =0, Xylabel =0, Xmain =0, Ymain =0, #ifdef WITH_PIECHART @@ -2140,10 +2140,6 @@ graph_size_location(image_desc_t *im, int elements if (im->ylegend[0] != '\0' ) { Xvertical = im->text_prop[TEXT_PROP_UNIT].size *2; - Yvertical = gfx_get_text_width(im->canvas, 0, - im->text_prop[TEXT_PROP_UNIT].font, - im->text_prop[TEXT_PROP_UNIT].size, - im->tabwidth,im->ylegend, 0); } @@ -2152,12 +2148,13 @@ graph_size_location(image_desc_t *im, int elements ** automatically has some vertical spacing. The horizontal ** spacing is added here, on each side. */ - Xtitle = gfx_get_text_width(im->canvas, 0, + /* don't care for the with of the title + Xtitle = gfx_get_text_width(im->canvas, 0, im->text_prop[TEXT_PROP_TITLE].font, im->text_prop[TEXT_PROP_TITLE].size, im->tabwidth, - im->title, 0) + 2*Xspacing; - Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.5; + im->title, 0) + 2*Xspacing; */ + Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.6+10; } if (elements) { @@ -2171,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; } } @@ -2207,7 +2204,8 @@ graph_size_location(image_desc_t *im, int elements im->xorigin = Xspacing + Xylabel; - if (Xtitle > im->ximg) im->ximg = Xtitle; + /* the length of the title should not influence with width of the graph + if (Xtitle > im->ximg) im->ximg = Xtitle; */ if (Xvertical) { /* unit description */ im->ximg += Xvertical; @@ -2239,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; @@ -2252,8 +2250,6 @@ graph_size_location(image_desc_t *im, int elements if(leg_place(im)==-1) return -1; - /* last of three steps: check total height of image */ - if (im->yimg < Yvertical) im->yimg = Yvertical; #if 0 if (Xlegend > im->ximg) { @@ -2486,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); @@ -2871,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) @@ -3117,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);