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 */
24 static void DoTitleAndBox()
37 static void Landscape PROTO((void)); /* forward */
38 static void Portrait PROTO((void)); /* forward */
41 fprintf(psfp, "showpage\n");
42 if (gflag) Portrait(); else Landscape();
57 Key(); // print multi-page key even if there are more than 20 bands
63 if (!multipageflag && (TWENTY != 0)) Key();
69 fprintf(psfp, "showpage\n");
73 static void StandardSpecialComments PROTO((void)); /* forward */
74 static void EPSFSpecialComments PROTO((floatish)); /* forward */
75 static void Scaling PROTO((floatish)); /* forward */
81 floatish epsfscale = epsfwidth / (floatish) borderwidth;
82 EPSFSpecialComments(epsfscale);
85 StandardSpecialComments();
86 if (gflag) Portrait(); else Landscape();
90 extern char *jobstring;
91 extern char *datestring;
94 StandardSpecialComments()
96 fprintf(psfp, "%%!PS-Adobe-2.0\n");
97 fprintf(psfp, "%%%%Title: %s\n", jobstring);
98 fprintf(psfp, "%%%%Creator: %s (version %s)\n", programname, VERSION);
99 fprintf(psfp, "%%%%CreationDate: %s\n", datestring);
100 fprintf(psfp, "%%%%EndComments\n");
104 EPSFSpecialComments(epsfscale)
107 fprintf(psfp, "%%!PS-Adobe-2.0\n");
108 fprintf(psfp, "%%%%Title: %s\n", jobstring);
109 fprintf(psfp, "%%%%Creator: %s (version %s)\n", programname, VERSION);
110 fprintf(psfp, "%%%%CreationDate: %s\n", datestring);
111 fprintf(psfp, "%%%%BoundingBox: 0 0 %d %d\n",
112 (int) (borderwidth * epsfscale + 0.5),
113 (int) (borderheight * epsfscale + 0.5) );
114 fprintf(psfp, "%%%%EndComments\n");
122 fprintf(psfp, "-90 rotate\n");
123 fprintf(psfp, "%f %f translate\n", -(borderwidth + (floatish) START_Y),
130 fprintf(psfp, "%f %f translate\n", (floatish) START_X, (floatish) START_Y);
137 fprintf(psfp, "%f %f scale\n", epsfscale, epsfscale);
144 fprintf(psfp, "/HE%d /Helvetica findfont %d scalefont def\n",
145 NORMAL_FONT, NORMAL_FONT);
147 fprintf(psfp, "/HE%d /Helvetica findfont %d scalefont def\n",
148 LARGE_FONT, LARGE_FONT);
155 fprintf(psfp, "newpath\n");
156 fprintf(psfp, "0 0 moveto\n");
157 fprintf(psfp, "0 %f rlineto\n", borderheight);
158 fprintf(psfp, "%f 0 rlineto\n", borderwidth);
159 fprintf(psfp, "0 %f rlineto\n", -borderheight);
160 fprintf(psfp, "closepath\n");
161 fprintf(psfp, "%f setlinewidth\n", borderthick);
162 fprintf(psfp, "stroke\n");
168 fprintf(psfp, "newpath\n");
169 fprintf(psfp, "%f %f moveto\n", borderspace,
170 borderheight - titleheight - borderspace);
171 fprintf(psfp, "0 %f rlineto\n", titleheight);
172 fprintf(psfp, "%f 0 rlineto\n", titlewidth);
173 fprintf(psfp, "0 %f rlineto\n", -titleheight);
174 fprintf(psfp, "closepath\n");
175 fprintf(psfp, "%f setlinewidth\n", borderthick);
176 fprintf(psfp, "stroke\n");
178 fprintf(psfp, "%f %f moveto\n", borderspace,
179 borderheight - titleheight / 2 - borderspace);
180 fprintf(psfp, "%f 0 rlineto\n", titlewidth);
181 fprintf(psfp, "stroke\n");
188 fprintf(psfp, "newpath\n");
189 fprintf(psfp, "%f %f moveto\n", borderspace,
190 borderheight - titleheight - borderspace);
191 fprintf(psfp, "0 %f rlineto\n", titleheight);
192 fprintf(psfp, "%f 0 rlineto\n", titlewidth);
193 fprintf(psfp, "0 %f rlineto\n", -titleheight);
194 fprintf(psfp, "closepath\n");
195 fprintf(psfp, "%f setlinewidth\n", borderthick);
196 fprintf(psfp, "stroke\n");
199 static void EscapePrint PROTO((char *, int)); /* forward */
206 x = borderspace + titletextspace;
207 y = borderheight - titleheight / 2 - borderspace + titletextspace;
209 /* job identifier goes on top at the far left */
211 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
212 fprintf(psfp, "%f %f moveto\n", x, y);
214 EscapePrint(jobstring, BIG_JOB_STRING_WIDTH);
215 fprintf(psfp, ") show\n");
217 y = borderheight - titleheight - borderspace + titletextspace;
219 /* area below curve gows at the botton, far left */
221 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
222 fprintf(psfp, "%f %f moveto\n", x, y);
224 CommaPrint(psfp, (intish)areabelow);
225 fprintf(psfp, " %s x %s)\n", valueunitstring, sampleunitstring);
226 fprintf(psfp, "show\n");
228 /* date goes at far right */
230 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
231 fprintf(psfp, "(%s)\n", datestring);
232 fprintf(psfp, "dup stringwidth pop\n");
233 fprintf(psfp, "%f\n", (titlewidth + borderspace) - titletextspace);
234 fprintf(psfp, "exch sub\n");
235 fprintf(psfp, "%f moveto\n", y);
236 fprintf(psfp, "show\n");
245 x = borderspace + titletextspace;
246 y = borderheight - titleheight - borderspace + titletextspace;
248 /* job identifier goes at far left */
250 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
251 fprintf(psfp, "%f %f moveto\n", x, y);
253 EscapePrint(jobstring, SMALL_JOB_STRING_WIDTH);
254 fprintf(psfp, ") show\n");
256 /* area below curve is centered */
258 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
260 CommaPrint(psfp, (intish) areabelow);
261 fprintf(psfp, " %s x %s)\n", valueunitstring, sampleunitstring);
263 fprintf(psfp, "dup stringwidth pop\n");
264 fprintf(psfp, "2 div\n");
265 fprintf(psfp, "%f\n", titlewidth / 2);
266 fprintf(psfp, "exch sub\n");
267 fprintf(psfp, "%f moveto\n", y);
268 fprintf(psfp, "show\n");
270 /* date goes at far right */
272 fprintf(psfp, "HE%d setfont\n", TITLE_TEXT_FONT);
273 fprintf(psfp, "(%s)\n", datestring);
274 fprintf(psfp, "dup stringwidth pop\n");
275 fprintf(psfp, "%f\n", (titlewidth + borderspace) - titletextspace);
276 fprintf(psfp, "exch sub\n");
277 fprintf(psfp, "%f moveto\n", y);
278 fprintf(psfp, "show\n");
282 * Print a string s in width w, escaping characters where necessary.
289 for ( ; *s && w > 0; s++, w--) {
290 if (*s == '(') { /* escape required */
292 } else if (*s == ')') {