syms.h - abc2ps - A powerful sheet setting tool using the simple abc notation
(HTM) git clone git://vernunftzentrum.de/abc2ps.git
(DIR) Log
(DIR) Files
(DIR) Refs
---
syms.h (34171B)
---
1 /*
2 * This file is part of abc2ps,
3 * Copyright (C) 1996,1997,1998 Michael Methfessel
4 * See file abc2ps.c for details.
5 */
6
7 /* subroutines to define postscript macros which draw symbols */
8
9 /* ----- def_misc ------- */
10 void def_misc (fp)
11 FILE *fp;
12 {
13 fprintf (fp,
14 "\n/cshow { %% usage: string cshow - center at current pt\n"
15 " dup stringwidth pop 2 div neg 0 rmoveto\n"
16 " bx {box} if show\n"
17 "} bind def\n"
18 "\n/lshow { %% usage: string lshow - show left-aligned\n"
19 " dup stringwidth pop neg 0 rmoveto bx {box} if show\n"
20 "} bind def\n"
21 "\n/rshow { %% usage: string rshow - show right-aligned\n"
22 " bx {box} if show\n"
23 "} bind def\n"
24 );
25
26 fprintf (fp,
27 "\n/box { %% usage: str box - draw box around string\n"
28 " gsave 0.5 setlinewidth dup stringwidth pop\n"
29 " -2 -2 rmoveto 4 add fh 4 add 2 copy\n"
30 " 0 exch rlineto 0 rlineto neg 0 exch rlineto neg 0 rlineto\n"
31 " stroke grestore\n"
32 "} bind def\n");
33
34 fprintf (fp,
35 "\n/wd { moveto bx {box} if show } bind def\n"
36 "/wln {\n"
37 "dup 3 1 roll moveto gsave 0.6 setlinewidth lineto stroke grestore\n"
38 "} bind def\n");
39
40 fprintf (fp,
41 "/whf {moveto gsave 0.5 1.2 scale (-) show grestore} bind def\n");
42
43 }
44
45 /* ----- def_typset ------- */
46 void def_typeset(fp)
47 FILE *fp;
48 {
49
50 fprintf (fp,
51 "\n/WS { %%usage: w nspaces str WS\n"
52 " dup stringwidth pop 4 -1 roll\n"
53 " sub neg 3 -1 roll div 0 8#040 4 -1 roll\n"
54 " widthshow\n"
55 "} bind def\n");
56
57
58 fprintf (fp,
59 "\n/W1 { show pop pop } bind def\n");
60
61
62 fprintf (fp,
63 "\n/str 50 string def\n"
64 "/W0 {\n"
65 " dup stringwidth pop str cvs exch show ( ) show show pop pop\n"
66 "} bind def\n");
67
68 fprintf (fp,
69 "\n/WC { counttomark 1 sub dup 0 eq { 0 }\n"
70 " { ( ) stringwidth pop neg 0 3 -1 roll\n"
71 " { dup 3 add index stringwidth pop ( ) stringwidth pop add\n"
72 " dup 3 index add 4 index lt 2 index 1 lt or\n"
73 " {3 -1 roll add exch 1 add} {pop exit} ifelse\n"
74 " } repeat } ifelse\n"
75 "} bind def\n");
76
77 fprintf (fp,
78 "\n/P1 {\n"
79 " { WC dup 0 le {exit} if\n"
80 " exch pop gsave { exch show ( ) show } repeat grestore LF\n"
81 " } loop pop pop pop pop\n"
82 "} bind def\n");
83
84 fprintf (fp,
85 "\n/P2 {\n"
86 " { WC dup 0 le {exit} if\n"
87 " dup 1 sub dup 0 eq\n"
88 " { pop exch pop 0.0 }\n"
89 " { 3 2 roll 3 index exch sub exch div } ifelse\n"
90 " counttomark 3 sub 2 index eq { pop 0 } if exch gsave\n"
91 " { 3 2 roll show ( ) show dup 0 rmoveto } repeat\n"
92 " grestore LF pop\n"
93 " } loop pop pop pop pop\n"
94 "} bind def\n");
95
96 }
97
98 /* ----- define_font ------- */
99 void define_font (fp,name,num)
100 FILE *fp;
101 char name[];
102 int num;
103 {
104
105 if (!strcmp(name,"Symbol")) {
106 fprintf (fp,
107 "/F%d { 1 eq {/bx true def} { /bx false def} ifelse\n"
108 " dup 0.72 mul /fh exch def\n"
109 " /%s exch selectfont } bind def\n",
110 num, name);
111 return;
112 }
113
114 fprintf (fp,
115 "\n/%s findfont\n"
116 "dup length dict begin\n"
117 " {1 index /FID ne {def} {pop pop} ifelse} forall\n"
118 " /Encoding ISOLatin1Encoding def\n"
119 " currentdict\n"
120 "end\n"
121 "/%s-ISO exch definefont pop\n",
122 name, name);
123
124 fprintf (fp,
125 "/F%d { 1 eq {/bx true def} { /bx false def} ifelse\n"
126 " dup 0.72 mul /fh exch def\n"
127 " /%s-ISO exch selectfont } bind def\n",
128 num, name);
129
130 }
131
132
133 /* ----- def_tsig ------- */
134 void def_tsig (fp)
135 FILE *fp;
136 {
137 fprintf (fp,
138 "\n/tsig { %% usage: x (top) (bot) tsig -- draw time signature\n"
139 " 3 -1 roll 0 moveto /bx false def\n"
140 " gsave /Times-Bold 16 selectfont 1.2 1 scale\n"
141 " 0 1.0 rmoveto currentpoint 3 -1 roll cshow\n"
142 " moveto 0 12 rmoveto cshow grestore\n"
143 "} bind def\n"
144 );
145 }
146
147 /* ----- add_cv ------- */
148 void add_cv (fp,f1,f2,p,i0,ncv)
149 FILE *fp;
150 float p[][2],f1,f2;
151 int i0,ncv;
152 {
153 int i,i1,m;
154
155 i1=i0;
156 for (m=0; m<ncv; m++) {
157 fprintf (fp, " ");
158 for (i=0; i<3; i++)
159 fprintf (fp, " %.2f %.2f",
160 f1*(p[i1+i][0]-p[i1-1][0]),
161 f2*(p[i1+i][1]-p[i1-1][1]));
162 fprintf (fp, " rcurveto\n");
163 i1=i1+3;
164 }
165 }
166
167 /* ----- add_sg ------- */
168 void add_sg (fp,f1,f2,p,i0,nseg)
169 FILE *fp;
170 float p[][2],f1,f2;
171 int i0,nseg;
172 {
173 int i;
174 for (i=0; i<nseg; i++)
175 fprintf (fp, " %.2f %.2f rlineto\n",
176 f1*(p[i0+i][0]-p[i0+i-1][0]),
177 f2*(p[i0+i][1]-p[i0+i-1][1]));
178 }
179
180 /* ----- add_mv ------- */
181 void add_mv (fp,f1,f2,p,i0)
182 FILE *fp;
183 float p[][2],f1,f2;
184 int i0;
185 {
186 if (i0==0)
187 fprintf (fp, " %.2f %.2f rmoveto\n",
188 f1*p[i0][0], f2*p[i0][1]);
189 else
190 fprintf (fp, " %.2f %.2f rmoveto\n",
191 f1*(p[i0][0]-p[i0-1][0]),
192 f2*(p[i0][1]-p[i0-1][1]));
193 }
194
195
196 /* ----- def_stems ------- */
197 void def_stems (fp)
198 FILE *fp;
199 {
200 fprintf (fp,
201 "\n/su { %% usage: len su - up stem\n"
202 " x y moveto %.1f %.1f rmoveto %.1f sub 0 exch rlineto stroke\n"
203 "} bind def\n",
204 STEM_XOFF, STEM_YOFF, STEM_YOFF );
205
206 fprintf(fp,
207 "\n/sd { %% usage: len td - down stem\n"
208 " x y moveto %.1f %.1f rmoveto neg %.1f add 0 exch rlineto stroke\n"
209 "} bind def\n",
210 -STEM_XOFF, -STEM_YOFF, STEM_YOFF);
211 }
212
213 /* ----- def_dot ------- */
214 void def_dot (fp)
215 FILE *fp;
216 {
217 fprintf(fp,
218 "\n/dt { %% usage: dx dy dt - dot shifted by dx,dy\n"
219 " y add exch x add exch 1.2 0 360 arc fill\n"
220 "} bind def\n");
221 }
222
223 /* ----- def_deco ------- */
224 void def_deco (fp)
225 FILE *fp;
226 {
227
228 float p[7][2] = {
229 {-10,-2},{0,15},{1,-11},{10,2},{0,-15},{-1,11},{-10,-2} };
230
231 /* float q[7][2] = {
232 {-13,0},{-2,9},{2,9},{13,0},{3,5},{-3,5},{-13,-0} }; */
233
234 /* float q[7][2] = {
235 {-11,0},{-9,10},{9,10},{11,0},{5,7},{-5,7},{-11,-0} }; */
236
237 /* Walsh suggestion, scale 1.8 in y */
238 float q[7][2] = {
239 {-13,0},{-12,9},{12,9},{13,0},{10,7.4},{-10,7.4},{-13,-0} };
240
241 float s[7][2] = {
242 {-8,-4.8},{-6,-5.5},{-3,-4.6},{0,0},{-2.3,-5},{-6,-6.8},{-8.5,-6} };
243
244 float f1,f2;
245 int i;
246
247 f1=0.5;
248 f2=0.5;
249
250 fprintf (fp, "\n/grm { %% usage: y grm - gracing mark\n"
251 " x exch moveto\n");
252 add_mv (fp,f1,f2,p,0);
253 add_cv (fp,f1,f2,p,1,2);
254 fprintf (fp, " fill\n} bind def\n");
255 fprintf (fp, "\n/stc { %% usage: y stc - staccato mark\n"
256 " x exch 1.2 0 360 arc fill } bind def\n");
257
258 fprintf (fp, "\n/hat { %% usage: y hat\n"
259 " x exch moveto\n"
260 " -4 -2 rmoveto 4 6 rlineto currentpoint stroke moveto\n"
261 " 4 -6 rlineto -2 0 rlineto -3 4.5 rlineto fill\n"
262 " } bind def\n");
263
264 fprintf (fp, "\n/att { %% usage: y att\n"
265 " x exch moveto\n"
266 " -4 -3 rmoveto 8 3 rlineto -8 3 rlineto stroke\n"
267 " } bind def\n");
268
269 f2=f2*1.8;
270
271 if (temp_switch==3) { f1=0.8*f1; f2=0.8*f2; }
272 else { f1=0.9*f1; f2=0.9*f2; }
273
274 fprintf (fp, "\n/cpu { %% usage: y cpu - roll sign above head\n"
275 " x exch moveto\n");
276 add_mv (fp,f1,f2,q,0);
277 add_cv (fp,f1,f2,q,1,2);
278 fprintf (fp, " fill\n} bind def\n");
279
280 for (i=0;i<7;i++) q[i][1]=-q[i][1];
281
282 fprintf (fp, "\n/cpd { %% usage: y cpd - roll sign below head\n"
283 " x exch moveto\n");
284 add_mv (fp,f1,f2,q,0);
285 add_cv (fp,f1,f2,q,1,2);
286 fprintf (fp, " fill\n} bind def\n");
287
288 f1=0.9;
289 f2=1.0;
290 fprintf (fp, "\n/sld { %% usage: y dx sld - slide\n"
291 " x exch sub exch moveto\n");
292 add_mv (fp,f1,f2,s,0);
293 add_cv (fp,f1,f2,s,1,2);
294 fprintf (fp, " fill\n} bind def\n");
295
296 fprintf (fp, "\n/emb { %% usage: y emb - empahsis bar\n"
297 " gsave 1.4 setlinewidth 1 setlinecap x exch moveto \n"
298 " -3.5 0 rmoveto 7 0 rlineto stroke grestore\n"
299 "} bind def\n");
300
301 fprintf (fp, "\n/trl { %% usage: y trl - trill sign\n"
302 " gsave /Times-BoldItalic 14 selectfont\n"
303 " x 4 sub exch moveto (tr) show grestore\n"
304 "} bind def\n");
305
306 }
307
308
309
310 /* ----- def_deco1 ------- */
311 void def_deco1 (fp)
312 FILE *fp;
313 {
314
315 float p[8][2] = { /* for hold sign */
316 {-15,0},{-15,23},{15,23},{15,0},
317 {14.5,0},{12,18},{-12,18},{-14.5,0} };
318
319 float q[8][2] = { /* for down bow sign */
320 {-4,0},{-4,9},{4,9},{4,0},
321 {-4,6},{-4,9},{4,9},{4,6} };
322
323 float r[3][2] = { /* for up bow sign */
324 {-3.2,11},{0,0},{3.2,11} };
325
326 float f1,f2;
327
328 f1=f2=0.5;
329 fprintf (fp, "\n/hld { %% usage: y hld - hold sign\n"
330 " x exch 2 copy 1.5 add 1.3 0 360 arc moveto\n");
331 add_mv (fp,f1,f2,p,0);
332 add_cv (fp,f1,f2,p,1,1);
333 add_sg (fp,f1,f2,p,4,1);
334 add_cv (fp,f1,f2,p,5,1);
335 fprintf (fp, " fill\n} bind def\n");
336
337 f1=f2=0.8;
338 fprintf (fp, "\n/dnb { %% usage: y dnb - down bow\n"
339 " x exch moveto\n");
340 add_mv (fp,f1,f2,q,0);
341 add_sg (fp,f1,f2,q,1,3);
342 fprintf (fp, " currentpoint stroke moveto\n");
343 add_mv (fp,f1,f2,q,4);
344 add_sg (fp,f1,f2,q,5,3);
345 fprintf (fp, " fill\n} bind def\n");
346
347 fprintf (fp, "\n/upb { %% usage: y upb - up bow\n"
348 " x exch moveto\n");
349 add_mv (fp,f1,f2,r,0);
350 add_sg (fp,f1,f2,r,1,2);
351 fprintf (fp, " stroke\n} bind def\n");
352
353 }
354
355 /* ----- def_hl ------- */
356 void def_hl (fp)
357 FILE *fp;
358 {
359 fprintf(fp,
360 "\n/hl { %% usage: y hl - helper line at height y\n"
361 " gsave 1 setlinewidth x exch moveto \n"
362 " -5.5 0 rmoveto 11 0 rlineto stroke grestore\n"
363 "} bind def\n");
364
365 fprintf(fp,
366 "\n/hl1 { %% usage: y hl1 - longer helper line\n"
367 " gsave 1 setlinewidth x exch moveto \n"
368 " -7 0 rmoveto 14 0 rlineto stroke grestore\n"
369 "} bind def\n");
370 }
371
372 /* ----- def_beam ------- */
373 void def_beam (fp)
374 FILE *fp;
375 {
376 fprintf(fp,
377 "\n/bm { %% usage: x1 y1 x2 y2 t bm - beam, depth t\n"
378 " 3 1 roll moveto dup 0 exch neg rlineto\n"
379 " dup 4 1 roll sub lineto 0 exch rlineto fill\n"
380 "} bind def\n");
381
382 fprintf(fp,
383 "\n/bnum { %% usage: x y (str) bnum - number on beam\n"
384 " 3 1 roll moveto gsave /Times-Italic 12 selectfont\n"
385 " /bx false def cshow grestore\n"
386 "} bind def\n");
387
388
389 fprintf(fp,
390 "\n/hbr { %% usage: x1 y1 x2 y2 hbr - half bracket\n"
391 " moveto lineto 0 -3 rlineto stroke\n"
392 "} bind def\n");
393 }
394
395
396 /* ----- def_flags1 ------- */
397 void def_flags1 (fp)
398 FILE *fp;
399 {
400 float p[13][2] = {
401 {0.0, 0.0}, {1.5, -3.0}, {1.0, -2.5}, {4.0, -6.0}, {9.0, -10.0},
402 {9.0, -16.0}, {8.0, -20.0}, {7.0, -24.0}, {4.0, -26.0},
403 {6.5, -21.5}, {9.0, -15.0}, {4.0, -9.0}, {0.0, -8.0} } ;
404
405 float f1,f2;
406 int i;
407
408 f1=f2=6.0/9.0;
409 fprintf (fp, "\n/f1u { %% usage: len f1u - single flag up\n"
410 " y add x %.1f add exch moveto\n", STEM_XOFF);
411 add_mv (fp,f1,f2,p,0);
412 add_cv (fp,f1,f2,p,1,4);
413 fprintf (fp, " fill\n} bind def\n");
414
415 f1=1.2*f1;
416 for (i=0;i<13;i++) p[i][1]=-p[i][1];
417 fprintf (fp, "\n/f1d { %% usage: len f1d - single flag down\n"
418 " neg y add x %.1f sub exch moveto\n", STEM_XOFF);
419 add_mv (fp,f1,f2,p,0);
420 add_cv (fp,f1,f2,p,1,4);
421 fprintf (fp, " fill\n} bind def\n");
422
423 }
424
425 /* ----- def_flags2 ------- */
426 void def_flags2 (fp)
427 FILE *fp;
428 {
429
430 float p[13][2] = {
431 {0.0, 0.0},
432 {2.0, -5.0}, {9.0, -6.0}, {7.5, -18.0},
433 {7.5, -9.0}, {1.5, -6.5}, {0.0, -6.5},
434 {2.0, -14.0}, {9.0, -14.0}, {7.5, -26.0},
435 {7.5, -17.0}, {1.5, -14.5}, {0.0, -14.0},
436 };
437
438 float f1,f2;
439 int i;
440
441 f1=f2=6.0/9.0; /* up flags */
442 fprintf (fp, "\n/f2u { %% usage: len f2u - double flag up\n"
443 " y add x %.1f add exch moveto\n", STEM_XOFF);
444 add_mv (fp,f1,f2,p,0);
445 add_cv (fp,f1,f2,p,1,4);
446 fprintf (fp, " fill\n} bind def\n");
447
448 f1=1.2*f1; /* down flags */
449 for (i=0;i<13;i++) p[i][1]=-p[i][1];
450 fprintf (fp, "\n/f2d { %% usage: len f2d - double flag down\n"
451 " neg y add x %.1f sub exch moveto\n", STEM_XOFF);
452 add_mv (fp,f1,f2,p,0);
453 add_cv (fp,f1,f2,p,1,4);
454 fprintf (fp, " fill\n} bind def\n");
455
456 }
457
458
459
460 /* ----- def_xflags ------- */
461 void def_xflags (fp)
462 FILE *fp;
463 {
464
465 float p[7][2] = {
466 {0.0, 0.0},
467 {2.0, -7.5}, {9.0, -7.5}, {7.5, -19.5},
468 {7.5, -10.5}, {1.5, -8.0}, {0.0, -7.5}
469 };
470
471 float f1,f2;
472 int i;
473
474 f1=f2=6.0/9.0; /* extra up flag */
475 fprintf (fp, "\n/xfu { %% usage: len xfu - extra flag up\n"
476 " y add x %.1f add exch moveto\n", STEM_XOFF);
477 add_mv (fp,f1,f2,p,0);
478 add_cv (fp,f1,f2,p,1,2);
479 fprintf (fp, " fill\n} bind def\n");
480
481 f1=1.2*f1; /* extra down flag */
482 for (i=0;i<7;i++) p[i][1]=-p[i][1];
483 fprintf (fp, "\n/xfd { %% usage: len xfd - extra flag down\n"
484 " neg y add x %.1f sub exch moveto\n", STEM_XOFF);
485 add_mv (fp,f1,f2,p,0);
486 add_cv (fp,f1,f2,p,1,2);
487 fprintf (fp, " fill\n} bind def\n");
488
489 fprintf (fp,
490 "\n/f3d {dup f2d 9.5 sub xfd} bind def\n");
491
492 fprintf (fp,
493 "\n/f4d {dup dup f2d 9.5 sub xfd 14.7 sub xfd} bind def\n");
494
495 fprintf (fp,
496 "\n/f3u {dup f2u 9.5 sub xfu} bind def\n");
497
498 fprintf (fp,
499 "\n/f4u {dup dup f2u 9.5 sub xfu 14.7 sub xfu} bind def\n");
500
501 }
502
503 /* ----- def_acc ------- */
504 void def_acc (fp)
505 FILE *fp;
506 {
507 float p[12][2]={
508 {-2,3},{6,6.5},{6,-1},{-2,-4.5},{4,0},{4,4},{-2,2},{-2,10},{-2,-4}};
509 float q[14][2]={
510 {4,4},{4,7},{-4,5},{-4,2},{4,4},{4,-5},{4,-2},{-4,-4},{-4,-7},{4,-5},
511 {2,-10},{2,11.5},{-2,-11.5},{-2,10} };
512 float r[14][2]={
513 {-2.5,-6}, {2.5,-5}, {2.5,-2}, {-2.5,-3}, {-2.5,6},
514 {-2.5,2}, {2.5,3}, {2.5,6}, {-2.5,5}, {-2.5,2},
515 {-2.5,11}, {-2.5,-5.5},
516 {2.5,5.5}, {2.5,-11} };
517 float s[25][2]={
518 {0.7,0},{3.9,3},{6,3},{6.2,6.2},{3,6},{3,3.9},
519 {0,0.7},{-3,3.9},{-3,6},{-6.2,6.2},{-6,3},{-3.9,3},
520 {-0.7,0},{-3.9,-3},{-6,-3},{-6.2,-6.2},{-3,-6},{-3,-3.9},
521 {0,-0.7},{3,-3.9},{3,-6},{6.2,-6.2},{6,-3},{3.9,-3},
522 {0.7,0} };
523
524
525 float f1,f2;
526
527 f2=8.0/9.0;
528 f1=f2*0.9;
529 fprintf (fp, "\n/ft0 { %% usage: x y ft0 - flat sign\n"
530 " moveto\n");
531 add_mv (fp,f1,f2,p,0);
532 add_cv (fp,f1,f2,p,1,2);
533 fprintf (fp, " currentpoint fill moveto\n");
534 add_mv (fp,f1,f2,p,7);
535 add_sg (fp,f1,f2,p,8,1);
536 fprintf (fp, " stroke\n } bind def\n");
537 fprintf (fp, "/ft { %% usage: dx ft - flat relative to head\n"
538 " neg x add y ft0 } bind def\n");
539
540 f2=8.0/9.0; /* more narrow flat sign for double flat */
541 f1=f2*0.8;
542 fprintf (fp, "\n/ftx { %% usage: x y ftx - narrow flat sign\n"
543 " moveto\n");
544 add_mv (fp,f1,f2,p,0);
545 add_cv (fp,f1,f2,p,1,2);
546 fprintf (fp, " currentpoint fill moveto\n");
547 add_mv (fp,f1,f2,p,7);
548 add_sg (fp,f1,f2,p,8,1);
549 fprintf (fp, " stroke\n } bind def\n");
550
551 fprintf (fp, "/dft0 { %% usage: x y dft0 ft - double flat sign\n"
552 " 2 copy exch 2.5 sub exch ftx exch 1.5 add exch ftx } bind def\n"
553 "/dft { %% usage: dx dft - double flat relative to head\n"
554 " neg x add y dft0 } bind def\n");
555
556
557 f2=6.5/9.0;
558 f1=f2*0.9;
559 fprintf (fp, "\n/sh0 { %% usage: x y sh0 - sharp sign\n"
560 " moveto\n");
561 add_mv (fp,f1,f2,q,0);
562 add_sg (fp,f1,f2,q,1,4);
563 add_mv (fp,f1,f2,q,5);
564 add_sg (fp,f1,f2,q,6,4);
565 fprintf (fp, " currentpoint fill moveto\n");
566 add_mv (fp,f1,f2,q,10);
567 add_sg (fp,f1,f2,q,11,1);
568 fprintf (fp, " currentpoint stroke moveto\n");
569 add_mv (fp,f1,f2,q,12);
570 add_sg (fp,f1,f2,q,13,1);
571 fprintf (fp, " stroke\n } bind def\n");
572 fprintf (fp, "/sh { %% usage: dx sh - sharp relative to head\n"
573 " neg x add y sh0 } bind def\n");
574
575 f2=6.5/9.0;
576 f1=f2*0.9;
577 fprintf (fp, "\n/nt0 { %% usage: x y nt0 - neutral sign\n"
578 " moveto\n");
579 add_mv (fp,f1,f2,r,0);
580 add_sg (fp,f1,f2,r,1,4);
581 add_mv (fp,f1,f2,r,5);
582 add_sg (fp,f1,f2,r,6,4);
583 fprintf (fp, " currentpoint fill moveto\n");
584 add_mv (fp,f1,f2,r,10);
585 add_sg (fp,f1,f2,r,11,1);
586 fprintf (fp, " currentpoint stroke moveto\n");
587 add_mv (fp,f1,f2,r,12);
588 add_sg (fp,f1,f2,r,13,1);
589 fprintf (fp, " stroke\n } bind def\n");
590 fprintf (fp, "/nt { %% usage: dx nt - neutral relative to head\n"
591 " neg x add y nt0 } bind def\n");
592
593 f1=5.0/9.0;
594 f2=f1;
595 fprintf (fp, "\n/dsh0 { %% usage: x y dsh0 - double sharp \n"
596 " moveto\n");
597 add_mv (fp,f1,f2,s,0);
598 add_sg (fp,f1,f2,s,1,24);
599 fprintf (fp, " fill\n } bind def\n");
600 fprintf (fp, "/dsh { %% usage: dx dsh - double sharp relative to head\n"
601 " neg x add y dsh0 } bind def\n");
602 }
603
604 /* ----- def_rests ------- */
605 void def_rests (fp)
606 FILE *fp;
607 {
608 float p[14][2]={
609 {-1,17}, {15,4}, {-6,8}, {6.5,-5}, {-2,-2}, {-5,-11}, {1,-15},
610 {-9,-11}, {-6,0}, {1,-1}, {-9,7}, {7,5}, {-1,17} };
611 float q[16][2]={
612 {8,14}, {5,9}, {3,5}, {-1.5,4},
613 {4,11}, {-9,14}, {-9,7},
614 {-9,4}, {-6,2}, {-3,2},
615 {4,2}, {5,7}, {7,11},
616 {-1.8,-20}, {-0.5,-20}, {8.5,14}};
617 float r[29][2]={
618 {8,14}, {5,9}, {3,5}, {-1.5,4},
619 {4,11}, {-9,14}, {-9,7},
620 {-9,4}, {-6,2}, {-3,2},
621 {4,2}, {5,7}, {7,11},
622 {8,14}, {5,9}, {3,5}, {-1.5,4},
623 {4,11}, {-9,14}, {-9,7},
624 {-9,4}, {-6,2}, {-3,2},
625 {4,2}, {5,7}, {7.3,11},
626 {-1.8,-21}, {-0.5,-21}, {8.5,14} };
627 float f1,f2;
628 int i;
629
630 fprintf (fp, "\n/r4 { %% usage: x y r4 - quarter rest\n"
631 " dup /y exch def exch dup /x exch def exch moveto\n");
632 f1=f2=6.0/11.5;
633 add_mv (fp,f1,f2,p,0);
634 add_cv (fp,f1,f2,p,1,4);
635 fprintf (fp, " fill\n } bind def\n");
636
637 fprintf (fp, "\n/r8 { %% usage: x y r8 - eighth rest\n"
638 " dup /y exch def exch dup /x exch def exch moveto\n");
639 f1=f2=7/18.0;
640 add_mv (fp,f1,f2,q,0);
641 add_cv (fp,f1,f2,q,1,4);
642 add_sg (fp,f1,f2,q,13,3);
643 fprintf (fp, " fill\n } bind def\n");
644
645 for (i=13;i<26;i++) { r[i][0]-=4.2; r[i][1]-=14; }
646 fprintf (fp, "\n/r16 { %% usage: x y r16 - 16th rest\n"
647 " dup /y exch def exch dup /x exch def exch moveto\n");
648 f1=f2=7/18.0;
649 add_mv (fp,f1,f2,r,0);
650 add_cv (fp,f1,f2,r,1,4);
651 add_sg (fp,f1,f2,r,13,1);
652 add_cv (fp,f1,f2,r,14,4);
653 add_sg (fp,f1,f2,r,26,3);
654 fprintf (fp, " fill\n } bind def\n");
655
656
657 fprintf (fp,
658 "\n/r1 { %% usage: x y r1 - whole rest\n"
659 " dup /y exch def exch dup /x exch def exch moveto\n"
660 " -3 6 rmoveto 0 -3 rlineto 6 0 rlineto 0 3 rlineto fill\n"
661 "} bind def\n");
662
663 fprintf (fp,
664 "\n/r2 { %% usage: x y r2 - half rest\n"
665 " dup /y exch def exch dup /x exch def exch moveto\n"
666 " -3 0 rmoveto 0 3 rlineto 6 0 rlineto 0 -3 rlineto fill\n"
667 "} bind def\n"
668 );
669
670 /* get 32nd, 64th rest by overwriting 8th and 16th rests */
671 fprintf (fp,
672 "\n/r32 {\n"
673 "2 copy r16 5.5 add exch 1.6 add exch r8\n"
674 "} bind def\n");
675 fprintf (fp,
676 "\n/r64 {\n"
677 "2 copy 5.5 add exch 1.6 add exch r16\n"
678 "5.5 sub exch 1.5 sub exch r16\n"
679 "} bind def\n");
680
681 }
682
683
684 /* ----- def_bars ------ */
685 void def_bars (fp)
686 FILE *fp;
687 {
688
689 fprintf(fp, "\n/bar { %% usage: x bar - single bar\n"
690 " 0 moveto 0 24 rlineto stroke\n"
691 "} bind def\n"
692
693 "\n/dbar { %% usage: x dbar - thin double bar\n"
694 " 0 moveto 0 24 rlineto -3 -24 rmoveto\n"
695 " 0 24 rlineto stroke\n"
696 "} bind def\n"
697
698 "\n/fbar1 { %% usage: x fbar1 - fat double bar at start\n"
699 " 0 moveto 0 24 rlineto 3 0 rlineto 0 -24 rlineto \n"
700 " currentpoint fill moveto\n"
701 " 3 0 rmoveto 0 24 rlineto stroke\n"
702 "} bind def\n"
703
704 "\n/fbar2 { %% usage: x fbar2 - fat double bar at end\n"
705 " 0 moveto 0 24 rlineto -3 0 rlineto 0 -24 rlineto \n"
706 " currentpoint fill moveto\n"
707 " -3 0 rmoveto 0 24 rlineto stroke\n"
708 "} bind def\n"
709
710 "\n/rdots { %% usage: x rdots - repeat dots \n"
711 " 0 moveto 0 9 rmoveto currentpoint 2 copy 1.2 0 360 arc \n"
712 " moveto 0 6 rmoveto currentpoint 1.2 0 360 arc fill\n"
713 "} bind def\n");
714 }
715
716 /* ----- def_ends ------ */
717 void def_ends (fp)
718 FILE *fp;
719 {
720 /* use dy=20 for tall boxes */
721 int y=50,dy=6;
722
723 fprintf(fp, "\n/end1 { %% usage: x1 x2 (str) end1 - mark first ending\n"
724 " 3 1 roll %d moveto 0 %d rlineto dup %d lineto 0 %d rlineto stroke\n"
725 " 4 add %d moveto gsave /Times-Roman 13 selectfont 1.2 0.95 scale\n"
726 " show grestore\n"
727 "} bind def\n",
728 y-dy, dy, y, -dy, y-10);
729
730 fprintf(fp, "\n/end2 { %% usage: x1 x2 (str) end2 - mark second ending\n"
731 " 3 1 roll %d moveto dup %d lineto 0 %d rlineto stroke\n"
732 " 4 add %d moveto gsave /Times-Roman 13 selectfont 1.2 0.95 scale\n"
733 " show grestore\n"
734 "} bind def\n",
735 y, y, -dy, y-10);
736 }
737
738 /* ----- def_gchord ------ */
739 void def_gchord (fp)
740 FILE *fp;
741 {
742 fprintf(fp,"\n/gc { %% usage: x y (str) gc -- draw guitar chord string\n"
743 " 3 1 roll moveto rshow\n"
744 "} bind def\n");
745 }
746
747 /* ----- def_sl ------ */
748 void def_sl (fp)
749 FILE *fp;
750 {
751 /* fprintf(fp, "\n/sl { %% usage: x1 y2 x2 y2 x3 y3 x0 y0 sl\n"
752 " gsave %.1f setlinewidth moveto curveto stroke grestore\n"
753 "} bind def\n", SLURWIDTH); */
754
755 fprintf(fp, "\n/SL { %% usage: pp2x pp1x p1 pp1 pp2 p2 p1 sl\n"
756 " moveto curveto rlineto curveto fill\n"
757 "} bind def\n");
758
759 }
760
761 /* ----- def_hd1 ------- */
762 void def_hd1 (fp)
763 FILE *fp;
764 {
765 float p[7][2] = {
766 {8.0, 0.0}, {8.0, 8.0}, {-8.0, 8.0}, {-8.0, 0.0}, {-8.0, -8.0},
767 {8.0, -8.0}, {8.0, 0.0} };
768
769 float c,s,xx,yy,f1,f2;
770 int i;
771 /*float phi; */
772
773 /*phi=0.6;
774 c=cos(phi);
775 s=sin(phi); */
776
777 c=0.825; s=0.565;
778
779 for (i=0;i<7;i++) {
780 xx = c*p[i][0] - s*p[i][1];
781 yy = s*p[i][0] + c*p[i][1];
782 p[i][0]=xx;
783 p[i][1]=yy;
784 }
785
786 f1=f2=6.0/12.0;
787 fprintf (fp, "\n/hd { %% usage: x y hd - full head\n"
788 " dup /y exch def exch dup /x exch def exch moveto\n");
789 add_mv (fp,f1,f2,p,0);
790 add_cv (fp,f1,f2,p,1,2);
791 fprintf (fp, " fill\n} bind def\n");
792 }
793
794 /* ----- def_hd2 ------- */
795 void def_hd2 (fp)
796 FILE *fp;
797 {
798
799 float p[14][2] = {
800 {8.0, 0.0}, {8.0, 8.5}, {-8.0, 8.5}, {-8.0, 0.0}, {-8.0, -8.5},
801 {8.0, -8.5}, {8.0, 0.0}, {7.0, 0.0}, {7.0, -4.0}, {-7.0, -4.0},
802 {-7.0, 0.0}, {-7.0, 4.0}, {7.0, 4.0}, {7.0, 0.0} };
803
804 /* float phi; */
805 float c,s,xx,yy,f1,f2;
806 int i;
807
808 /*phi=0.5;
809 c=cos(phi);
810 s=sin(phi); */
811
812 c=0.878; s=0.479;
813
814 for (i=0;i<14;i++) {
815 xx = c*p[i][0] - s*p[i][1];
816 yy = s*p[i][0] + c*p[i][1];
817 p[i][0]=xx;
818 p[i][1]=yy;
819 }
820
821 f1=f2=6.0/12.0;
822 fprintf (fp, "\n/Hd { %% usage: x y Hd - open head for half\n"
823 " dup /y exch def exch dup /x exch def exch moveto\n");
824 add_mv (fp,f1,f2,p,0);
825 add_cv (fp,f1,f2,p,1,2);
826 add_mv (fp,f1,f2,p,7);
827 add_cv (fp,f1,f2,p,8,2);
828 fprintf (fp, " fill\n} bind def\n");
829 }
830
831 /* ----- def_hd3 ------- */
832 void def_hd3 (fp)
833 FILE *fp;
834 {
835
836 float p[13][2] = {
837 {11.0, 0.0}, {11.0, 2.0}, {6.0, 6.5}, {0.0, 6.5}, {-6.0, 6.5},
838 {-11.0, 2.0}, {-11.0, 0.0}, {-11.0, -2.0}, {-6.0, -6.5},
839 {0.0, -6.5}, {6.0, -6.5}, {11.0, -2.0}, {11.0, 0.0} };
840
841 float q[8][2] = {
842 {11.0, 0.0}, {5.0, 0.0}, {5.0, -5.0}, {-5.0, -5.0}, {-5.0, 0.0},
843 {-5.0, 5.0}, {5.0, 5.0}, {5.0, 0.0}};
844
845 /* float phi; */
846 float c,s,xx,yy,f1,f2;
847 int i;
848
849 /*phi=2.5;
850 c=cos(phi);
851 s=sin(phi); */
852
853 c=-0.801; s=0.598;
854
855 for (i=1;i<8;i++) {
856 xx = c*q[i][0] - s*q[i][1];
857 yy = s*q[i][0] + c*q[i][1];
858 q[i][0]=xx;
859 q[i][1]=yy;
860 }
861
862 f1=f2=6.5/12.0;
863 fprintf (fp, "\n/HD { %% usage: x y HD - open head for whole\n"
864 " dup /y exch def exch dup /x exch def exch moveto\n");
865 add_mv (fp,f1,f2,p,0);
866 add_cv (fp,f1,f2,p,1,4);
867 add_mv (fp,f1,f2,q,1);
868 add_cv (fp,f1,f2,q,2,2);
869 fprintf (fp, " fill\n} bind def\n");
870
871 }
872
873 /* ----- def_gnote ------- */
874 void def_gnote (fp)
875 FILE *fp;
876 {
877 float p[7][2] = {
878 {0,10}, {16,10}, {16,-10}, {0,-10}, {-16,-10}, {-16,10}, {0,10} };
879
880 /* float phi; */
881 float c,s,xx,yy,f1,f2;
882 int i;
883
884 /*phi=0.7;
885 c=cos(phi);
886 s=sin(phi); */
887
888 c=0.765; s=0.644;
889
890 for (i=0;i<7;i++) {
891 xx = c*p[i][0] - s*p[i][1];
892 yy = s*p[i][0] + c*p[i][1];
893 p[i][0]=xx;
894 p[i][1]=yy;
895 }
896
897 f1=f2=2./10.0;
898
899 fprintf (fp, "\n/gn1 { %% usage: x y l gnt - grace note w. tail\n"
900 " 3 1 roll 2 copy moveto\n");
901 add_mv (fp,f1,f2,p,0);
902 add_cv (fp,f1,f2,p,1,2);
903 fprintf (fp, " fill moveto %.2f 0 rmoveto 0 exch rlineto\n"
904 "3 -4 4 -5 2 -8 rcurveto -5 2 rmoveto 7 4 rlineto \n"
905 "stroke\n",
906 GSTEM_XOFF);
907 fprintf (fp, "} bind def\n");
908
909 fprintf (fp, "\n/gnt { %% usage: x y l gnt - grace note\n"
910 " 3 1 roll 2 copy moveto\n");
911 add_mv (fp,f1,f2,p,0);
912 add_cv (fp,f1,f2,p,1,2);
913 fprintf (fp, " fill moveto %.2f 0 rmoveto 0 exch rlineto stroke\n",
914 GSTEM_XOFF);
915 fprintf (fp, "} bind def\n");
916
917 fprintf(fp, "\n/gbm2 { %% usage: x1 y1 x2 y2 gbm2 - double note beam\n"
918 " gsave 1.4 setlinewidth\n"
919 " 4 copy 0.5 sub moveto 0.5 sub lineto stroke\n"
920 " 3.4 sub moveto 3.4 sub lineto stroke grestore\n"
921 "} bind def\n");
922
923 fprintf(fp, "\n/gbm3 { %% usage: x1 y1 x2 y2 gbm3 - triple gnote beam\n"
924 " gsave 1.2 setlinewidth\n"
925 " 4 copy 0.3 sub moveto 0.3 sub lineto stroke\n"
926 " 4 copy 2.5 sub moveto 2.5 sub lineto stroke\n"
927 " 4.7 sub moveto 4.7 sub lineto stroke grestore\n"
928 "} bind def\n");
929
930 fprintf(fp, "\n/ghl { %% usage: x y ghl - grace note helper line\n"
931 " gsave 0.7 setlinewidth moveto \n"
932 " -3 0 rmoveto 6 0 rlineto stroke grestore\n"
933 "} bind def\n");
934
935 fprintf(fp, "\n/gsl { %% usage: x1 y2 x2 y2 x3 y3 x0 y0 gsl\n"
936 " moveto curveto stroke\n"
937 "} bind def\n");
938
939 fprintf(fp, "\n/gsh0 { %% usage: x y gsh0\n"
940 "gsave translate 0.7 0.7 scale 0 0 sh0 grestore\n"
941 "} bind def\n");
942
943 fprintf(fp, "\n/gft0 { %% usage: x y gft0\n"
944 "gsave translate 0.7 0.7 scale 0 0 ft0 grestore\n"
945 "} bind def\n");
946
947 fprintf(fp, "\n/gnt0 { %% usage: x y gnt0\n"
948 "gsave translate 0.7 0.7 scale 0 0 nt0 grestore\n"
949 "} bind def\n");
950
951 fprintf(fp, "\n/gdf0 { %% usage: x y gdf0\n"
952 "gsave translate 0.7 0.6 scale 0 0 dft0 grestore\n"
953 "} bind def\n");
954
955 fprintf(fp, "\n/gds0 { %% usage: x y gds0\n"
956 "gsave translate 0.7 0.7 scale 0 0 dsh0 grestore\n"
957 "} bind def\n");
958 }
959
960
961 /* ----- def_csig ------- */
962 void def_csg (fp)
963 FILE *fp;
964 {
965 float p[25][2]={
966 {0,26},
967 {4,26}, {11,23}, {11,14},
968 {11,20}, {5,19}, {5,14},
969 {5,9}, {12,9}, {12,15},
970 {12,25}, {6,28}, {0,28},
971 {-15,28}, {-25,17}, {-25,2},
972 {-25,-10}, {-10,-28}, {11,-8},
973 {-6,-20}, {-18,-11}, {-18,2},
974 {-18,14}, {-14,26}, {0,26} };
975
976 float f1,f2;
977 int i;
978
979 for (i=0;i<25;i++) {
980 p[i][0]=p[i][0]+4;
981 p[i][1]=p[i][1]+43;
982 }
983 f1 = f2 = 0.25;
984 fprintf (fp, "\n/csig { %% usage: x csig - C timesig \n"
985 " 0 moveto\n");
986 add_mv (fp,f1,f2,p,0);
987 add_cv (fp,f1,f2,p,1,8);
988 fprintf (fp, " fill\n} bind def\n");
989
990 fprintf (fp, "\n/ctsig { %% usage: x ctsig - C| timesig \n"
991 " dup csig 4 moveto 0 16 rlineto stroke\n"
992 "} bind def\n");
993 }
994
995
996 /* ----- def_tclef ------- */
997 void def_tclef (fp)
998 FILE *fp;
999 {
1000 float p[71][2]={
1001 {-6, 16}, {-8, 13}, {-14, 19}, {-10, 35}, {2, 35}, {8, 37},
1002 {21, 30}, {21, 17}, {21, 5}, {10, -1}, {0, -1}, {-12, -1},
1003 {-23, 5}, {-23, 22}, {-23, 29}, {-22, 37}, {-7, 49}, {10, 61},
1004 {10, 68}, {10, 73}, {10, 78}, {9, 82}, {7, 82}, {2, 78},
1005 {-2, 68}, {-2, 62}, {-2, 25}, {10, 18}, {11, -8}, {11, -18},
1006 {5, -23}, {-4, -23}, {-10, -23}, {-15, -18}, {-15, -13},
1007 {-15, -8}, {-12, -4}, {-7, -4}, {3, -4}, {3, -20}, {-6, -17},
1008 {-5, -23}, {9, -20}, {9, -9}, {7, 24}, {-5, 30}, {-5, 67},
1009 {-5, 78}, {-2, 87}, {7, 91}, {13, 87}, {18, 80}, {17, 73},
1010 {17, 62}, {10, 54}, {1, 45}, {-5, 38}, {-15, 33}, {-15, 19},
1011 {-15, 7}, {-8, 1}, {0, 1}, {8, 1}, {15, 6}, {15, 14}, {15, 23},
1012 {7, 26}, {2, 26}, {-5, 26}, {-9, 21}, {-6, 16} };
1013
1014 float f1,f2;
1015
1016 f1 = f2 = 24.0/65.0;
1017 fprintf (fp, "\n/tclef { %% usage: x tclef - treble clef \n"
1018 " 0 moveto\n");
1019 add_mv (fp,f1,f2,p,0);
1020 add_sg (fp,f1,f2,p,1,1);
1021 add_cv (fp,f1,f2,p,2,23);
1022 fprintf (fp, " fill\n} bind def\n");
1023 fprintf (fp, "\n/stclef {\n"
1024 " 0.85 div gsave 0.85 0.85 scale tclef grestore\n"
1025 "} bind def\n");
1026 }
1027
1028 /* ----- def_bclef ------- */
1029 void def_bclef (fp)
1030 FILE *fp;
1031 {
1032 float p[42][2]={
1033 {-2.3,3}, {6,7}, {10.5,12}, {10.5,16},
1034 {10.5,20.5}, {8.5,23.5}, {6.2,23.3},
1035 {5.2,23.5}, {2,23.5}, {0.5,19.5},
1036 {2,20}, {4,19.5}, {4,18},
1037 {4,17}, {3.5,16}, {2,16},
1038 {1,16}, {0,16.9}, {0,18.5},
1039 {0,21}, {2.1,24}, {6,24},
1040 {10,24}, {13.5,21.5}, {13.5,16.5},
1041 {13.5,11}, {7,5.5}, {-2.0,2.8},
1042 {14.9,21},
1043 {14.9,22.5}, {16.9,22.5}, {16.9,21},
1044 {16.9,19.5}, {14.9,19.5}, {14.9,21},
1045 {14.9,15},
1046 {14.9,16.5}, {16.9,16.5}, {16.9,15},
1047 {16.9,13.5}, {14.9,13.5}, {14.9,15} };
1048
1049 int i;
1050 float f1,f2;
1051
1052 for (i=0;i<42;i++) {p[i][0]-=7.5; p[i][1]-=0.5; }
1053 f1 = f2 = 1.0;
1054 fprintf (fp, "\n/bclef { %% usage: x bclef - bass clef \n"
1055 " 0 moveto\n");
1056 add_mv (fp,f1,f2,p,0);
1057 add_cv (fp,f1,f2,p,1,9);
1058 add_cv (fp,f1,f2,p,1,9);
1059
1060 add_mv (fp,f1,f2,p,28);
1061 add_cv (fp,f1,f2,p,29,2);
1062
1063 add_mv (fp,f1,f2,p,25);
1064 add_cv (fp,f1,f2,p,36,2);
1065
1066 fprintf (fp, "fill\n} bind def\n");
1067
1068 fprintf (fp, "\n/sbclef {\n"
1069 " 0.85 div gsave 0.85 0.85 scale 0 4 translate bclef grestore\n"
1070 "} bind def\n");
1071 }
1072
1073 /* ----- def_cclef ------- */
1074 void def_cclef (fp)
1075 FILE *fp;
1076 {
1077 float p[30][2]={
1078 {0,0}, {2,5.5},
1079 {9,4.5}, {12,10}, {12,15.5},
1080 {12,19.5}, {11,23.3}, {6.5,23.5},
1081 {5.2,23.5}, {2,23.5}, {0.5,19.5},
1082 {2,20}, {4,19.5}, {4,18},
1083 {4,17}, {3.5,16}, {2,16},
1084 {1,16}, {0,16.9}, {0,18.5},
1085 {0,21}, {2.1,24}, {6,24},
1086 {12,24}, {15,21.5}, {15,16.5},
1087 {15,10}, {10,4.5}, {4,5},
1088 {3,0} };
1089 int i;
1090 float f1,f2;
1091
1092 for (i=0;i<30;i++) p[i][1]+=24;
1093
1094 f1 = 0.6;
1095 f2 = 0.5;
1096 fprintf (fp, "\n/cchalf {\n"
1097 " 0 moveto\n");
1098 add_mv (fp,f1,f2,p,0);
1099 add_sg (fp,f1,f2,p,1,1);
1100 add_cv (fp,f1,f2,p,2,9);
1101 add_sg (fp,f1,f2,p,29,1);
1102 fprintf (fp, "fill\n} bind def\n");
1103
1104 fprintf (fp,
1105 "\n/cclef { %% usage: x cclef\n"
1106 " dup dup dup\n"
1107 " cchalf gsave 0 24 translate 1 -1 scale cchalf\n"
1108 " 6.5 sub 0 moveto 0 24 rlineto 3 0 rlineto 0 -24 rlineto fill\n"
1109 " 1.8 sub 0 moveto 0 24 rlineto 0.8 setlinewidth stroke grestore \n"
1110 "} bind def\n");
1111
1112 fprintf (fp, "\n/scclef { cclef } bind def\n");
1113 }
1114
1115 /* ----- def_brace ------- */
1116 void def_brace (fp)
1117 FILE *fp;
1118 {
1119 float p[8][2]={
1120 {7.2,60}, {-7,39}, {17,17}, {-1,0},
1121 {-1.4,0}, {13,13}, {-11,39}, {7,60} };
1122
1123 float q[8][2]={
1124 {-3,0}, {2,0}, {4,1}, {5.5,5},
1125 {5.9,4.7}, {4.7,1.2}, {3.2,-.4}, {-1,-1.2} };
1126
1127 float f1,f2;
1128
1129 f1 = 0.9;
1130 f2 = 1.0;
1131 fprintf (fp, "\n/bracehalf {\n");
1132 add_mv (fp,f1,f2,p,0);
1133 add_cv (fp,f1,f2,p,1,1);
1134 add_sg (fp,f1,f2,p,4,1);
1135 add_cv (fp,f1,f2,p,5,1);
1136 fprintf (fp, " fill\n} bind def\n");
1137
1138 fprintf (fp,
1139 "\n/brace { %% usage: scale x0 y0 brace\n"
1140 " 3 copy moveto gsave 1 exch scale bracehalf grestore\n"
1141 " moveto gsave neg 1 exch scale bracehalf grestore\n"
1142 "} bind def\n");
1143
1144 f1 = 1.0;
1145 f2 = 1.0;
1146 fprintf (fp, "\n/brackhead {\n");
1147 add_mv (fp,f1,f2,q,0);
1148 add_cv (fp,f1,f2,q,1,1);
1149 add_sg (fp,f1,f2,q,4,1);
1150 add_cv (fp,f1,f2,q,5,1);
1151 fprintf (fp, " fill\n} bind def\n");
1152
1153 fprintf (fp,
1154 "\n/bracket { %% usage: h x0 y0 bracket\n"
1155 " 3 copy moveto 0 exch rmoveto brackhead\n"
1156 " 3 copy moveto pop gsave 1 -1 scale brackhead grestore \n"
1157 " moveto -3 0 rlineto 0 exch rlineto 3 0 rlineto fill\n"
1158 "} bind def \n");
1159
1160 }
1161
1162
1163 /* ----- def_staff ------- */
1164 void def_staff (fp)
1165 FILE *fp;
1166 {
1167 fprintf (fp,
1168 "\n/staff { %% usage: l staff - draw staff\n"
1169 " gsave 0.5 setlinewidth 0 0 moveto\n"
1170 " dup 0 rlineto dup neg 6 rmoveto\n"
1171 " dup 0 rlineto dup neg 6 rmoveto\n"
1172 " dup 0 rlineto dup neg 6 rmoveto\n"
1173 " dup 0 rlineto dup neg 6 rmoveto\n"
1174 " dup 0 rlineto dup neg 6 rmoveto\n"
1175 " pop stroke grestore\n"
1176 "} bind def\n");
1177 }
1178
1179 /* ----- def_sep ------- */
1180 void def_sep (fp)
1181 FILE *fp;
1182 {
1183 fprintf (fp,
1184 "\n/sep0 { %% usage: x1 x2 sep0 - hline separator \n"
1185 " 0 moveto 0 lineto stroke\n"
1186 "} bind def\n");
1187 }
1188
1189 /* ----- define_symbols: write postscript macros to file ------ */
1190 void define_symbols (fp)
1191 FILE *fp;
1192 {
1193
1194 def_misc (fp);
1195 def_tclef (fp);
1196 def_bclef (fp);
1197 def_cclef (fp);
1198 def_hd1 (fp);
1199 def_hd2 (fp);
1200 def_hd3 (fp);
1201 def_stems (fp);
1202 def_beam (fp);
1203 def_sl (fp);
1204 def_dot (fp);
1205 def_deco (fp);
1206 def_deco1 (fp);
1207 def_hl (fp);
1208 def_flags1 (fp);
1209 def_flags2 (fp);
1210 def_xflags (fp);
1211 def_acc (fp);
1212 def_gchord (fp);
1213 def_rests (fp);
1214 def_bars (fp);
1215 def_ends (fp);
1216 def_gnote (fp);
1217 def_csg (fp);
1218 def_sep (fp);
1219 def_tsig (fp);
1220 def_staff (fp);
1221 def_brace (fp);
1222 def_typeset(fp);
1223
1224 }
1225
1226