gfio: improve and remember font selection
[fio.git] / graph.c
diff --git a/graph.c b/graph.c
index 415c676cd792e2b43c9372c3aaccf448a1a1dcd0..51eb3eff17cb1f5f4d99ee203ea3718f4c482774 100644 (file)
--- a/graph.c
+++ b/graph.c
@@ -123,10 +123,15 @@ struct graph *graph_new(unsigned int xdim, unsigned int ydim, const char *font)
        g->per_label_limit = -1;
        g->font = font;
        if (!g->font)
-               g->font = "Sans";
+               g->font = GRAPH_DEFAULT_FONT;
        return g;
 }
 
+void graph_set_font(struct graph *g, const char *font)
+{
+       g->font = font;
+}
+
 void graph_x_axis_unit_change_notify(struct graph *g, graph_axis_unit_change_callback f)
 {
        g->x_axis_unit_change_callback = f;
@@ -286,7 +291,7 @@ static void draw_aligned_text(struct graph *g, cairo_t *cr, double x, double y,
                        factor = 1.0;
                        break;
        }
-       cairo_select_font_face (cr, g->font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+       cairo_select_font_face(cr, g->font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
 
        cairo_set_font_size(cr, fontsize);
        cairo_text_extents(cr, text, &extents);