=== modified file 'rsvg-base.c'
--- rsvg-base.c	2008-10-16 08:25:19 +0000
+++ rsvg-base.c	2008-10-16 09:38:07 +0000
@@ -42,6 +42,7 @@
 #include "rsvg-filter.h"
 #include "rsvg-mask.h"
 #include "rsvg-marker.h"
+#include "rsvg-cairo-render.h"
 
 #include <math.h>
 #include <string.h>
@@ -1645,6 +1646,10 @@
 gboolean
 rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimension_data, const char *id)
 {
+    cairo_t *cr;
+    cairo_surface_t *target;
+    RsvgDrawingCtx *draw;
+    RsvgCairoRender *render;
     RsvgNodeSvg *root = NULL;
     RsvgNode *sself = NULL;
     RsvgBbox bbox;
@@ -1668,15 +1673,47 @@
     bbox.x = bbox.y = 0;
     bbox.w = bbox.h = 1;
 
-    bbox = _rsvg_find_bbox_sub (handle, sself);
-
+    target = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
+					 1, 1);
+    cr = cairo_create  (target);
+
+    draw = rsvg_cairo_new_drawing_ctx (cr, handle);
+    
+    if (!draw)
+	return FALSE;
+
+    while (sself != NULL) {
+        draw->drawsub_stack = g_slist_prepend (draw->drawsub_stack, sself);
+        sself = sself->parent;
+    }
+
+    rsvg_state_push (draw);
+    cairo_save (cr);
+
+    rsvg_node_draw ((RsvgNode *) handle->priv->treebase, draw, 0);
+    render = (RsvgCairoRender *) draw->render;
+
+    bbox.x = render->bbox.x;
+    bbox.y = render->bbox.y;
+    bbox.w = render->bbox.w;
+    bbox.h = render->bbox.h;
+
+    cairo_restore (cr);
+    rsvg_state_pop (draw);
+    rsvg_drawing_ctx_free (draw);
+    cairo_destroy (cr);
+    cairo_surface_destroy (target);
+    
     dimension_data->width = (int) (_rsvg_css_hand_normalize_length_sub (&root->w, bbox.w, handle->priv->dpi_x,
                                                                     bbox.w + bbox.x * 2, 12) + 0.5);
     dimension_data->height = (int) (_rsvg_css_hand_normalize_length_sub (&root->h, bbox.h, handle->priv->dpi_y,
                                                                      bbox.h + bbox.y * 2,
                                                                      12) + 0.5);
-
-    // printf("Dimension width: %d height: %d\n\n", dimension_data->width, dimension_data->height);
+    /*
+    printf("Bbox x: %f y: %f w: %f h: %f\n",
+	    bbox.x, bbox.y, bbox.w, bbox.h);
+    printf("Dimension width: %d height: %d\n\n", dimension_data->width, dimension_data->height);
+    */
 
     dimension_data->em = dimension_data->width;
     dimension_data->ex = dimension_data->height;

=== modified file 'rsvg-cairo-render.c'
--- rsvg-cairo-render.c	2008-08-26 17:07:12 +0000
+++ rsvg-cairo-render.c	2008-10-16 08:52:57 +0000
@@ -107,7 +107,7 @@
     *y1 = ceil (t > y11 ? t : y11);
 }
 
-static RsvgDrawingCtx *
+RsvgDrawingCtx *
 rsvg_cairo_new_drawing_ctx (cairo_t * cr, RsvgHandle * handle)
 {
     RsvgDimensionData data;

=== modified file 'rsvg-cairo-render.h'
--- rsvg-cairo-render.h	2008-01-19 16:47:05 +0000
+++ rsvg-cairo-render.h	2008-10-16 08:53:11 +0000
@@ -51,6 +51,7 @@
 
 RsvgCairoRender *rsvg_cairo_render_new		(cairo_t * cr, double width, double height);
 void		 rsvg_cairo_render_rsvg_handle	(cairo_t * cr, RsvgHandle * handle);
+RsvgDrawingCtx *rsvg_cairo_new_drawing_ctx (cairo_t * cr, RsvgHandle * handle);
 
 G_END_DECLS
 

