-#if wxUSE_PANGO
-
-#define PANGO_ENABLE_ENGINE
-
-#ifdef __WXGTK20__
-#include "wx/gtk/private.h"
-#include "gtk/gtk.h"
-#else
-#include "wx/x11/private.h"
-#endif
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#include "wx/fontutil.h"
-#include <pango/pangoft2.h>
-#include <freetype/ftglyph.h>
-
-#ifndef FT_Outline_Decompose
- FT_EXPORT( FT_Error ) FT_Outline_Decompose(
- FT_Outline* outline,
- const FT_Outline_Funcs* interface,
- void* user );
-#endif
-
-typedef struct _OutlineInfo OutlineInfo;
-struct _OutlineInfo {
- wxPostScriptDC* caller;
-};
-
-static int paps_move_to( FT_Vector* to, void *user_data)
-{
- OutlineInfo *outline_info = (OutlineInfo*)user_data;
- outline_info->caller->PsPrintf( wxT("%d %d moveto\n"), (int)to->x, (int)to->y );
- return 0;
-}
-
-static int paps_line_to( FT_Vector* to, void *user_data)
-{
- OutlineInfo *outline_info = (OutlineInfo*)user_data;
- outline_info->caller->PsPrintf( wxT("%d %d lineto\n"), (int)to->x , (int)to->y );
- return 0;
-}
-
-static int paps_conic_to( FT_Vector* control, FT_Vector* to, void *user_data)
-{
- OutlineInfo *outline_info = (OutlineInfo*)user_data;
- outline_info->caller->PsPrintf( wxT("%d %d %d %d conicto\n"),
- (int)control->x ,
- (int)control->y ,
- (int)to->x ,
- (int)to->y );
- return 0;
-}
-
-static int
-paps_cubic_to( FT_Vector* control1, FT_Vector* control2,
- FT_Vector* to, void *user_data)
-{
- OutlineInfo *outline_info = (OutlineInfo*)user_data;
- outline_info->caller->PsPrintf(wxT("%d %d %d %d %d %d curveto\n"),
- (int)control1->x ,
- (int)control1->y ,
- (int)control2->x ,
- (int)control2->y ,
- (int)to->x ,
- (int)to->y );
- return 0;
-}
-
-void draw_bezier_outline(wxPostScriptDC* caller,
- FT_Face face,
- FT_UInt glyph_index,
- int pos_x,
- int pos_y,
- double scale_x,
- double scale_y )
-{
- FT_Int load_flags = FT_LOAD_NO_BITMAP;
- FT_Glyph glyph;
-
- FT_Outline_Funcs outlinefunc =
- {
- paps_move_to,
- paps_line_to,
- paps_conic_to,
- paps_cubic_to
- };
-
- OutlineInfo outline_info;
- outline_info.caller = caller;
-
- caller->PsPrint("gsave\n");
- caller->PsPrintf( wxT("%d %d translate\n"), pos_x, pos_y );
-
- // We have to replace the "," from the German
- // locale with the Englich "." for PostScript
- char buf[100];
- sprintf(buf, "%.8f %.8f scale\n", scale_x, scale_y );
- for (size_t i = 0; i < strlen(buf); i++)
- if (buf[i] == ',') buf[i] = '.';
- caller->PsPrint(buf);
-
- FT_Load_Glyph(face, glyph_index, load_flags);
- FT_Get_Glyph (face->glyph, &glyph);
- FT_Outline_Decompose (&(((FT_OutlineGlyph)glyph)->outline),
- &outlinefunc, &outline_info);
- caller->PsPrint("closepath fill grestore\n");
-
- FT_Done_Glyph (glyph);
-}
-
-#endif
-
-
-#if wxUSE_PANGO
-static void InitializePangoContext(PangoContext *context)
-{
-#ifdef __WXGTK__
- pango_context_set_base_dir(context,
- gtk_widget_get_default_direction() == GTK_TEXT_DIR_LTR ?
- PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
- pango_context_set_language(context, gtk_get_default_language());
-#else
- // FIXME: assuming LTR is incorrect!
- pango_context_set_base_dir(context, PANGO_DIRECTION_LTR);
- wxString lang = wxGetLocale()->GetCanonicalName();
- pango_context_set_language(context,
- pango_language_from_string(lang.ToAscii()));
-#endif
-}
-#endif
-
-void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )