Index: drivers/wxwidgets.cpp
===================================================================
--- drivers/wxwidgets.cpp	(revision 12898)
+++ drivers/wxwidgets.cpp	(working copy)
@@ -429,6 +429,7 @@
         pls->dev_unicode = 1; // want unicode
         if ( hrshsym )
             pls->dev_hrshsym = 1;
+		pls->has_string_length = 1;     // We will supply a string length
     }
 
 #ifdef PL_HAVE_FREETYPE
@@ -446,6 +447,7 @@
         pls->dev_unicode = 1; // want unicode
         if ( hrshsym )
             pls->dev_hrshsym = 1;
+		pls->has_string_length = 1;     // We will supply a string length
 
         init_freetype_lv1( pls );
         FT_Data* FT = (FT_Data *) pls->FT;
Index: drivers/wxwidgets_agg.cpp
===================================================================
--- drivers/wxwidgets_agg.cpp	(revision 12898)
+++ drivers/wxwidgets_agg.cpp	(working copy)
@@ -592,6 +592,18 @@
     PSDrawText( args->unicode_array, args->unicode_array_len, false );
     printf( "textWidth=%f, textHeight=%f\n", textWidth, textHeight );
 
+	//if this was just a call to get the text width then assign the width and return
+	if( pls->get_string_length )
+	{
+		//width must be in mm
+		PLFLT mmWidth;
+		PLFLT mxmin, mxmax, mymin, mymax;
+		plgspa( &mxmin, &mxmax, &mymin, &mymax );
+		mmWidth = ( mxmax - mxmin );
+		pls->string_length = (PLFLT)textWidth/(PLFLT)width*mmWidth;
+		return;
+	}
+
     agg::trans_affine mtx;
     mtx.reset();
     mtx *= agg::trans_affine_translation( args->x, args->y );
Index: drivers/wxwidgets_dc.cpp
===================================================================
--- drivers/wxwidgets_dc.cpp	(revision 12898)
+++ drivers/wxwidgets_dc.cpp	(working copy)
@@ -510,6 +510,18 @@
 
         PSDrawText( lineStart, lineLen, false );
 
+		//if this was just a call to get the text width then assign the width and return
+		if( pls->get_string_length )
+		{
+			//width must be in mm
+			PLFLT mmWidth;
+			PLFLT mxmin, mxmax, mymin, mymax;
+			plgspa( &mxmin, &mxmax, &mymin, &mymax );
+			mmWidth = ( mxmax - mxmin );
+			pls->string_length = (PLFLT)textWidth/(PLFLT)width*mmWidth;
+			return;
+		}
+
         if ( lineFeed && superscriptHeight > textHeight )
             paraHeight += superscriptHeight - textHeight;
 
Index: drivers/wxwidgets_gc.cpp
===================================================================
--- drivers/wxwidgets_gc.cpp	(revision 12898)
+++ drivers/wxwidgets_gc.cpp	(working copy)
@@ -547,6 +547,18 @@
         // determine extent of text
         PSDrawText( lineStart, lineLen, false );
 
+		//if this was just a call to get the text width then assign the width and return
+		if( pls->get_string_length )
+		{
+			//width must be in mm
+			PLFLT mmWidth;
+			PLFLT mxmin, mxmax, mymin, mymax;
+			plgspa( &mxmin, &mxmax, &mymin, &mymax );
+			mmWidth = ( mxmax - mxmin );
+			pls->string_length = (PLFLT)textWidth/(PLFLT)width*mmWidth;
+			return;
+		}
+
         if ( lineFeed && superscriptHeight > textHeight )
             paraHeight += superscriptHeight - textHeight;
 
