+ wxCHECK_RET( fontToUse.IsOk(), wxT("invalid font") );
+
+ if (string.empty())
+ {
+ if (x) (*x) = 0;
+ if (y) (*y) = 0;
+ return;
+ }
+
+#if wxUSE_UNICODE
+ PangoLayout *layout = pango_layout_new( wxTheApp->GetPangoContext() );
+
+ PangoFontDescription *desc = fontToUse.GetNativeFontInfo()->description;
+ pango_layout_set_font_description(layout, desc);
+
+ const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
+ pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
+
+ 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; // ??