-#if defined(__WXGTK20__) && wxUSE_WCHAR_T
- /* FIXME: the layout engine should probably be abstracted at a higher level in wxDC... */
- PangoLayout *layout = pango_layout_new(m_context);
- pango_layout_set_font_description(layout, m_fontdesc);
+#ifdef __WXGTK20__
+ wxCHECK_RET( m_context, wxT("no Pango context") );
+ wxCHECK_RET( m_layout, wxT("no Pango layout") );
+ wxCHECK_RET( m_fontdesc, wxT("no Pango font description") );
+
+#if wxUSE_UNICODE
+ const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
+#else
+ const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
+ const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
+#endif
+ pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
+
+ if (m_scaleY != 1.0)
+ {
+ // If there is a user or actually any scale applied to
+ // the device context, scale the font.
+
+ // scale font description
+ gint oldSize = pango_font_description_get_size( m_fontdesc );
+ double size = oldSize;
+ size = size * m_scaleY;
+ pango_font_description_set_size( m_fontdesc, (gint)size );
+
+ // actually apply scaled font
+ pango_layout_set_font_description( m_layout, m_fontdesc );
+
+ // Draw layout.
+ gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
+
+ // reset unscaled size
+ pango_font_description_set_size( m_fontdesc, oldSize );
+
+ // actually apply unscaled font
+ pango_layout_set_font_description( m_layout, m_fontdesc );
+ }
+ else