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,
, /* 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);
, 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 */