summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f5b46b2)
raw | patch | inline | side by side (parent: f5b46b2)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 31 Aug 2008 23:42:02 +0000 (23:42 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 31 Aug 2008 23:42:02 +0000 (23:42 +0000) |
src/rrd_gfx.c | patch | blob | history | |
src/rrd_graph.c | patch | blob | history | |
src/rrd_graph.h | patch | blob | history |
diff --git a/src/rrd_gfx.c b/src/rrd_gfx.c
index be536c5183020778822e2d1ac885c748f817c314..df3ebcbd267668021ed9323cb03fc6d612827cb9 100644 (file)
--- a/src/rrd_gfx.c
+++ b/src/rrd_gfx.c
pango_tab_array_free(tab_array);
}
pfd = pango_layout_get_font_description(layout);
- if (pfd && pango_font_description_equal (pfd,font_desc)){
+
+ if (!pfd || !pango_font_description_equal (pfd,font_desc)){
pango_layout_set_font_description(layout, font_desc);
- }
+ }
+// fprintf(stderr,"%s\n",pango_font_description_to_string(pango_layout_get_font_description(layout)));
cairo_new_path(cr);
cairo_set_source_rgba(cr, color.red, color.green, color.blue,
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index 36dbddffe9566564e74da1349abe348b7ddd81a9..cb93192598bc98239306e091b035bd38cc6164ba 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
, /* unit */
{8.0, RRD_DEFAULT_FONT,NULL} /* legend */
,
- {5.5, RRD_DEFAULT_FONT,NULL} /* watermark */
+ {5.5, RRD_DEFAULT_FONT,NULL} /* watermark */
};
xlab_t xlab[] = {
static text_prop_t tp_cache[] = { {-1,"",NULL}, {-1,"",NULL}, {-1,"",NULL}, {-1,"",NULL}, {-1,"",NULL}, {-1,"",NULL}};
if (tp_cache[prop].font_desc == NULL){
- tp_cache[prop].font_desc = pango_font_description_new();
+ if (prop > 0 && tp_cache[0].font_desc != NULL){
+ tp_cache[prop].font_desc = pango_font_description_copy (tp_cache[0].font_desc);
+ strcpy(tp_cache[prop].font,tp_cache[0].font);
+ tp_cache[prop].size = tp_cache[0].size;
+ }
+ else {
+ tp_cache[prop].font_desc = pango_font_description_new();
+ }
im->text_prop[prop].font_desc = pango_font_description_copy (tp_cache[prop].font_desc);
}
im->text_prop[prop].size = size;
tp_cache[prop].size = size;
}
+ if (im->text_prop[prop].size < 0){
+ im->text_prop[prop].size = tp_cache[prop].size;
+ im->text_prop[prop].font_desc = pango_font_description_copy( tp_cache[prop].font_desc );
+ strcpy(im->text_prop[prop].font,tp_cache[prop].font);
+ }
+ // fprintf(stderr,"%d %s\n",prop,pango_font_description_to_string(im->text_prop[prop].font_desc));
}
void rrd_graph_init(
im->cr = cairo_create(im->surface);
for (i = 0; i < DIM(text_prop); i++) {
- rrd_set_font_desc(im,i, deffont ? deffont : text_prop[i].font,text_prop[i].size);
+ im->text_prop[i].size = -1;
+ rrd_set_font_desc(im,i, deffont ? deffont : text_prop[i].font,text_prop[i].size);
}
im->layout = pango_cairo_create_layout(im->cr);
diff --git a/src/rrd_graph.h b/src/rrd_graph.h
index fefa982f3f5171cffbdade54f08d9333a93cfb18..62765086a69c5d7b4605d38a8037c275507071ce 100644 (file)
--- a/src/rrd_graph.h
+++ b/src/rrd_graph.h
, VDEF_LSLINT /* least squares line y_intercept */
, VDEF_LSLCORREL /* least squares line correlation coefficient */
};
-enum text_prop_en { TEXT_PROP_DEFAULT = 0, /* default settings */
+enum text_prop_en {
+ TEXT_PROP_DEFAULT = 0, /* default settings */
TEXT_PROP_TITLE, /* properties for the title */
TEXT_PROP_AXIS, /* for the numbers next to the axis */
TEXT_PROP_UNIT, /* for the vertical unit description */