summaryrefslogtreecommitdiff
path: root/graph.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2012-03-23 10:52:25 +0100
committerJens Axboe <axboe@kernel.dk>2012-03-23 10:52:25 +0100
commita1e7972d96ce1482aa43c2fcafd81d6c7f3c44d2 (patch)
tree4b1dc8bd89c309a774c7184099ee511621d4ee72 /graph.c
parent4e14f0181e1c0cc59a55601011ba7bc73e4c5b20 (diff)
downloadfio-a1e7972d96ce1482aa43c2fcafd81d6c7f3c44d2.tar.gz
fio-a1e7972d96ce1482aa43c2fcafd81d6c7f3c44d2.tar.bz2
gfio: improve and remember font selection
Redraw/expose doesn't quite work yet, though. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'graph.c')
-rw-r--r--graph.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/graph.c b/graph.c
index 415c676c..51eb3eff 100644
--- 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);