+
+/* Return the width that an 'M' character would occupy when typeset in WIDGET */
+static guint
+calc_m_width (GtkWidget *widget, const PangoFontDescription *font_desc)
+{
+ PangoRectangle rect;
+ PangoLayout *layout ;
+ PangoContext * context;
+
+ context = gtk_widget_create_pango_context (widget);
+ g_assert (context);
+ layout = pango_layout_new (context);
+ g_assert (layout);
+
+ pango_layout_set_text (layout, "M", 1);
+
+ pango_layout_set_font_description (layout, font_desc);
+
+ pango_layout_get_extents (layout, NULL, &rect);
+
+ g_object_unref (G_OBJECT(layout));
+ g_object_unref (G_OBJECT(context));
+
+ return PANGO_PIXELS(rect.width);
+}