[gs-cvs] rev 8738 - trunk/gs/src

giles at ghostscript.com giles at ghostscript.com
Thu May 15 14:24:14 PDT 2008


Author: giles
Date: 2008-05-15 14:24:13 -0700 (Thu, 15 May 2008)
New Revision: 8738

Modified:
   trunk/gs/src/gdevsvg.c
Log:
Set the document size and scale based on the page size and resolution
from the device parameters.


Modified: trunk/gs/src/gdevsvg.c
===================================================================
--- trunk/gs/src/gdevsvg.c	2008-05-15 21:24:12 UTC (rev 8737)
+++ trunk/gs/src/gdevsvg.c	2008-05-15 21:24:13 UTC (rev 8738)
@@ -346,14 +346,19 @@
     sprintf(line, "%s\n", SVG_DOCTYPE);
     /* svg_write(svg, line); */
     sputs(s, line, strlen(line), &used);
-    sprintf(line, "<svg xmlns='%s' version='%s'>\n",
+    sprintf(line, "<svg xmlns='%s' version='%s'",
 	SVG_XMLNS, SVG_VERSION);
     /* svg_write(svg, line); */
     sputs(s, line, strlen(line), &used);
-
-    /* svg_write(svg, "<g transform='scale(0.3,0.3)'>\n"); */
+    sprintf(line, " width='%dpt' height='%dpt'>\n",
+	(int)svg->MediaSize[0], (int)svg->MediaSize[1]);
+    sputs(s, line, strlen(line), &used);
+    
+    /* Scale drawing so our coordinates are in pixels */
+    sprintf(line, "<g transform='scale(%lf,%lf)'>\n",
+    	72.0 / svg->HWResolution[0],
+    	72.0 / svg->HWResolution[1]);
     /* svg_write(svg, line); */
-    sprintf(line, "<g transform='scale(0.3,0.3)'>\n");
     sputs(s, line, strlen(line), &used);
 
     /* mark that we've been called */



More information about the gs-cvs mailing list