+ if (string.IsEmpty())
+ {
+ if (x) (*x) = 0;
+ if (y) (*y) = 0;
+ return;
+ }
+
+#ifdef __WXGTK20__
+ PangoContext *context = NULL;
+ if (m_widget)
+ context = gtk_widget_get_pango_context( m_widget );
+
+ if (!context)
+ {
+ if (x) (*x) = 0;
+ if (y) (*y) = 0;
+ return;
+ }
+
+ PangoFontDescription *desc = fontToUse.GetNativeFontInfo()->description;
+ PangoLayout *layout = pango_layout_new(context);
+ pango_layout_set_font_description(layout, desc);
+ {
+#if wxUSE_UNICODE
+ const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
+ pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
+#else
+ const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
+ const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
+ pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
+#endif
+ }
+ PangoLayoutLine *line = (PangoLayoutLine *)pango_layout_get_lines(layout)->data;
+
+ PangoRectangle rect;
+ pango_layout_line_get_extents(line, NULL, &rect);
+
+ if (x) (*x) = (wxCoord) (rect.width / PANGO_SCALE);
+ if (y) (*y) = (wxCoord) (rect.height / PANGO_SCALE);
+ if (descent)
+ {
+ // Do something about metrics here
+ (*descent) = 0;
+ }
+ if (externalLeading) (*externalLeading) = 0; // ??
+
+ g_object_unref( G_OBJECT( layout ) );
+#else