[rrd-developers] Patch to rrd_gfx.c

larryjadams at comcast.net larryjadams at comcast.net
Fri Apr 6 03:32:53 CEST 2007


Nice!
 -------------- Original message ----------------------
From: "Travis Spencer" <travislspencer at gmail.com>
> Good Afternoon All,
> 
> I was trying to generate some graphs this afternoon w/ the following
> command in a batch script:
> 
> rrdtool.exe ^
>     graph %OUTPUT% ^
>     -h 116 ^
>     -w 368 ^
>     -s -1month ^
>     -e now ^
>     -c ARROW#000000 ^
>     -c MGRID#CCCCCC ^
>     -c GRID#FFFFFF ^
>     -c FONT#8D8D8D ^
>     -c SHADEA#FFFFFF ^
>     -c SHADEB#FFFFFF ^
>     -c AXIS#000000 ^
>     -x HOUR:1:HOUR:1:HOUR:1:0:%%H ^
>     -g ^
>     -A ^
>     -a PNG ^
>     DEF:in=%RRD_FILE%.rrd:ds0:AVERAGE ^
>     LINE1:in#0000FF
> 
> This produced the following error:
> 
> ...
> time 1175760000:  -1.#Je+000
> time 1175767500:  -1.#Je+000
> time 1175775000:  -1.#Je+000
> time 1175782500:  -1.#Je+000
> time 1175790000:  -1.#Je+000
> time 1175797500:  -1.#Je+000
> time 1175805000:  -1.#Je+000
> time 1175812500:  -1.#Je+000
> digits  0.000  im->magfact  1.000
> Min:   0.00 Max:   1.00 MagFactor:   1.00
> SCALED Min:  -0.10 Max:   1.10 Factor:   1.00
> 443x170
> ERROR: failed to load C:\WINDOWS\fonts\arial.ttf
> 
> I tracked it down to an error in FreeType's ftsystem.c when it called fopen:
> 
>     file = fopen( filepathname, "rb" );
>     if ( !file )
>     {
>       FT_ERROR(( "FT_Stream_Open:" ));
>       FT_ERROR(( " could not open `%s'\n", filepathname ));
> 
>       return FT_Err_Cannot_Open_Resource;
>     }
> 
> I checked errno at that point, and found that the process had to many
> files opened.  I checked the FreeType docs and read that after calling
> FT_Open_Face (which gfx_save_png calls indirectly when it invokes
> FT_New_Face) FT_Done_Face should be called.  Once I did that, rrdtool
> was able to execute my graph function for me.
> 
> The patch is included below.  HTH!
> 
> -- 
> 
> Regards,
> 
> Travis Spencer
> 
> --- rrd_gfx.c~	Thu Apr 05 13:53:59 2007
> +++ rrd_gfx.c	Thu Apr 05 13:50:04 2007
> 
> @@ -612,3 +609,4 @@
>                                   &face );
>  	    if ( error ) {
>  	        rrd_set_error("failed to load %s",node->filename);
> +           FT_Done_Face(face);
> 
>  		break;
>  	    }
> @@ -620,6 +618,11 @@
>                                       (long)(node->size*64),
>                                       (long)(100*canvas->zoom),
>                                       (long)(100*canvas->zoom));
> -            if ( error ) break;
> +            if ( error )
> +            {
> +                FT_Done_Face(face);
> +                break;
> +            }
> +
>              pen_x = node->x * canvas->zoom;
>              pen_y = node->y * canvas->zoom;
> 
>              string = gfx_string_create (canvas, face, node->text,
> node->angle, node->tabwidth, node->size);
> +            FT_Done_Face(face);
> +
>              switch(node->halign){
>              case GFX_H_RIGHT:  vec.x = -string->bbox.xMax;
>                                 break;
> 
> _______________________________________________
> rrd-developers mailing list
> rrd-developers at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers



More information about the rrd-developers mailing list