+static void
+get_characters_max_width_height (FT_Face ft_face, double size,
+ const char *characters,
+ double *max_width, double *max_height)
+{
+ cairo_surface_t *surface;
+ cairo_t *cr;
+ cairo_font_face_t *cr_face;
+
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ 1, 1);
+
+ cr = cairo_create (surface);
+
+/*
+ cairo_select_font_face (cr, fontname,
+ CAIRO_FONT_SLANT_NORMAL,
+ CAIRO_FONT_WEIGHT_NORMAL);
+*/
+ cr_face = cairo_ft_font_face_create_for_ft_face (ft_face, 0);
+ cairo_set_font_face (cr, cr_face);
+
+ cairo_set_font_size (cr, size);
+
+ cairo_set_line_width (cr, 1.0);
+
+ *max_width = get_max_width(cr, characters);
+ *max_height = get_max_height(cr, characters);
+
+ cairo_font_face_destroy (cr_face);
+
+ cairo_destroy (cr);
+
+ cairo_surface_destroy(surface);
+}
+