[test] fallback-resolution: center text

This commit is contained in:
Behdad Esfahbod 2006-08-14 21:34:03 -04:00
parent 7f21bfb0a8
commit 5acbef2021

View file

@ -47,6 +47,7 @@ static void
draw_with_ppi (cairo_t *cr, double width, double height, double ppi)
{
char message[80];
cairo_text_extents_t extents;
cairo_save (cr);
@ -63,10 +64,12 @@ draw_with_ppi (cairo_t *cr, double width, double height, double ppi)
0, 2.0 * M_PI);
cairo_fill (cr);
cairo_move_to (cr, .4 * SIZE/2.0, SIZE/2.0);
sprintf (message, "Fallback PPI: %g", ppi);
cairo_set_source_rgb (cr, 1, 1, 1); /* white */
cairo_set_font_size (cr, .1 * SIZE / 2.0);
cairo_text_extents (cr, message, &extents);
cairo_move_to (cr, (SIZE-extents.width)/2.0-extents.x_bearing,
(SIZE-extents.height)/2.0-extents.y_bearing);
cairo_show_text (cr, message);
cairo_restore (cr);