diff -rup canvas/source/cairo-orig/cairo_canvascustomsprite.cxx canvas/source/cairo/cairo_canvascustomsprite.cxx
--- canvas/source/cairo-orig/cairo_canvascustomsprite.cxx	2006-05-25 20:38:42.000000000 +0200
+++ canvas/source/cairo/cairo_canvascustomsprite.cxx	2006-05-25 20:40:44.000000000 +0200
@@ -62,6 +62,10 @@ namespace cairocanvas
         ENSURE_AND_THROW( rRefDevice.get(),
                           "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" );
 
+		OSL_TRACE("sprite size: %d, %d",
+				  ::canvas::tools::roundUp( rSpriteSize.Width ),
+				  ::canvas::tools::roundUp( rSpriteSize.Height ));
+
 		//mpBufferSurface = mpSpriteCanvas->getSurface( aSize, CAIRO_CONTENT_COLOR );
 		mpBufferSurface = mpSpriteCanvas->getSurface( maSize );
 
diff -rup canvas/source/cairo-orig/cairo_canvasfont.cxx canvas/source/cairo/cairo_canvasfont.cxx
--- canvas/source/cairo-orig/cairo_canvasfont.cxx	2006-05-25 20:38:42.000000000 +0200
+++ canvas/source/cairo/cairo_canvasfont.cxx	2006-05-25 21:52:45.000000000 +0200
@@ -111,7 +111,8 @@ namespace cairocanvas
         return new TextLayout( aText, 
                                nDirection, 
                                nRandomSeed, 
-                               Reference( this ) );
+                               Reference( this ),
+							   mpRefDevice );
     }
 
     rendering::FontRequest SAL_CALL  CanvasFont::getFontRequest(  ) throw (uno::RuntimeException)
diff -rup canvas/source/cairo-orig/cairo_textlayout.cxx canvas/source/cairo/cairo_textlayout.cxx
--- canvas/source/cairo-orig/cairo_textlayout.cxx	2006-05-25 20:38:42.000000000 +0200
+++ canvas/source/cairo/cairo_textlayout.cxx	2006-05-25 22:00:57.000000000 +0200
@@ -36,6 +36,9 @@
 #include <canvas/debug.hxx>
 #include <canvas/verbosetrace.hxx>
 
+#include <vcl/metric.hxx>
+#include <vcl/virdev.hxx>
+
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/numeric/ftools.hxx>
 
@@ -50,14 +53,48 @@ using namespace ::com::sun::star;
 
 namespace cairocanvas
 {
+    namespace
+    {
+        void setupLayoutMode( OutputDevice& rOutDev,
+                              sal_Int8		nTextDirection )	
+        {
+            // TODO(P3): avoid if already correctly set
+            ULONG nLayoutMode;
+            switch( nTextDirection )
+            {
+                default:
+                    nLayoutMode = 0;
+                    break;
+                case rendering::TextDirection::WEAK_LEFT_TO_RIGHT:
+                    nLayoutMode = TEXT_LAYOUT_BIDI_LTR;
+                    break;
+                case rendering::TextDirection::STRONG_LEFT_TO_RIGHT:
+                    nLayoutMode = TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_BIDI_STRONG;
+                    break;
+                case rendering::TextDirection::WEAK_RIGHT_TO_LEFT:
+                    nLayoutMode = TEXT_LAYOUT_BIDI_RTL;
+                    break;
+                case rendering::TextDirection::STRONG_RIGHT_TO_LEFT:
+                    nLayoutMode = TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_BIDI_STRONG;
+                    break;
+            }
+
+            // set calculated layout mode. Origin is always the left edge,
+            // as required at the API spec
+            rOutDev.SetLayoutMode( nLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT );
+        }
+    }
+
     TextLayout::TextLayout( const rendering::StringContext& 	aText, 
                             sal_Int8                        	nDirection, 
                             sal_Int64                       	nRandomSeed,
-                            const CanvasFont::Reference&      	rFont ) :
+                            const CanvasFont::Reference&      	rFont,
+							const DeviceRef&					rRefDevice ) :
         TextLayout_Base( m_aMutex ),
         maText( aText ),
         maLogicalAdvancements(),
         mpFont( rFont ),
+        mpRefDevice( rRefDevice ),
         mnTextDirection( nDirection )
     {
     }
@@ -68,7 +105,10 @@ namespace cairocanvas
 
     void SAL_CALL TextLayout::disposing()
     {
+        ::osl::MutexGuard aGuard( m_aMutex );
+
         mpFont.reset();
+        mpRefDevice.clear();
     }
 
     // XTextLayout
@@ -120,25 +160,36 @@ namespace cairocanvas
     {
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        ENSURE_AND_THROW( mpFont.get(),
-                          "TextLayout::queryTextBounds(): invalid font" );
+        OutputDevice* pOutDev = mpRefDevice->getOutputWindow();
+    	if( !pOutDev )
+            return geometry::RealRectangle2D();
+
+        VirtualDevice aVDev( *pOutDev );
+        aVDev.SetFont( mpFont->getVCLFont() );
+
+        // need metrics for Y offset, the XCanvas always renders
+        // relative to baseline
+        const ::FontMetric& aMetric( aVDev.GetFontMetric() );
+
+        setupLayoutMode( aVDev, mnTextDirection );
+
+        const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - aMetric.GetAscent() );
+        const sal_Int32 nBelowBaseline( aMetric.GetDescent() );
 
-        // fake text bounds by either taking the advancement values,
-        // or assuming square glyph boxes (width similar to height)
-        const rendering::FontRequest& rFontRequest( mpFont->getFontRequest() );
-        const double nFontSize( ::std::max( rFontRequest.CellSize,
-                                            rFontRequest.ReferenceAdvancement ) );
         if( maLogicalAdvancements.getLength() )
         {
-            return geometry::RealRectangle2D( 0, -nFontSize/2,
+            return geometry::RealRectangle2D( 0, nAboveBaseline,
                                               maLogicalAdvancements[ maLogicalAdvancements.getLength()-1 ],
-                                              nFontSize/2 );
+                                              nBelowBaseline );
         }
         else
         {
-            return geometry::RealRectangle2D( 0, -nFontSize/2,
-                                              nFontSize * maText.Length,
-                                              nFontSize/2 );
+            return geometry::RealRectangle2D( 0, nAboveBaseline,
+                                              aVDev.GetTextWidth(
+                                                  maText.Text,
+                                                  ::canvas::tools::numeric_cast<USHORT>(maText.StartPosition),
+                                                  ::canvas::tools::numeric_cast<USHORT>(maText.Length) ),
+                                              nBelowBaseline );
         }
     }
 
@@ -256,38 +307,6 @@ namespace cairocanvas
 
     namespace
     {
-        void setupLayoutMode( OutputDevice& rOutDev,
-                              sal_Int8		nTextDirection )	
-        {
-            // TODO(P3): avoid if already correctly set
-            ULONG nLayoutMode;
-            switch( nTextDirection )
-            {
-                default:
-                    nLayoutMode = 0;
-                    break;
-                case rendering::TextDirection::WEAK_LEFT_TO_RIGHT:
-                    nLayoutMode = TEXT_LAYOUT_BIDI_LTR;
-                    break;
-                case rendering::TextDirection::STRONG_LEFT_TO_RIGHT:
-                    nLayoutMode = TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_BIDI_STRONG;
-                    break;
-                case rendering::TextDirection::WEAK_RIGHT_TO_LEFT:
-                    nLayoutMode = TEXT_LAYOUT_BIDI_RTL;
-                    break;
-                case rendering::TextDirection::STRONG_RIGHT_TO_LEFT:
-                    nLayoutMode = TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_BIDI_STRONG;
-                    break;
-            }
-
-            // set calculated layout mode. Origin is always the left edge,
-            // as required at the API spec
-            rOutDev.SetLayoutMode( nLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT );
-        }
-    }
-
-    namespace
-    {
         class OffsetTransformer
         {
         public:
diff -rup canvas/source/cairo-orig/cairo_textlayout.hxx canvas/source/cairo/cairo_textlayout.hxx
--- canvas/source/cairo-orig/cairo_textlayout.hxx	2006-05-25 20:38:42.000000000 +0200
+++ canvas/source/cairo/cairo_textlayout.hxx	2006-05-25 21:54:24.000000000 +0200
@@ -67,7 +67,8 @@ namespace cairocanvas
         TextLayout( const ::com::sun::star::rendering::StringContext& aText, 
                     sal_Int8                                                  nDirection, 
                     sal_Int64                                                 nRandomSeed,
-                    const CanvasFont::Reference&                              rFont );
+                    const CanvasFont::Reference&                              rFont,
+					const DeviceRef&								          rRefDevice );
 
         /// Dispose all internal references
         virtual void SAL_CALL disposing();
@@ -113,6 +114,7 @@ namespace cairocanvas
         ::com::sun::star::rendering::StringContext maText;
         ::com::sun::star::uno::Sequence< double >  maLogicalAdvancements;
         CanvasFont::Reference                      mpFont;
+        DeviceRef               				   mpRefDevice;
         sal_Int8                                   mnTextDirection;
 
 	void useFont( ::cairo::Cairo* pCairo );
