Index: drivers/wxwidgets.cpp
===================================================================
--- drivers/wxwidgets.cpp	(revision 12533)
+++ drivers/wxwidgets.cpp	(working copy)
@@ -192,6 +192,12 @@
 
 void wxPLDevBase::AddtoClipRegion( int x1, int y1, int x2, int y2 )
 {
+
+	x1 *= clipscalex;
+	x2 *= clipscalex;
+	y1 *= clipscaley;
+	y2 *= clipscaley;
+
     newclipregion = false;
     if ( x1 < x2 )
     {
@@ -274,7 +280,6 @@
                         fontScale *= 1.25; // Subscript scaling parameter
                     else
                         fontScale *= 0.8;  // Subscript scaling parameter
-                    PSSetFont( fci );
 
                     yOffset += scaley * fontSize * fontScale / 2.;
                 }
@@ -288,7 +293,6 @@
                         fontScale *= 1.25; // Subscript scaling parameter
                     else
                         fontScale *= 0.8;  // Subscript scaling parameter
-                    PSSetFont( fci );
 
                     yOffset -= scaley * fontSize * old_fontScale / 2.;
                 }
@@ -297,11 +301,32 @@
                     PSDrawTextToDC( utf8_string, drawText );
 
                     underlined = !underlined;
-                    PSSetFont( fci );
                 }
                 if ( ucs4[i] == (PLUNICODE) '+' ) // overline
                 {                                 // not implemented yet
                 }
+				if ( ucs4[i] == (PLUNICODE) '{' ) // a change of font face.
+				{
+					// draw string so far
+					PSDrawTextToDC( utf8_string, drawText );
+
+					//read new font
+					int charindex=i+1;
+					int charswritten=0;
+					wxString fontface;
+					while(ucs4[charindex] != (PLUNICODE) '}' && ucs4[charindex] != (PLUNICODE) '\0' && charswritten<255)
+					{
+						//get the character as utf8 (could be up to 4 chars)
+						ucs4_to_utf8( ucs4[charindex], utf8 );
+						fontface=fontface+wxString(utf8,wxConvUTF8);
+						++charindex;
+						++charswritten;
+					}
+					fontface[charswritten]='\0';
+					PSSetFont( fci, fontface );
+					//move i along so we don't print the font name
+					i=charindex;
+				}
                 i++;
             }
         }
@@ -312,7 +337,7 @@
 
             // get new font
             fci = ucs4[i];
-            PSSetFont( fci );
+            PSSetFont( fci, wxT("") );
             i++;
         }
     }
@@ -331,7 +356,6 @@
     // Log_Verbose( "common_init()" );
 
     wxPLDevBase* dev;
-    PLFLT      downscale, downscale2;
 
     // default options
     static PLINT freetype    = -1;
@@ -357,7 +381,7 @@
         { "smooth",   DRV_INT, &smooth_text, "Turn text smoothing on (1) or off (0)"                                            },
 #endif
         { "hrshsym",  DRV_INT, &hrshsym,     "Use Hershey symbol set (hrshsym=0|1)"                                             },
-        { "backend",  DRV_INT, &backend,     "Choose backend: (0) standard, (1) using AGG library, (2) using wxGraphicsContext" },
+        { "backend",  DRV_INT, &backend,     "Choose backend: (0) using wxDC, (1) using AGG library, (2) using wxGraphicsContext, (3) using wxGCDC" },
         { "text",     DRV_INT, &text,        "Use own text routines (text=0|1)"                                                 },
         { NULL,       DRV_INT, NULL,         NULL                                                                               }
     };
@@ -372,7 +396,7 @@
         // in case wxGraphicsContext isn't available, the next backend (agg
         // if available) in this list will be used
 #if wxUSE_GRAPHICS_CONTEXT
-        dev = new wxPLDevGC;
+        dev = new wxPLDevDC( backend );
         // by default the own text routines are used for wxGC
         if ( text == -1 )
             text = 1;
@@ -391,7 +415,7 @@
         break;
 #endif
     default:
-        dev = new wxPLDevDC;
+        dev = new wxPLDevDC ( backend );
         // by default the own text routines are used for wxDC
         if ( text == -1 )
         {
@@ -477,27 +501,8 @@
         pls->freeaspect = 1;
     }
 
-    // Set the number of pixels per mm
-    plP_setpxl( (PLFLT) VIRTUAL_PIXELS_PER_MM, (PLFLT) VIRTUAL_PIXELS_PER_MM );
+	wx_set_size(pls, dev->width, dev->height);
 
-    // Set up physical limits of plotting device (in drawing units)
-    downscale  = (double) dev->width / (double) ( PIXELS_X - 1 );
-    downscale2 = (double) dev->height / (double) PIXELS_Y;
-    if ( downscale < downscale2 )
-        downscale = downscale2;
-    plP_setphy( (PLINT) 0, (PLINT) ( dev->width / downscale ),
-        (PLINT) 0, (PLINT) ( dev->height / downscale ) );
-
-    // get physical device limits coordinates
-    plP_gphy( &dev->xmin, &dev->xmax, &dev->ymin, &dev->ymax );
-
-    // setting scale factors
-    dev->scalex = (PLFLT) ( dev->xmax - dev->xmin ) / ( dev->width );
-    dev->scaley = (PLFLT) ( dev->ymax - dev->ymin ) / ( dev->height );
-
-    // set dpi
-    plspage( VIRTUAL_PIXELS_PER_IN / dev->scalex, VIRTUAL_PIXELS_PER_IN / dev->scaley, 0, 0, 0, 0 );
-
 #ifdef PL_HAVE_FREETYPE
     if ( dev->freetype )
         init_freetype_lv2( pls );
@@ -520,7 +525,7 @@
 void plD_dispatch_init_wxwidgets( PLDispatchTable *pdt )
 {
 #ifndef ENABLE_DYNDRIVERS
-    pdt->pl_MenuStr = "wxWidgets DC";
+    pdt->pl_MenuStr = "wxWidgets";
     pdt->pl_DevName = "wxwidgets";
 #endif
     pdt->pl_type     = plDevType_Interactive;
@@ -979,16 +984,34 @@
 
     wxPLDevBase* dev = (wxPLDevBase *) pls->dev;
 
-    // set new size and scale parameters
+
     dev->width  = width;
     dev->height = height;
-    dev->scalex = (PLFLT) ( dev->xmax - dev->xmin ) / dev->width;
-    dev->scaley = (PLFLT) ( dev->ymax - dev->ymin ) / dev->height;
 
-    // recalculate the dpi used in calculation of fontsize
-    pls->xdpi = VIRTUAL_PIXELS_PER_IN / dev->scalex;
-    pls->ydpi = VIRTUAL_PIXELS_PER_IN / dev->scaley;
+	
 
+    // Set up physical limits of plotting device (in drawing units)
+	// We scale this to give increased resolution for anti-aliaing
+	double scale =( double )( SHRT_MAX-2 ) / ( double )( std::max( dev->width, dev->height ) );
+	scale=floor(scale);
+
+    // set scale factors in the device
+	dev->SetScaleFactor(1.0/scale);
+
+    // Set the number of pixels per mm
+    plP_setpxl( dev->virtualPixelsPerMm, dev->virtualPixelsPerMm );
+
+	
+    plP_setphy( (PLINT) 0, (PLINT) ( dev->width * scale ),
+        (PLINT) 0, (PLINT) ( dev->height * scale ) );
+
+    // get physical device limits coordinates
+    plP_gphy( &dev->xmin, &dev->xmax, &dev->ymin, &dev->ymax );
+
+    // set dpi
+    plspage( dev->virtualPixelsPerInch * scale, dev->virtualPixelsPerInch * scale, 0, 0, 0, 0 );
+
+
     // clear background if we have a dc, since it's invalid (TODO: why, since in bop
     // it must be cleared anyway?)
     if ( dev->ready )
@@ -1005,8 +1028,8 @@
     if ( dev->freetype )
     {
         FT_Data *FT = (FT_Data *) pls->FT;
-        FT->scalex = dev->scalex;
-        FT->scaley = dev->scaley;
+        FT->scalex = 1.0 / scale;
+        FT->scaley = 1.0 / scale;
         FT->ymax   = dev->height;
     }
 #endif
Index: drivers/wxwidgets.h
===================================================================
--- drivers/wxwidgets.h	(revision 12533)
+++ drivers/wxwidgets.h	(working copy)
@@ -48,11 +48,9 @@
 // side, but report/receive everything in virtual coordinates to/from the
 // PLplot core.
 //
-#define VSCALE                   ( 40. )
 
 // pixels per inch
 #define DEVICE_PIXELS_PER_IN     ( 80. )
-#define VIRTUAL_PIXELS_PER_IN    ( DEVICE_PIXELS_PER_IN * VSCALE )
 
 
 // mm per inch
@@ -60,16 +58,11 @@
 
 // pixels per mm
 #define DEVICE_PIXELS_PER_MM         ( DEVICE_PIXELS_PER_IN / MM_PER_IN )
-#define VIRTUAL_PIXELS_PER_MM        ( VIRTUAL_PIXELS_PER_IN / MM_PER_IN )
 
 // Default dimensions of the canvas (in inches)
 #define CANVAS_WIDTH                 ( 10.0 )
 #define CANVAS_HEIGHT                ( 7.5 )
 
-// size of plot in pixels on screen if not given
-#define PLOT_WIDTH                   ( 800 )
-#define PLOT_HEIGHT                  ( 600 )
-
 // These need to be distinguished since the handling is slightly different.
 #define LOCATE_INVOKED_VIA_API       1
 #define LOCATE_INVOKED_VIA_DRIVER    2
@@ -78,6 +71,7 @@
 #define wxBACKEND_DC                 0
 #define wxBACKEND_AGG                1
 #define wxBACKEND_GC                 2
+#define wxBACKEND_GCDC               3
 
 class wxPLplotFrame;
 
@@ -108,7 +102,8 @@
     virtual void ProcessString( PLStream* pls, EscText* args ) = 0;
     virtual void PSDrawText( PLUNICODE* ucs4, int ucs4Len, bool drawText );
     virtual void PSDrawTextToDC( char* utf8_string, bool drawText ) = 0;
-    virtual void PSSetFont( PLUNICODE fci ) = 0;
+    virtual void PSSetFont( PLUNICODE fci, const wxString &FontFace ) = 0;
+	virtual void SetScaleFactor(PLFLT scale) = 0;
 
 public: // variables
     const int    backend;
@@ -128,14 +123,16 @@
     PLINT        bm_width;
     PLINT        bm_height;
 
+    PLFLT        scalex;
+    PLFLT        scaley;
+    PLFLT        clipscalex;
+    PLFLT        clipscaley;
+
     PLINT        xmin;
     PLINT        xmax;
     PLINT        ymin;
     PLINT        ymax;
 
-    PLFLT        scalex;
-    PLFLT        scaley;
-
     bool         plstate_width;         // Flags indicating change of state before
     bool         plstate_color0;        // device is fully initialized
     bool         plstate_color1;        // taken from gcw driver
@@ -174,13 +171,16 @@
     PLFLT            rotation, cos_rot, sin_rot;
     PLFLT            shear, cos_shear, sin_shear;
     PLFLT            stride;
+
+	double virtualPixelsPerInch;
+	double virtualPixelsPerMm;
 };
 
 
 class wxPLDevDC : public wxPLDevBase
 {
 public: // methods
-    wxPLDevDC( void );
+    wxPLDevDC( int backend );
     ~wxPLDevDC( void );
 
     void DrawLine( short x1a, short y1a, short x2a, short y2a );
@@ -200,11 +200,15 @@
 #endif // PL_HAVE_FREETYPE
     void ProcessString( PLStream* pls, EscText* args );
     void PSDrawTextToDC( char* utf8_string, bool drawText );
-    void PSSetFont( PLUNICODE fci );
+    void PSSetFont( PLUNICODE fci, const wxString &FontFace = wxEmptyString );
+	void SetScaleFactor(PLFLT scale);
 
 private: // variables
-    wxBitmap* m_bitmap;
-    wxDC    * m_dc;
+    wxBitmap   *m_bitmap;
+    wxDC       *m_dc;
+	wxMemoryDC *m_wrappedDc;
+	PLFLT       m_logicalScale;
+	bool        m_usinggcdc;
 };
 
 
@@ -263,9 +267,10 @@
 #endif // PL_HAVE_FREETYPE
     void ProcessString( PLStream* pls, EscText* args );
     void PSDrawTextToDC( char* utf8_string, bool drawText );
-    void PSSetFont( PLUNICODE fci );
+    void PSSetFont( PLUNICODE fci, const wxString &FontFace = wxEmptyString );
     void drawPath( drawPathFlag flag );
     void AGGAddtoClipRegion( short x1, short y1, short x2, short y2 );
+	void SetScaleFactor(PLFLT scale);
 
 private: // variables
     wxDC * mDC;
@@ -331,7 +336,8 @@
 #endif // PL_HAVE_FREETYPE
     void ProcessString( PLStream* pls, EscText* args );
     void PSDrawTextToDC( char* utf8_string, bool drawText );
-    void PSSetFont( PLUNICODE fci );
+    void PSSetFont( PLUNICODE fci, const wxString &FontFace = wxEmptyString );
+	void SetScaleFactor(PLFLT scale);
 
 private: // variables
     wxBitmap         * m_bitmap;
Index: drivers/wxwidgets_agg.cpp
===================================================================
--- drivers/wxwidgets_agg.cpp	(revision 12533)
+++ drivers/wxwidgets_agg.cpp	(working copy)
@@ -546,14 +546,26 @@
 }
 
 
-void wxPLDevAGG::PSSetFont( PLUNICODE fci )
+void wxPLDevAGG::PSSetFont( PLUNICODE fci, const wxString &FontFace )
 {
-    // convert the fci to Base14/Type1 font information
-    wxString fontname = fontdir + wxString( plP_FCI2FontName( fci, TrueTypeLookup, N_TrueTypeLookup ), *wxConvCurrent );
-
-    if ( !mFontEngine.load_font( "/usr/share/fonts/truetype/freefont/FreeSans.ttf", 0, agg::glyph_ren_agg_gray8 ) )
-        plabort( "Font could not be loaded" );
-    //mFontEngine.load_font( "c:\\windows\\fonts\\arial.ttf", 0, agg::glyph_ren_agg_gray8 );
+	//try to load the given font face
+	wxString fontname=fontdir+wxString( FontFace, *wxConvCurrent );
+	if ( !mFontEngine.load_font( FontFace.mb_str(), 0, agg::glyph_ren_agg_gray8 ) )
+	{
+		//try to load the font from the fci
+		// convert the fci to Base14/Type1 font information
+		fontname = fontdir + wxString( plP_FCI2FontName( fci, TrueTypeLookup, N_TrueTypeLookup ), *wxConvCurrent );
+		if ( !mFontEngine.load_font( fontname.mb_str(), 0, agg::glyph_ren_agg_gray8 ) )
+		{
+			//try to load from the freefont linux folder
+			if ( !mFontEngine.load_font( "/usr/share/fonts/truetype/freefont/FreeSans.ttf", 0, agg::glyph_ren_agg_gray8 ) )
+			{
+				//try to load a default windows font
+				if ( !mFontEngine.load_font( "c:\\windows\\fonts\\arial.ttf", 0, agg::glyph_ren_agg_gray8 ))
+					plabort( "Font could not be loaded" ); //abort if we found none of these
+			}
+		}
+	}
     mFontEngine.height( fontSize * fontScale );
     mFontEngine.width( fontSize * fontScale );
     mFontEngine.hinting( true );
@@ -606,3 +618,12 @@
 
     AddtoClipRegion( 0, 0, width, height );
 }
+
+void wxPLDevAGG::SetScaleFactor(PLFLT scale)
+{
+	scalex=scale;
+	scaley=scale;
+	
+	virtualPixelsPerInch = DEVICE_PIXELS_PER_IN / scale;
+	virtualPixelsPerMm = virtualPixelsPerInch * MM_PER_IN;
+}
Index: drivers/wxwidgets_dc.cpp
===================================================================
--- drivers/wxwidgets_dc.cpp	(revision 12533)
+++ drivers/wxwidgets_dc.cpp	(working copy)
@@ -45,12 +45,15 @@
 //  Constructor of the standard wxWidgets device based on the wxPLDevBase
 //  class. Only some initialisations are done.
 //--------------------------------------------------------------------------
-wxPLDevDC::wxPLDevDC( void ) : wxPLDevBase( wxBACKEND_DC )
+wxPLDevDC::wxPLDevDC( int backend ) : wxPLDevBase( backend )
 {
-    m_dc       = NULL;
-    m_bitmap   = NULL;
-    m_font     = NULL;
-    underlined = false;
+    m_dc           = NULL;
+	m_wrappedDc    = NULL;
+    m_bitmap       = NULL;
+    m_font         = NULL;
+    underlined     = false;
+	m_logicalScale = 0.0;
+	m_usinggcdc    = backend == wxBACKEND_GC || backend == wxBACKEND_GCDC;
 }
 
 
@@ -63,9 +66,15 @@
 {
     if ( ownGUI )
     {
+		if ( m_wrappedDc )
+		{
+            ( (wxMemoryDC *) m_wrappedDc )->SelectObject( wxNullBitmap );
+            delete m_wrappedDc;
+		}
         if ( m_dc )
         {
-            ( (wxMemoryDC *) m_dc )->SelectObject( wxNullBitmap );
+			if( !m_usinggcdc )
+				( (wxMemoryDC *) m_dc )->SelectObject( wxNullBitmap );
             delete m_dc;
         }
         if ( m_bitmap )
@@ -84,8 +93,8 @@
 //--------------------------------------------------------------------------
 void wxPLDevDC::DrawLine( short x1a, short y1a, short x2a, short y2a )
 {
-    x1a = (short) ( x1a / scalex ); y1a = (short) ( height - y1a / scaley );
-    x2a = (short) ( x2a / scalex );        y2a = (short) ( height - y2a / scaley );
+    x1a = (short) ( x1a ); y1a = (short) ( ymax - ymin - y1a );
+    x2a = (short) ( x2a );        y2a = (short) ( ymax - ymin - y2a );
 
     m_dc->DrawLine( (wxCoord) x1a, (wxCoord) y1a, (wxCoord) x2a, (wxCoord) y2a );
 
@@ -102,13 +111,13 @@
 {
     wxCoord x1a, y1a, x2a, y2a;
 
-    x2a = (wxCoord) ( xa[0] / scalex );
-    y2a = (wxCoord) ( height - ya[0] / scaley );
+    x2a = (wxCoord) ( xa[0] );
+    y2a = (wxCoord) ( ymax - ymin - ya[0] );
     for ( PLINT i = 1; i < npts; i++ )
     {
         x1a = x2a; y1a = y2a;
-        x2a = (wxCoord) ( xa[i] / scalex );
-        y2a = (wxCoord) ( height - ya[i] / scaley );
+        x2a = (wxCoord) ( xa[i] );
+        y2a = (wxCoord) ( ymax - ymin - ya[i] );
 
         m_dc->DrawLine( x1a, y1a, x2a, y2a );
 
@@ -129,19 +138,19 @@
     if ( x1 < 0 )
         x1 = 0;
     else
-        x1 = (PLINT) ( x1 / scalex );
+        x1 = (PLINT) ( x1 );
     if ( y1 < 0 )
         y1 = 0;
     else
-        y1 = (PLINT) ( height - y1 / scaley );
+        y1 = (PLINT) ( ymax - ymin - y1 );
     if ( x2 < 0 )
-        x2 = width;
+        x2 = xmax - xmin;
     else
-        x2 = (PLINT) ( x2 / scalex );
+        x2 = (PLINT) ( x2 );
     if ( y2 < 0 )
-        y2 = height;
+        y2 = ymax - ymin;
     else
-        y2 = (PLINT) ( height - y2 / scaley );
+        y2 = (PLINT) ( ymax - ymin - y2 );
 
     const wxPen   oldPen   = m_dc->GetPen();
     const wxBrush oldBrush = m_dc->GetBrush();
@@ -164,27 +173,29 @@
 //--------------------------------------------------------------------------
 void wxPLDevDC::FillPolygon( PLStream *pls )
 {
-    wxPoint *points = new wxPoint[pls->dev_npts];
-    wxCoord xoffset = 0;
-    wxCoord yoffset = 0;
+	if(m_dc->GetBrush().GetColour().Alpha()==0)
+		return;
+		wxPoint *points = new wxPoint[pls->dev_npts];
+		wxCoord xoffset = 0;
+		wxCoord yoffset = 0;
 
-    for ( int i = 0; i < pls->dev_npts; i++ )
-    {
-        points[i].x = (int) ( pls->dev_x[i] / scalex );
-        points[i].y = (int) ( height - pls->dev_y[i] / scaley );
-        if ( i > 0 )
-            AddtoClipRegion( points[i - 1].x, points[i - 1].y, points[i].x, points[i].y );
-    }
+	for ( int i = 0; i < pls->dev_npts; i++ )
+	{
+		points[i].x = (int) ( pls->dev_x[i] );
+		points[i].y = (int) ( ymax - ymin - pls->dev_y[i] );
+		if ( i > 0 )
+			AddtoClipRegion( points[i - 1].x, points[i - 1].y, points[i].x, points[i].y );
+	}
 
-    if ( pls->dev_eofill )
-    {
-        m_dc->DrawPolygon( pls->dev_npts, points, xoffset, yoffset, wxODDEVEN_RULE );
-    }
-    else
-    {
-        m_dc->DrawPolygon( pls->dev_npts, points, xoffset, yoffset, wxWINDING_RULE );
-    }
-    delete[] points;
+	if ( pls->dev_eofill )
+	{
+		m_dc->DrawPolygon( pls->dev_npts, points, xoffset, yoffset, wxODDEVEN_RULE );
+	}
+	else
+	{
+		m_dc->DrawPolygon( pls->dev_npts, points, xoffset, yoffset, wxWINDING_RULE );
+	}
+	delete[] points;
 }
 
 
@@ -196,7 +207,9 @@
 //--------------------------------------------------------------------------
 void wxPLDevDC::BlitRectangle( wxDC* dc, int vX, int vY, int vW, int vH )
 {
-    if ( m_dc )
+	if ( m_wrappedDc )
+        dc->Blit( vX, vY, vW, vH, m_wrappedDc, vX, vY );
+    else if ( m_dc )
         dc->Blit( vX, vY, vW, vH, m_dc, vX, vY );
 }
 
@@ -210,14 +223,27 @@
 {
     if ( ownGUI )
     {
-        if ( !m_dc )
-            m_dc = new wxMemoryDC();
+		//set up the wxMemoryDC - this will either be the
+		//main dc or the wrapped dc
+		wxMemoryDC **memoryDc = (wxMemoryDC **) &m_dc;
+		if( m_usinggcdc )
+			memoryDc = &m_wrappedDc;
 
-        ( (wxMemoryDC *) m_dc )->SelectObject( wxNullBitmap ); // deselect bitmap
+        if ( ! *memoryDc )
+			*memoryDc = new wxMemoryDC();
+
+        ( *memoryDc )->SelectObject( wxNullBitmap ); // deselect bitmap
         if ( m_bitmap )
             delete m_bitmap;
         m_bitmap = new wxBitmap( bm_width, bm_height, 32 );
-        ( (wxMemoryDC *) m_dc )->SelectObject( *m_bitmap ); // select new bitmap
+        ( *memoryDc )->SelectObject( *m_bitmap ); // select new bitmap
+
+		//set up the wxGCDC if needed
+		if( m_usinggcdc && !m_dc )
+			m_dc = new wxGCDC(**memoryDc);
+
+		//set the user scale for whichever DC 
+		m_dc->SetUserScale( m_logicalScale, m_logicalScale );
     }
 }
 
@@ -229,7 +255,7 @@
 //--------------------------------------------------------------------------
 void wxPLDevDC::SetWidth( PLStream *pls )
 {
-    m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b ),
+	m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, unsigned char( pls->curcolor.a * 255.0 ) ),
                          pls->width > 0 ? pls->width : 1, wxSOLID ) ) );
 }
 
@@ -241,9 +267,9 @@
 //--------------------------------------------------------------------------
 void wxPLDevDC::SetColor0( PLStream *pls )
 {
-    m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ),
+    m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, unsigned char( pls->curcolor.a * 255.0 ) ),
                          pls->width > 0 ? pls->width : 1, wxSOLID ) ) );
-    m_dc->SetBrush( wxBrush( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ) ) );
+    m_dc->SetBrush( wxBrush( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, unsigned char( pls->curcolor.a *255.0 ) ) ) );
 }
 
 
@@ -254,9 +280,9 @@
 //--------------------------------------------------------------------------
 void wxPLDevDC::SetColor1( PLStream *pls )
 {
-    m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ),
+    m_dc->SetPen( *( wxThePenList->FindOrCreatePen( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, unsigned char( pls->curcolor.a * 255.0 ) ),
                          pls->width > 0 ? pls->width : 1, wxSOLID ) ) );
-    m_dc->SetBrush( wxBrush( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, pls->curcolor.a ) ) );
+    m_dc->SetBrush( wxBrush( wxColour( pls->curcolor.r, pls->curcolor.g, pls->curcolor.b, unsigned char( pls->curcolor.a * 255.0 ) ) ) );
 }
 
 
@@ -268,9 +294,15 @@
 //--------------------------------------------------------------------------
 void wxPLDevDC::SetExternalBuffer( void* dc )
 {
-    m_dc   = (wxDC *) dc; // Add the dc to the device
+	// Add the dc to the device
+	if( backend == wxBACKEND_GC )
+		m_dc = new wxGCDC( ( wxMemoryDC * ) dc );
+	else
+		m_dc   = (wxDC *) dc; 
+
     ready  = true;
     ownGUI = false;
+	m_dc->SetUserScale( m_logicalScale, m_logicalScale );
 }
 
 
@@ -344,8 +376,8 @@
 
     if ( drawText )
     {
-        m_dc->DrawRotatedText( str, (wxCoord) ( posX - yOffset / scaley * sin_rot ),
-            (wxCoord) ( height - (wxCoord) ( posY + yOffset * cos_rot / scaley ) ),
+        m_dc->DrawRotatedText( str, (wxCoord) ( posX - yOffset * sin_rot ),
+            (wxCoord) ( ymax - ymin - (wxCoord) ( posY + yOffset * cos_rot ) ),
             rotation * 180.0 / M_PI );
         posX += (PLINT) ( w * cos_rot );
         posY += (PLINT) ( w * sin_rot );
@@ -362,16 +394,16 @@
         double currentHeight = h;
         while ( currentOffset > 0.0001 )
         {
-            currentOffset -= scaley * fontSize * fontScale / 2.;
+            currentOffset -= fontSize * fontScale / 2.;
             currentHeight *= 1.25;
         }
         textHeight = (wxCoord) textHeight > ( currentHeight )
                      ? textHeight
                      : currentHeight;
         //work out the height including superscript
-        superscriptHeight = superscriptHeight > ( currentHeight + yOffset / scaley )
+        superscriptHeight = superscriptHeight > ( currentHeight + yOffset )
                             ? superscriptHeight
-                            : static_cast<int>( ( currentHeight + yOffset / scaley ) );
+                            : static_cast<int>( ( currentHeight + yOffset ) );
     }
     else if ( yOffset < -0.0001 )
     {
@@ -381,7 +413,7 @@
         double currentDepth  = d;
         while ( currentOffset < -0.0001 )
         {
-            currentOffset += scaley * fontSize * fontScale * 1.25 / 2.;
+            currentOffset += fontSize * fontScale * 1.25 / 2.;
             currentHeight *= 1.25;
             currentDepth  *= 1.25;
         }
@@ -390,9 +422,9 @@
         //that the font size of (non-superscript and non-subscript) text is the same
         //along a line. Currently there is no escape to change font size mid string
         //so this should be fine
-        subscriptDepth = (wxCoord) subscriptDepth > ( ( -yOffset / scaley + h + d ) - ( currentDepth + textHeight ) )
+        subscriptDepth = (wxCoord) subscriptDepth > ( ( -yOffset + h + d ) - ( currentDepth + textHeight ) )
                          ? subscriptDepth
-                         : ( ( -yOffset / scaley + h + d ) - ( currentDepth + textHeight ) );
+                         : ( ( -yOffset + h + d ) - ( currentDepth + textHeight ) );
         subscriptDepth = subscriptDepth > 0 ? subscriptDepth : 0;
     }
     else
@@ -407,7 +439,7 @@
 //
 //  Set font defined by fci.
 //--------------------------------------------------------------------------
-void wxPLDevDC::PSSetFont( PLUNICODE fci )
+void wxPLDevDC::PSSetFont( PLUNICODE fci, const wxString &FontFace )
 {
     unsigned char fontFamily, fontStyle, fontWeight;
 
@@ -420,7 +452,8 @@
 
     m_font = wxFont::New( (int) ( fontSize * fontScale < 4 ? 4 : fontSize * fontScale ),
         fontFamilyLookup[fontFamily],
-        fontStyleLookup[fontStyle] | fontWeightLookup[fontWeight] );
+        fontStyleLookup[fontStyle] | fontWeightLookup[fontWeight],
+		FontFace);
     m_font->SetUnderlined( underlined );
     m_dc->SetFont( *m_font );
 }
@@ -450,7 +483,7 @@
     }
 
     // Calculate the font size (in pixels)
-    fontSize = pls->chrht * VIRTUAL_PIXELS_PER_MM / scaley * 1.3;
+    fontSize = pls->chrht * virtualPixelsPerMm * 1.3;
 
     // Use PLplot core routine to get the corners of the clipping rectangle
     PLINT rcx[4], rcy[4];
@@ -459,11 +492,14 @@
     wxPoint cpoints[4];
     for ( int i = 0; i < 4; i++ )
     {
-        cpoints[i].x = rcx[i] / scalex;
-        cpoints[i].y = height - rcy[i] / scaley;
+		//unfortunately for a wxGCDC we neen to set clipper points without scaling
+		//and for other wxDCs we need them scaled to canvas units.
+		cpoints[i].x = rcx[i] * ( m_usinggcdc ? 1.0 : clipscalex );
+		cpoints[i].y = ( ymax - ymin - rcy[i] ) * ( m_usinggcdc ? 1.0 : clipscaley );
     }
     wxDCClipper clip( *m_dc, wxRegion( 4, cpoints ) );
 
+
     // calculate rotation of text
     plRotationShear( args->xform, &rotation, &shear, &stride );
     rotation -= pls->diorot * M_PI / 2.0;
@@ -505,8 +541,8 @@
         PLUNICODE startingFci       = fci;
 
         // determine extent of text
-        posX = args->x / scalex;
-        posY = args->y / scaley;
+        posX = args->x;
+        posY = args->y;
 
         PSDrawText( lineStart, lineLen, false );
 
@@ -518,8 +554,8 @@
         yOffset   = startingYOffset;
         fci       = startingFci;
         PSSetFont( fci );
-        posX = (PLINT) ( args->x / scalex - ( args->just * textWidth ) * cos_rot - ( 0.5 * textHeight - paraHeight * lineSpacing ) * sin_rot ); //move to set alignment
-        posY = (PLINT) ( args->y / scaley - ( args->just * textWidth ) * sin_rot + ( 0.5 * textHeight - paraHeight * lineSpacing ) * cos_rot );
+        posX = (PLINT) ( args->x - ( args->just * textWidth ) * cos_rot - ( 0.5 * textHeight - paraHeight * lineSpacing ) * sin_rot ); //move to set alignment
+        posY = (PLINT) ( args->y - ( args->just * textWidth ) * sin_rot + ( 0.5 * textHeight - paraHeight * lineSpacing ) * cos_rot );
         PSDrawText( lineStart, lineLen, true );                                                                                                 //draw text
 
         lineStart += lineLen;
@@ -535,7 +571,23 @@
     //posY = (PLINT) ( args->y - ( ( args->just * textWidth ) * sin_rot - ( 0.5 * textHeight ) * cos_rot ) * scaley );
     //PSDrawText( args->unicode_array, args->unicode_array_len, true );
 
-    AddtoClipRegion( 0, 0, width, height );
+	AddtoClipRegion( 0, 0, xmax - xmin, ymax - ymin );
 }
 
+void wxPLDevDC::SetScaleFactor(PLFLT scale)
+{
+	scalex = 1.0;
+	scaley = 1.0;
+	m_logicalScale = scale;
+	if( m_dc )
+		m_dc->SetUserScale( scale, scale );
+	
+	virtualPixelsPerInch = DEVICE_PIXELS_PER_IN / scale;
+	virtualPixelsPerMm = virtualPixelsPerInch / MM_PER_IN;
 
+	clipscalex=m_logicalScale;
+	clipscaley=m_logicalScale;
+	
+}
+
+
Index: drivers/wxwidgets_gc.cpp
===================================================================
--- drivers/wxwidgets_gc.cpp	(revision 12533)
+++ drivers/wxwidgets_gc.cpp	(working copy)
@@ -434,7 +434,7 @@
 }
 
 
-void wxPLDevGC::PSSetFont( PLUNICODE fci )
+void wxPLDevGC::PSSetFont( PLUNICODE fci, const wxString &FontFace  )
 {
     // Log_Verbose( "%s", __FUNCTION__ );
 
@@ -447,7 +447,8 @@
         delete m_font;
     m_font = wxFont::New( static_cast<int>( fontSize * fontScale ),
         fontFamilyLookup[fontFamily],
-        fontStyleLookup[fontStyle] | fontWeightLookup[fontWeight] );
+        fontStyleLookup[fontStyle] | fontWeightLookup[fontWeight],
+		FontFace);
     m_font->SetUnderlined( underlined );
     m_context->SetFont( *m_font, wxColour( textRed, textGreen, textBlue ) );
 }
@@ -472,7 +473,7 @@
     }
 
     // Calculate the font size (in pixels)
-    fontSize = pls->chrht * VIRTUAL_PIXELS_PER_MM / scaley * 1.3;
+    fontSize = pls->chrht * virtualPixelsPerMm / scaley * 1.3;
 
     // Use PLplot core routine to get the corners of the clipping rectangle
     PLINT rcx[4], rcy[4];
@@ -579,4 +580,13 @@
     m_context->ResetClip();
 }
 
+void wxPLDevGC::SetScaleFactor(PLFLT scale)
+{
+	scalex=scale;
+	scaley=scale;
+	
+	virtualPixelsPerInch = DEVICE_PIXELS_PER_IN / scale;
+	virtualPixelsPerMm = virtualPixelsPerInch * MM_PER_IN;
+}
+
 #endif
