+ ev_document_fc_mutex_lock ();
+
+ layout = gtk_widget_create_pango_layout (GTK_WIDGET (view), loading_text);
+
+ font_desc = pango_font_description_new ();
+
+ /* We set the font to be 10 points, get the size, and scale appropriately */
+ pango_font_description_set_size (font_desc, 10 * PANGO_SCALE);
+ pango_layout_set_font_description (layout, font_desc);
+ pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+
+ /* Make sure we fit the middle of the page */
+ target_width = MAX (page_area->width / 2, 1);
+ real_scale = ((double)target_width / (double) logical_rect.width) * (PANGO_SCALE * 10);
+ pango_font_description_set_size (font_desc, (int)real_scale);
+ pango_layout_set_font_description (layout, font_desc);
+ pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+
+ view->loading_text = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ logical_rect.width,
+ logical_rect.height);
+ cr = cairo_create (view->loading_text);
+ cairo_set_source_rgb (cr,
+ 155 / (double)255,
+ 155 / (double)255,
+ 155 / (double)255);
+ pango_cairo_show_layout (cr, layout);
+ cairo_destroy (cr);
+
+ pango_font_description_free (font_desc);
+ g_object_unref (layout);
+
+ ev_document_fc_mutex_unlock ();
+ }