From: Emden R. Gansner Date: Wed, 31 Jul 2013 18:33:06 +0000 (-0400) Subject: Fix bounding box problem for scaled svg output with dpi set. X-Git-Tag: LAST_LIBGRAPH~32^2~123 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cfc75fc9b21da2704a87d3f891411ef790f291ce;p=graphviz Fix bounding box problem for scaled svg output with dpi set. --- diff --git a/plugin/core/gvrender_core_svg.c b/plugin/core/gvrender_core_svg.c index 69791ceaf..1dfa73770 100644 --- a/plugin/core/gvrender_core_svg.c +++ b/plugin/core/gvrender_core_svg.c @@ -175,8 +175,10 @@ static void svg_begin_graph(GVJ_t * job) gvprintf(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 */