/****************************************************************************
- * RRDtool 1.2.8 Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.9 Copyright by Tobi Oetiker, 1997-2005
****************************************************************************
* rrd_gfx.c graphics wrapper for rrdtool
**************************************************************************/
/* #define DEBUG */
#ifdef DEBUG
-# define DPRINT(x) (void)(printf x, printf("\n"))
+# define DPRINTF(x,...) fprintf(stderr, x, ## __VA_ARGS__);
#else
-# define DPRINT(x)
+# define DPRINTF(x,...)
#endif
#include "rrd_tool.h"
#include <png.h>
struct gfx_string_s {
unsigned int width;
unsigned int height;
- size_t count; /* number of characters */
+ int count; /* number of characters */
gfx_char glyphs;
size_t num_glyphs;
FT_BBox bbox;
gfx_string string = (gfx_string) malloc (sizeof(struct gfx_string_s));
gfx_char glyph; /* current glyph in table */
- unsigned int n;
+ int n;
int error;
int gottab = 0;
use_kerning = FT_HAS_KERNING(face);
previous = 0;
glyph = string->glyphs;
- for (n=0; n<string->count;glyph++) {
+ for (n=0; n<string->count;glyph++,n++) {
FT_Vector vec;
/* handle the tabs ...
have a witespace glyph inserted, but set its width such that the distance
canvas->aa_type == AA_LIGHT ? FT_LOAD_TARGET_LIGHT :
FT_LOAD_TARGET_MONO : FT_LOAD_TARGET_MONO);
if (error) {
- fprintf (stderr, "couldn't load glyph: %c\n", letter);
+ DPRINTF("couldn't load glyph: %c\n", letter)
continue;
}
error = FT_Get_Glyph (slot, &glyph->image);
if (error) {
- fprintf (stderr, "couldn't get glyph from slot: %c\n", letter);
+ DPRINTF("couldn't get glyph %c from slot %d\n", letter, (int)slot)
continue;
}
/* if we are in tabbing mode, we replace the tab with a space and shift the position
FT_Vector_Transform (&vec, &string->transform);
error = FT_Glyph_Transform (glyph->image, &string->transform, &vec);
if (error) {
- fprintf (stderr, "couldn't transform glyph\n");
+ DPRINTF("couldn't transform glyph id %d\n", letter)
continue;
}
canvas->aa_type == AA_LIGHT ? FT_RENDER_MODE_LIGHT :
FT_RENDER_MODE_MONO : FT_RENDER_MODE_MONO, 0, 1);
if (error) {
- fprintf (stderr, "couldn't convert glyph to bitmap\n");
+ DPRINTF("couldn't convert glyph id %d to bitmap\n", letter)
continue;
}
/* increment number of glyphs */
previous = glyph->index;
string->num_glyphs++;
- n++;
-
}
free(cstr);
/* printf ("number of glyphs = %d\n", string->num_glyphs);*/
pen_x += vec.x/64;
pen_y += vec.y/64;
glyph = string->glyphs;
- for(n=0; n<string->num_glyphs; ++n, ++glyph) {
+ for(n=0; n<string->num_glyphs; n++, glyph++) {
int gr;
FT_Glyph image;
FT_BitmapGlyph bit;
/* long buf_x,comp_n; */
/* make copy to transform */
if (! glyph->image) {
- fprintf (stderr, "no image\n");
+ DPRINTF("no image\n")
continue;
}
error = FT_Glyph_Copy (glyph->image, &image);
if (error) {
- fprintf (stderr, "couldn't copy image\n");
+ DPRINTF("couldn't copy image\n")
continue;
}
state.linecap = -1;
state.linejoin = -1;
state.has_dash = 0;
+ state.line_width = 1;
if (eps_prologue(&state) == -1)
return -1;
eps_set_color(&state, background);