5 #include "Dimensions.h"
11 #include "Utilities.h"
16 static void Prologue PROTO((void)); /* forward */
17 static void Variables PROTO((void)); /* forward */
18 static void BorderOutlineBox PROTO((void)); /* forward */
19 static void BigTitleOutlineBox PROTO((void)); /* forward */
20 static void TitleOutlineBox PROTO((void)); /* forward */
21 static void BigTitleText PROTO((void)); /* forward */
22 static void TitleText PROTO((void)); /* forward */
49 fprintf(psfp, "showpage\n");
53 static void StandardSpecialComments PROTO((void)); /* forward */
54 static void EPSFSpecialComments PROTO((floatish)); /* forward */
55 static void Landscape PROTO((void)); /* forward */
56 static void Portrait PROTO((void)); /* forward */
57 static void Scaling PROTO((floatish)); /* forward */
64 if (eflag) epsfscale = epsfwidth / (floatish) borderwidth;
67 EPSFSpecialComments(epsfscale);
69 StandardSpecialComments();
81 extern char *jobstring;
82 extern char *datestring;
85 StandardSpecialComments()
87 fprintf(psfp, "%%!PS-Adobe-2.0\n");
88 fprintf(psfp, "%%%%Title: %s\n", jobstring);
89 fprintf(psfp, "%%%%Creator: %s (version %s)\n", programname, VERSION);
90 fprintf(psfp, "%%%%CreationDate: %s\n", datestring);
91 fprintf(psfp, "%%%%EndComments\n");
95 EPSFSpecialComments(epsfscale)
98 fprintf(psfp, "%%!PS-Adobe-2.0\n");
99 fprintf(psfp, "%%%%Title: %s\n", jobstring);
100 fprintf(psfp, "%%%%Creator: %s (version %s)\n", programname, VERSION);
101 fprintf(psfp, "%%%%CreationDate: %s\n", datestring);
102 fprintf(psfp, "%%%%BoundingBox: 0 0 %d %d\n",
103 (int) (borderwidth * epsfscale + 0.5),
104 (int) (borderheight * epsfscale + 0.5) );
105 fprintf(psfp, "%%%%EndComments\n");
113 fprintf(psfp, "-90 rotate\n");
114 fprintf(psfp, "%f %f translate\n", -(borderwidth + (floatish) START_Y),
121 fprintf(psfp, "%f %f translate\n", (floatish) START_X, (floatish) START_Y);
128 fprintf(psfp, "%f %f scale\n", epsfscale, epsfscale);
135 fprintf(psfp, "/HE%d /Helvetica findfont %d scalefont def\n",
136 NORMAL_FONT, NORMAL_FONT);
138 fprintf(psfp, "/HE%d /Helvetica findfont %d scalefont def\n",
139 LARGE_FONT, LARGE_FONT);
146 fprintf(psfp, "newpath\n");
147 fprintf(psfp, "0 0 moveto\n");
148 fprintf(psfp, "0 %f rlineto\n", borderheight);
149 fprintf(psfp, "%f 0 rlineto\n", borderwidth);
150 fprintf(psfp, "0 %f rlineto\n", -borderheight);
151 fprintf(psfp, "closepath\n");
152 fprintf(psfp, "%f setlinewidth\n", borderthick);
153 fprintf(psfp, "stroke\n");
159 fprintf(psfp, "newpath\n");
160 fprintf(psfp, "%f %f moveto\n", borderspace,
161 borderheight - titleheight - borderspace);
162 fprintf(psfp, "0 %f rlineto\n", titleheight);
163 fprintf(psfp, "%f 0 rlineto\n", titlewidth);
164 fprintf(psfp, "0 %f rlineto\n", -titleheight);
165 fprintf(psfp, "closepath\n");
166 fprintf(psfp, "%f setlinewidth\n", borderthick);
167 fprintf(psfp, "stroke\n");
169 fprintf(psfp, "%f %f moveto\n", borderspace,
170 borderheight - titleheight / 2 - borderspace);
171 fprintf(psfp, "%f 0 rlineto\n", titlewidth);
172 fprintf(psfp, "stroke\n");
179 fprintf(psfp, "newpath\n");
180 fprintf(psfp, "%f %f moveto\n", borderspace,
181 borderheight - titleheight - borderspace);
182 fprintf(psfp, "0 %f rlineto\n", titleheight);
183 fprintf(psfp, "%f 0 rlineto\n", titlewidth);
184 fprintf(psfp, "0 %f rlineto\n", -titleheight);
185 fprintf(psfp, "closepath\n");
186 fprintf(psfp, "%f setlinewidth\n", borderthick);
187 fprintf(psfp, "stroke\n");
190 static void EscapePrint PROTO((char *, int)); /* forward */
197 x = borderspace + titletextspace;
198 y = borderheight - titleheight / 2 - borderspace + titletextspace;
200 /* job identifier goes on top at the far left */
202 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
203 fprintf(psfp, "%f %f moveto\n", x, y);
205 EscapePrint(jobstring, BIG_JOB_STRING_WIDTH);
206 fprintf(psfp, ") show\n");
208 y = borderheight - titleheight - borderspace + titletextspace;
210 /* area below curve gows at the botton, far left */
212 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
213 fprintf(psfp, "%f %f moveto\n", x, y);
215 CommaPrint(psfp, (int) areabelow);
216 fprintf(psfp, " %s x %s)\n", valueunitstring, sampleunitstring);
217 fprintf(psfp, "show\n");
219 /* date goes at far right */
221 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
222 fprintf(psfp, "(%s)\n", datestring);
223 fprintf(psfp, "dup stringwidth pop\n");
224 fprintf(psfp, "%f\n", (titlewidth + borderspace) - titletextspace);
225 fprintf(psfp, "exch sub\n");
226 fprintf(psfp, "%f moveto\n", y);
227 fprintf(psfp, "show\n");
236 x = borderspace + titletextspace;
237 y = borderheight - titleheight - borderspace + titletextspace;
239 /* job identifier goes at far left */
241 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
242 fprintf(psfp, "%f %f moveto\n", x, y);
244 EscapePrint(jobstring, SMALL_JOB_STRING_WIDTH);
245 fprintf(psfp, ") show\n");
247 /* area below curve is centered */
249 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
251 CommaPrint(psfp, (int) areabelow);
252 fprintf(psfp, " %s x %s)\n", valueunitstring, sampleunitstring);
254 fprintf(psfp, "dup stringwidth pop\n");
255 fprintf(psfp, "2 div\n");
256 fprintf(psfp, "%f\n", titlewidth / 2);
257 fprintf(psfp, "exch sub\n");
258 fprintf(psfp, "%f moveto\n", y);
259 fprintf(psfp, "show\n");
261 /* date goes at far right */
263 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
264 fprintf(psfp, "(%s)\n", datestring);
265 fprintf(psfp, "dup stringwidth pop\n");
266 fprintf(psfp, "%f\n", (titlewidth + borderspace) - titletextspace);
267 fprintf(psfp, "exch sub\n");
268 fprintf(psfp, "%f moveto\n", y);
269 fprintf(psfp, "show\n");
273 * Print a string s in width w, escaping characters where necessary.
280 for ( ; *s && w > 0; s++, w--) {
281 if (*s == '(') { /* escape required */
283 } else if (*s == ')') {