aboutsummaryrefslogtreecommitdiff
blob: e9e1a67e4444d9beaf059c11f17eb236add59dc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
diff -Nadurp ng-spice-rework-17/src/frontend/postsc.c ng-spice-rework-17-r1/src/frontend/postsc.c
--- ng-spice-rework-17/src/frontend/postsc.c	2005-05-30 22:28:30.000000000 +0200
+++ ng-spice-rework-17-r1/src/frontend/postsc.c	2006-05-04 09:44:06.000000000 +0200
@@ -88,14 +88,13 @@ PS_Init(void)
 	    scale = 1.0;
     }
 
+  dispdev->numlinestyles = NUMELEMS(linestyle);
   if (!cp_getvar("hcopypscolor", VT_STRING, pscolor)) {
     colorflag = 0;
     dispdev->numcolors = 2;
-    dispdev->numlinestyles = NUMELEMS(linestyle);
   } else {
     colorflag = 1;
     dispdev->numcolors = 18;   /* don't know what the maximum should be */
-    dispdev->numlinestyles = 1;
   }
   pscolor[0]='\0';
 
@@ -118,6 +117,10 @@ PS_Init(void)
       dispdev->height = 10000;
   }
 
+  dispdev->width *= 1000;
+  dispdev->height *= 1000;
+  scale *= 1000.0;
+
     /* The following side effects have to be considered 
      * when the printer is called by com_hardcopy !
      * gr_init:
@@ -160,6 +163,7 @@ PS_NewViewport(GRAPH *graph)
 {
     int x1,x2,y1,y2;
     hcopygraphid = graph->graphid;
+    bool nobg;
 
     if (!(plotfile = fopen(graph->devdep, "w"))) {
       perror(graph->devdep);
@@ -180,29 +184,33 @@ PS_NewViewport(GRAPH *graph)
     graph->absolute.width = dispdev->width;
     graph->absolute.height = dispdev->height;
     /* Also done in gr_init, if called . . . */
-    graph->viewportxoff = 8 * fontwidth;
-    graph->viewportyoff = 4 * fontheight;
+    graph->viewportxoff = 8 * graph->fontwidth;
+    graph->viewportyoff = 4 * graph->fontheight;
 
     xoff = scale * XOFF;
     yoff = scale * YOFF;
 
     x1 = 0.75 * 72;
     y1 = x1;
-    x2 = graph->absolute.width + .75 * 72;
-    y2 = graph->absolute.height + .75 * 72;
+    x2 = graph->absolute.width / 1000 + 0.75 * 72;
+    y2 = graph->absolute.height / 1000 + 0.75 * 72;
     /* start file off with a % */
     fprintf(plotfile, "%%!PS-Adobe-3.0 EPSF-3.0\n");
     fprintf(plotfile, "%%%%Creator: nutmeg\n");
     fprintf(plotfile, "%%%%BoundingBox: %d %d %d %d\n",x1,y1,x2,y2);
 
     fprintf(plotfile, "%g %g scale\n", 1.0 / scale, 1.0 / scale);
+    fprintf(plotfile, "1000 setlinewidth\n");
 
-    if (colorflag == 1){            /* set the background to color0 */
+    cp_getvar("hcopypsnobg", VT_BOOL, &nobg);
+    if (!nobg && colorflag == 1){            /* set the background to color0 */
 	PS_SelectColor(0);
 	fprintf(plotfile,"%s setrgbcolor\n",pscolor);
 	fprintf(plotfile,"newpath\n");
-	fprintf(plotfile,"%d %d moveto %d %d lineto\n",x1,y1,x2,y1);
-	fprintf(plotfile,"%d %d lineto %d %d lineto\n",x2,y2,x1,y2);
+	fprintf(plotfile,"%d %d moveto %d %d lineto\n",
+          x1*1000,y1*1000,x2*1000,y1*1000);
+	fprintf(plotfile,"%d %d lineto %d %d lineto\n",
+          x2*1000,y2*1000,x1*1000,y2*1000);
 	fprintf(plotfile,"closepath fill\n");
     }