+#if wxUSE_UNICODE
+
+#include <pango/pango.h>
+#include <pango/pangox.h>
+#include <pango/pangoxft.h>
+
+PangoContext* wxApp::GetPangoContext()
+{
+ static PangoContext *ret = NULL;
+ if (ret)
+ return ret;
+
+ Display *xdisplay = (Display*) wxApp::GetDisplay();
+
+#if 1
+ int xscreen = DefaultScreen(xdisplay);
+ static int use_xft = -1;
+ if (use_xft == -1)
+ {
+ wxString val = wxGetenv( L"GDK_USE_XFT" );
+ use_xft = (val == L"1");
+ }
+
+ if (use_xft)
+ ret = pango_xft_get_context( xdisplay, xscreen );
+ else
+#endif
+ ret = pango_x_get_context( xdisplay );
+
+ if (!PANGO_IS_CONTEXT(ret))
+ wxLogError( wxT("No pango context.") );
+
+ return ret;
+}
+#endif
+