]> granicus.if.org Git - graphviz/commitdiff
Fix bounding box problem for scaled svg output with dpi set.
authorEmden R. Gansner <erg@research.att.com>
Wed, 31 Jul 2013 18:33:06 +0000 (14:33 -0400)
committerEmden R. Gansner <erg@research.att.com>
Wed, 31 Jul 2013 18:33:06 +0000 (14:33 -0400)
plugin/core/gvrender_core_svg.c

index 69791ceaf1af4b8d6ca9c5d748bcf304b8e60d1a..1dfa737702a80289db90654b53947330affd940f 100644 (file)
@@ -175,8 +175,10 @@ static void svg_begin_graph(GVJ_t * job)
     gvprintf(job, "<svg width=\"%dpt\" height=\"%dpt\"\n",
             job->width, job->height);
     gvprintf(job, " viewBox=\"%.2f %.2f %.2f %.2f\"",
-            job->canvasBox.LL.x, job->canvasBox.LL.y,
-            job->canvasBox.UR.x, job->canvasBox.UR.y);
+       job->canvasBox.LL.x * (job->dpi.x/POINTS_PER_INCH),
+       job->canvasBox.LL.y * (job->dpi.y/POINTS_PER_INCH),
+       job->canvasBox.UR.x * (job->dpi.x/POINTS_PER_INCH),
+       job->canvasBox.UR.y * (job->dpi.y/POINTS_PER_INCH));
     /* namespace of svg */
     gvputs(job, " xmlns=\"http://www.w3.org/2000/svg\"");
     /* namespace of xlink */