/* * This file is part of abc2ps, Copyright (C) 1996,1997 Michael Methfessel * See file abc2ps.c for details. */ #include #include #include #include #include "abc2ps.h" /* subroutines to define postscript macros which draw symbols */ /******************************************************/ /* */ /* This font is required as it is used to form some */ /* of the music symbols (segno). */ /* J. Atchley -- 05/00 [JSA] */ /* */ /******************************************************/ static char def_segno_font[] = "\n/Times-BoldItalic findfont\n" "dup length dict begin\n" " {1 index /FID ne {def} {pop pop} ifelse} forall\n" " /Encoding ISOLatin1Encoding def\n" " currentdict\n" "end\n" "/Times-BoldItalic-ISO exch definefont pop\n"; /******************************************************/ /* */ /* String tablature symbols. */ /* J. Atchley -- 12/10/1999 [JSA] */ /* */ /******************************************************/ /* This draws the full bend up. [JSA] */ static char def_stringtab[] = "\n/tw_fullbend { %% usage: y1 y2 tw_fullbend\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.75 mul /jsast_delta75 exch def\n" " jsast_delta 0.5 mul /jsast_delta50 exch def\n" " jsast_delta 0.25 mul /jsast_delta25 exch def\n" " gsave .5 setlinewidth\n" /* draw the curve */ " x jsast_delta25 sub jsast_y1 jsast_delta25 sub moveto\n" " x jsast_delta75 add jsast_y1 jsast_delta25 sub " " x jsast_delta75 add jsast_y1 " " x jsast_delta add jsast_y1 jsast_delta75 add curveto stroke\n" " grestore\n" " } bind def\n" /* This draws the full release . [JSA] */ "\n/tw_fullrelease { %% usage: y1 y2 tw_fullrelease\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.75 mul /jsast_delta75 exch def\n" " jsast_delta 0.5 mul /jsast_delta50 exch def\n" " jsast_delta 0.25 mul /jsast_delta25 exch def\n" " gsave .5 setlinewidth\n" /* draw the curve */ " x jsast_delta25 add jsast_y1 jsast_delta25 sub moveto\n" " x jsast_delta75 sub jsast_y1 jsast_delta25 sub " " x jsast_delta75 sub jsast_y1 " " x jsast_delta sub jsast_y1 jsast_delta75 add curveto stroke\n" " grestore\n" " } bind def\n" /* This draws the half bend. [JSA] */ "\n/tw_halfbend { %% usage: y1 y2 tw_halfbend\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.75 mul /jsast_delta75 exch def\n" " jsast_delta 0.5 mul /jsast_delta50 exch def\n" " jsast_delta 0.25 mul /jsast_delta25 exch def\n" " gsave .5 setlinewidth\n" " /Helvetica jsast_delta selectfont\n" /* draw the curve */ " x jsast_delta25 sub jsast_y1 jsast_delta25 sub moveto\n" " x jsast_delta75 add jsast_y1 jsast_delta25 sub " " x jsast_delta75 add jsast_y1 " " x jsast_delta add jsast_y1 jsast_delta75 add curveto stroke\n" /* draw the "1" numerator */ " x jsast_delta50 add jsast_y2 jsast_delta75 sub moveto (1) cshow\n" /* draw the "2" denominator */ " x jsast_delta add jsast_delta25 add jsast_y1 jsast_delta50 sub moveto (2) cshow\n" " grestore\n" " } bind def\n" /* This draws the half release . [JSA] */ "\n/tw_halfrelease { %% usage: y1 y2 tw_halfrelease\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.75 mul /jsast_delta75 exch def\n" " jsast_delta 0.5 mul /jsast_delta50 exch def\n" " jsast_delta 0.25 mul /jsast_delta25 exch def\n" " gsave .5 setlinewidth\n" " /Helvetica jsast_delta selectfont\n" /* draw the curve */ " x jsast_delta25 add jsast_y1 jsast_delta25 sub moveto\n" " x jsast_delta75 sub jsast_y1 jsast_delta25 sub " " x jsast_delta75 sub jsast_y1 " " x jsast_delta sub jsast_y1 jsast_delta75 add curveto stroke\n" /* draw the "2" denominator */ " x jsast_delta25 sub jsast_y1 moveto (2) cshow\n" /* draw the "1" numerator */ " x jsast_delta sub jsast_delta25 sub jsast_y1 moveto (1) cshow\n" " grestore\n" " } bind def\n" /* This draws the slide up to. [JSA] */ "\n/tw_slideupto { %% usage: y1 y2 fret tw_slideupto\n" " /jsast_txt exch def\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.75 mul /jsast_delta75 exch def\n" " jsast_delta 0.5 mul /jsast_delta50 exch def\n" " jsast_delta 0.25 mul /jsast_delta25 exch def\n" " gsave .5 setlinewidth\n" " /Helvetica jsast_delta selectfont\n" /* draw the line */ " x jsast_delta50 sub jsast_y1 jsast_delta25 sub moveto\n" " jsast_delta75 jsast_delta50 rlineto stroke\n" /* draw fret number */ " x jsast_delta25 add jsast_y2 jsast_delta75 sub moveto jsast_txt show\n" " grestore\n" " } bind def\n" /* This draws the slide down to. [JSA] */ "\n/tw_slidedownto { %% usage: y1 y2 fret tw_slidedownto\n" " /jsast_txt exch def\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.75 mul /jsast_delta75 exch def\n" " jsast_delta 0.5 mul /jsast_delta50 exch def\n" " jsast_delta 0.25 mul /jsast_delta25 exch def\n" " jsast_delta 0.35 mul /jsast_delta35 exch def\n" " gsave .5 setlinewidth\n" " /Helvetica jsast_delta selectfont\n" /* draw the line */ " x jsast_delta50 sub jsast_y2 jsast_delta75 sub moveto\n" " jsast_delta75 0 jsast_delta50 sub rlineto stroke\n" /* draw fret number */ " x jsast_delta35 add jsast_y1 jsast_delta75 sub moveto jsast_txt show\n" " grestore\n" " } bind def\n" /* This draws the slide up from. [JSA] */ "\n/tw_slideupfrom { %% usage: y1 y2 fret tw_slideupfrom\n" " /jsast_txt exch def\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.75 mul /jsast_delta75 exch def\n" " jsast_delta 0.5 mul /jsast_delta50 exch def\n" " jsast_delta 0.65 mul /jsast_delta65 exch def\n" " jsast_delta 0.25 mul /jsast_delta25 exch def\n" " gsave .5 setlinewidth\n" " /Helvetica jsast_delta selectfont\n" /* draw the line */ " x jsast_delta65 sub jsast_y1 jsast_delta50 sub moveto\n" " jsast_delta75 jsast_delta50 rlineto stroke\n" /* draw fret number */ " x jsast_delta75 sub jsast_y1 jsast_delta75 sub moveto jsast_txt lshow\n" " grestore\n" " } bind def\n" /* This draws the slide down from. [JSA] */ "\n/tw_slidedownfrom { %% usage: y1 y2 fret tw_slidedownfrom\n" " /jsast_txt exch def\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.75 mul /jsast_delta75 exch def\n" " jsast_delta 0.5 mul /jsast_delta50 exch def\n" " jsast_delta 0.65 mul /jsast_delta65 exch def\n" " jsast_delta 0.25 mul /jsast_delta25 exch def\n" " gsave .5 setlinewidth\n" " /Helvetica jsast_delta selectfont\n" /* draw the line */ " x jsast_delta65 sub jsast_y2 jsast_delta75 sub moveto\n" " jsast_delta75 0 jsast_delta50 sub rlineto stroke\n" /* draw fret number */ " x jsast_delta75 sub jsast_y2 jsast_delta sub moveto jsast_txt lshow\n" " grestore\n" " } bind def\n" /* This draws the hammer on. [JSA] */ "\n/tw_hammer { %% usage: y1 y2 tw_hammer\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " gsave .5 setlinewidth\n" " /Helvetica jsast_delta selectfont\n" " x jsast_y1 moveto (H) cshow\n" " grestore\n" " } bind def\n" /* This draws the pull off. [JSA] */ "\n/tw_pull { %% usage: y1 y2 tw_pull\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " gsave .5 setlinewidth\n" " /Helvetica jsast_delta selectfont\n" " x jsast_y1 moveto (P) cshow\n" " grestore\n" " } bind def\n" /* This draws the vibrato. [JSA] */ "\n/tw_trill { %% usage: y1 y2 tw_trill\n" " /jsast_y2 exch def\n" " /jsast_y1 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.9 mul jsast_y1 add /jsast_y2 exch def\n" " jsast_y2 jsast_y1 sub /jsast_delta exch def\n" " jsast_delta 0.15 mul /jsast_delta10 exch def\n" " jsast_delta 0.25 mul /jsast_delta20 exch def\n" " gsave .5 setlinewidth\n" " jsast_delta10 5 mul /jsast_t exch def x jsast_t sub jsast_y1 jsast_delta20 sub moveto\n" " jsast_delta10 4 mul /jsast_t exch def x jsast_t sub jsast_y1 jsast_delta20 sub jsast_delta10 180 0 arc\n" " x jsast_delta10 sub jsast_y1 jsast_delta20 sub moveto\n" " jsast_delta10 2 mul /jsast_t exch def x jsast_t sub jsast_y1 jsast_delta20 sub jsast_delta10 0 180 arc\n" " x jsast_delta10 sub jsast_y1 jsast_delta20 sub moveto\n" " x jsast_y1 jsast_delta20 sub jsast_delta10 180 0 arc\n" " jsast_delta10 3 mul x add jsast_y1 jsast_delta20 sub moveto\n" " jsast_delta10 2 mul x add jsast_y1 jsast_delta20 sub jsast_delta10 0 180 arc\n" " jsast_delta10 3 mul x add jsast_y1 jsast_delta20 sub moveto\n" " jsast_delta10 4 mul x add jsast_y1 jsast_delta20 sub jsast_delta10 180 0 arc\n" " stroke\n" " grestore\n" " } bind def\n"; /******************************************************/ /* */ /* Whistle or Irish flute tablature symbols. */ /* J. Atchley -- 10/06/1999 [JSA] */ /* */ /******************************************************/ /* Each of the three means of drawing a hole (open, half, or filled) */ /* first does a relative move up from the current position. [JSA] */ static char def_tw_o[] = "\n/tw_o { %% usage: tw_o - draws open hole\n" " jsatw_y 7 add /jsatw_y exch def\n" " x 3 add jsatw_y moveto x jsatw_y 3 0 360 arc stroke\n" " } bind def\n"; static char def_tw_h[] = "\n/tw_h { %% usage: tw_h - draws half-open hole\n" " jsatw_y 7 add /jsatw_y exch def\n" " x jsatw_y 3 add moveto x jsatw_y 3 90 270 arc fill\n" " x jsatw_y -3 add moveto x jsatw_y 3 270 90 arc stroke\n" " } bind def\n"; static char def_tw_f[] = "\n/tw_f { %% usage: tw_f - draws closed hole\n" " jsatw_y 7 add /jsatw_y exch def\n" " x 3 add jsatw_y moveto x jsatw_y 3 0 360 arc fill\n" " } bind def\n"; /* This draws the "+" for the overblown second octave.[JSA] */ static char def_tw_2[] = "\n/tw_2 { %% usage: tw_2 - draws + for second octave\n" " gsave\n" " x jsatw_y -3 add moveto 0 6 rlineto -3 -3 rmoveto 6 0 rlineto stroke" " grestore\n" " } bind def\n" /* This draws the "++" for the overblown third octave.[JSA] */ "\n/tw_3 { %% usage: tw_3 - draws ++ for third octave\n" " gsave\n" " x -1.5 add jsatw_y -1.5 add moveto 0 3 rlineto\n" " x 1.5 add jsatw_y -1.5 add moveto 0 3 rlineto\n" " x -3 add jsatw_y moveto 6 0 rlineto stroke\n" " grestore\n" " } bind def\n" /* This draws the down arrow for octaves too low. [JSA] */ "\n/tw_under { %% usage: y tw_under - draws down arrow for octave too low\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " x jsatw_y 49 add moveto 0 -3 rmoveto\n" " -2.5 2.5 rlineto 2.5 -2.5 rmoveto\n" " 2.5 2.5 rlineto -2.5 -2.5 rmoveto\n" " 0 6 rlineto stroke\n" " grestore\n" " } bind def\n" /* This draws the up arrow for octaves too high. [JSA] */ "\n/tw_over { %% usage: y tw_over - draws up arrow for octave too high\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " x jsatw_y 49 add moveto 0 3 rmoveto\n" " -2.5 -2.5 rlineto 2.5 2.5 rmoveto\n" " 2.5 -2.5 rlineto -2.5 2.5 rmoveto\n" " 0 -6 rlineto stroke\n" " grestore\n" " } bind def\n"; /* Each of these draws a set of six fingerholes [JSA] */ static char def_tw_sixholes[] = "\n/tw_00 { %% usage: y tw_00\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_o tw_o tw_o tw_o tw_o\n" " grestore\n" " } bind def\n" "\n/tw_05 { %% usage: y tw_05\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_o tw_o tw_f tw_f tw_o\n" " grestore\n" " } bind def\n" "\n/tw_10 { %% usage: y tw_10\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_o tw_o tw_o tw_o tw_f\n" " grestore\n" " } bind def\n" "\n/tw_15 { %% usage: y tw_15\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_o tw_o tw_o tw_h tw_f\n" " grestore\n" " } bind def\n" "\n/tw_20 { %% usage: y tw_20\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_o tw_o tw_o tw_f tw_f\n" " grestore\n" " } bind def\n" "\n/tw_25 { %% usage: y tw_25\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_o tw_o tw_h tw_f tw_f\n" " grestore\n" " } bind def\n" "\n/tw_30 { %% usage: y tw_30\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_o tw_o tw_f tw_f tw_f\n" " grestore\n" " } bind def\n" "\n/tw_35 { %% usage: y tw_35\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_o tw_h tw_f tw_f tw_f\n" " grestore\n" " } bind def\n" "\n/tw_40 { %% usage: y tw_40\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_o tw_f tw_f tw_f tw_f\n" " grestore\n" " } bind def\n" "\n/tw_45 { %% usage: y tw_45\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_h tw_f tw_f tw_f tw_f\n" " grestore\n" " } bind def\n" "\n/tw_50 { %% usage: y tw_50\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_o tw_f tw_f tw_f tw_f tw_f\n" " grestore\n" " } bind def\n" "\n/tw_55 { %% usage: y tw_55\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_h tw_f tw_f tw_f tw_f tw_f\n" " grestore\n" " } bind def\n" "\n/tw_60 { %% usage: y tw_60\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_f tw_f tw_f tw_f tw_f tw_f\n" " grestore\n" " } bind def\n" "\n/tw_002 { %% usage: y tw_002\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_00\n" " grestore\n" " } bind def\n" "\n/tw_052 { %% usage: y tw_052\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_05\n" " grestore\n" " } bind def\n" "\n/tw_102 { %% usage: y tw_102\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_10\n" " grestore\n" " } bind def\n" "\n/tw_152 { %% usage: y tw_152\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_15\n" " grestore\n" " } bind def\n" "\n/tw_202 { %% usage: y tw_202\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_20\n" " grestore\n" " } bind def\n" "\n/tw_252 { %% usage: y tw_252\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_25\n" " grestore\n" " } bind def\n" "\n/tw_302 { %% usage: y tw_302\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_30\n" " grestore\n" " } bind def\n" "\n/tw_352 { %% usage: y tw_352\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_35\n" " grestore\n" " } bind def\n" "\n/tw_402 { %% usage: y tw_402\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_40\n" " grestore\n" " } bind def\n" "\n/tw_452 { %% usage: y tw_452\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_45\n" " grestore\n" " } bind def\n" "\n/tw_502 { %% usage: y tw_502\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_50\n" " grestore\n" " } bind def\n" "\n/tw_552 { %% usage: y tw_552\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 jsatw_y tw_55\n" " grestore\n" " } bind def\n" "\n/tw_602 { %% usage: y tw_602\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_2 tw_f tw_f tw_f tw_f tw_f tw_o\n" " grestore\n" " } bind def\n" "\n/tw_003 { %% usage: y tw_003\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_00\n" " grestore\n" " } bind def\n" "\n/tw_053 { %% usage: y tw_053\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_05\n" " grestore\n" " } bind def\n" "\n/tw_103 { %% usage: y tw_103\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_10\n" " grestore\n" " } bind def\n" "\n/tw_153 { %% usage: y tw_153\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_15\n" " grestore\n" " } bind def\n" "\n/tw_203 { %% usage: y tw_203\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_20\n" " grestore\n" " } bind def\n" "\n/tw_253 { %% usage: y tw_253\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_25\n" " grestore\n" " } bind def\n" "\n/tw_303 { %% usage: y tw_303\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_30\n" " grestore\n" " } bind def\n" "\n/tw_353 { %% usage: y tw_353\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_35\n" " grestore\n" " } bind def\n" "\n/tw_403 { %% usage: y tw_403\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_40\n" " grestore\n" " } bind def\n" "\n/tw_453 { %% usage: y tw_453\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_45\n" " grestore\n" " } bind def\n" "\n/tw_503 { %% usage: y tw_503\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_50\n" " grestore\n" " } bind def\n" "\n/tw_553 { %% usage: y tw_553\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_55\n" " grestore\n" " } bind def\n" "\n/tw_603 { %% usage: y tw_603\n" " /jsatw_y exch def\n" " gsave .5 setlinewidth\n" " tw_3 jsatw_y tw_60\n" " grestore\n" " } bind def\n"; /******************************************************/ /* */ /* Additional Standard Symbols [JSA] 05/00 */ /* */ /******************************************************/ static char def_jsa_std_sym[] = "\n/segno { %% usage: x y segno\n" " /jsay exch def /jsax exch def\n" " /Times-BoldItalic 9 selectfont\n" " jsax jsay moveto 45 rotate 0 4 rmoveto (S) cshow -45 rotate\n" " jsax jsay moveto 45 rotate 0 -4 rmoveto(S) cshow -45 rotate\n" " jsax jsay moveto 45 rotate -6 3 rmoveto 12 0 rlineto stroke -45 rotate\n" "} bind def\n" "\n/coda { %%usage: x y coda\n" " /jsay exch def /jsax exch def\n" " jsax 6 add jsay moveto jsax jsay 6 0 360 arc stroke\n" " jsax jsay moveto 0 8 rmoveto 0 -16 rlineto stroke\n" " jsax jsay moveto -8 0 rmoveto 16 0 rlineto stroke\n" "} bind def\n" "\n/crescendo { %% usage x1 x2 y crescendo\n" " /jsay exch def /jsax2 exch def /jsax exch def\n" " gsave\n" " 0.5 setlinewidth\n" " jsax jsay moveto jsax2 jsay 4 add lineto stroke\n" " jsax jsay moveto jsax2 jsay -4 add lineto stroke\n" " grestore\n" "} bind def\n" "\n/diminuendo { %% usage x1 x2 y diminuendo\n" " /jsay exch def /jsax2 exch def /jsax exch def\n" " gsave\n" " 0.5 setlinewidth\n" " jsax2 jsay moveto jsax jsay 4 add lineto stroke\n" " jsax2 jsay moveto jsax jsay -4 add lineto stroke\n" " grestore\n" "} bind def\n" "\n/accent { %% usage: x y accent - accent (loud) mark\n" " /jsay exch def /jsax exch def\n" " gsave\n" " 0.9 setlinewidth\n" " jsax -5 add jsay moveto jsax 10 add jsay 3 add lineto stroke\n" " jsax -5 add jsay moveto jsax 10 add jsay -3 add lineto stroke\n" " grestore\n" "} bind def\n"; /******************************************************/ /* */ /* Original symbols from abcm2ps, v. 0.9.5, 8/31/1998 */ /* */ /******************************************************/ static char def_misc[] = "\n/cshow { %% usage: string cshow - center at current pt\n" " dup stringwidth pop 2 div neg 0 rmoveto\n" " currentpoint pop dup 0 lt {neg 0 rmoveto} {pop} ifelse\n" " show\n" "} bind def\n" "\n/lshow { %% usage: string lshow - show left-aligned\n" " dup stringwidth pop neg 0 rmoveto show\n" "} bind def\n" "\n/wd { moveto show } bind def\n" "/wln {\n" "dup 3 1 roll moveto gsave 0.6 setlinewidth lineto stroke grestore\n" "} bind def\n" "/whf {moveto gsave 0.5 1.2 scale (-) show grestore} bind def\n"; static char def_typeset[] = "\n/WS { %%usage: w nspaces str WS\n" " dup stringwidth pop 4 -1 roll\n" " sub neg 3 -1 roll div 0 8#040 4 -1 roll\n" " widthshow\n" "} bind def\n" "\n/W1 { show pop pop } bind def\n" "\n/str 50 string def\n" "/W0 {\n" " dup stringwidth pop str cvs exch show ( ) show show pop pop\n" "} bind def\n" "\n/WC { counttomark 1 sub dup 0 eq { 0 }\n" " { ( ) stringwidth pop neg 0 3 -1 roll\n" " { dup 3 add index stringwidth pop ( ) stringwidth pop add\n" " dup 3 index add 4 index lt 2 index 1 lt or\n" " {3 -1 roll add exch 1 add} {pop exit} ifelse\n" " } repeat } ifelse\n" "} bind def\n" "\n/P1 {\n" " { WC dup 0 le {exit} if\n" " exch pop gsave { exch show ( ) show } repeat grestore LF\n" " } loop pop pop pop pop\n" "} bind def\n" "\n/P2 {\n" " { WC dup 0 le {exit} if\n" " dup 1 sub dup 0 eq\n" " { pop exch pop 0.0 }\n" " { 3 2 roll 3 index exch sub exch div } ifelse\n" " counttomark 3 sub 2 index eq { pop 0 } if exch gsave\n" " { 3 2 roll show ( ) show dup 0 rmoveto } repeat\n" " grestore LF pop\n" " } loop pop pop pop pop\n" "} bind def\n"; static char def_tsig[] = "\n/tsig { %% usage: x y (top) (bot) tsig -- draw time signature\n" " 4 2 roll moveto\n" " gsave /Times-Bold 16 selectfont 1.2 1 scale\n" " 0 1.0 rmoveto currentpoint 3 -1 roll cshow\n" " moveto 0 12 rmoveto cshow grestore\n" "} bind def\n"; static char def_dot[] = "\n/dt { %% usage: dx dy dt - dot shifted by dx,dy\n" " y add exch x add exch 1.2 0 360 arc fill\n" "} bind def\n"; static char def_hl[] = "\n/hl { %% usage: y hl - helper line at height y\n" " gsave 1 setlinewidth x exch moveto \n" " -5.5 0 rmoveto 11 0 rlineto stroke grestore\n" "} bind def\n" "\n/hl1 { %% usage: y hl1 - longer helper line\n" " gsave 1 setlinewidth x exch moveto \n" " -7 0 rmoveto 14 0 rlineto stroke grestore\n" "} bind def\n"; static char def_beam[] = "\n/bm { %% usage: x1 y1 x2 y2 t bm - beam, depth t\n" " 3 1 roll moveto dup 0 exch neg rlineto\n" " dup 4 1 roll sub lineto 0 exch rlineto fill\n" "} bind def\n" "\n/bnum { %% usage: x y (str) bnum - number on beam\n" " 3 1 roll moveto gsave /Times-Italic 12 selectfont\n" " cshow grestore\n" "} bind def\n" "\n/hbr { %% usage: x1 y1 x2 y2 hbr - half bracket\n" " moveto lineto 0 -3 rlineto stroke\n" "} bind def\n"; static char def_bars[] = "\n/bar { %% usage: h x y bar - single bar\n" " moveto 0 exch rlineto stroke\n" "} bind def\n" "\n/dbar { %% usage: h x y dbar - thin double bar\n" " moveto dup 0 exch rlineto dup -3 exch neg rmoveto\n" " 0 exch rlineto stroke\n" "} bind def\n" "\n/fbar1 { %% usage: h x y fbar1 - fat double bar at start\n" " moveto dup 0 exch rlineto 3 0 rlineto dup 0 exch neg rlineto \n" " currentpoint fill moveto\n" " 3 0 rmoveto 0 exch rlineto stroke\n" "} bind def\n" "\n/fbar2 { %% usage: h x y fbar2 - fat double bar at end\n" " moveto dup 0 exch rlineto -3 0 rlineto dup 0 exch neg rlineto \n" " currentpoint fill moveto\n" " -3 0 rmoveto 0 exch rlineto stroke\n" "} bind def\n" "\n/rdots { %% usage: x y rdots - repeat dots \n" " moveto 0 9 rmoveto currentpoint 2 copy 1.2 0 360 arc \n" " moveto 0 6 rmoveto currentpoint 1.2 0 360 arc fill\n" "} bind def\n"; static char def_gchord[] = "\n/gc { %% usage: x y (str) gc -- draw guitar chord string\n" " 3 1 roll moveto show\n" "} bind def\n"; static char def_staff[] = "\n/staff { %% usage: l staff - draw staff\n" " gsave 0.5 setlinewidth\n" " dup 0 rlineto dup neg 6 rmoveto\n" " dup 0 rlineto dup neg 6 rmoveto\n" " dup 0 rlineto dup neg 6 rmoveto\n" " dup 0 rlineto dup neg 6 rmoveto\n" " dup 0 rlineto dup neg 6 rmoveto\n" " pop stroke grestore\n" "} bind def\n" "\n/hbrce {\n" " -3 -2 rmoveto\n" " -3.65 -3.3 -4.97 -7.44 -4.97 -12.39 rcurveto\n" " 0.0 -4.95 0.48 -10.56 1.44 -16.84 rcurveto\n" " 0.96 -6.28 1.44 -10.4 1.44 -12.38 rcurveto\n" " 0.0 -1.98 -0.6 -3.63 -1.8 -4.96 rcurveto\n" " -1.2 -1.32 -0.96 -0.99 0.72 1.0 rcurveto\n" " 1.69 1.98 2.65 5.44 2.89 10.4 rcurveto\n" " 0.24 4.95 -0.24 9.74 -1.45 14.36 rcurveto\n" " -1.2 4.63 -1.8 8.59 -1.8 11.89 rcurveto\n" " 0.0 3.3 1.08 6.44 3.25 9.41 rcurveto\n" " 2.17 2.97 1.92 2.81 -0.72 -0.49 rcurveto\n" " fill\n" "} bind def\n" "\n/brace { %%usage h x y brace\n" " gsave translate 0 0 moveto 98 div 1.05 exch scale hbrce\n" " 0 -98 moveto 1 -1 scale hbrce grestore\n" "} bind def\n" "\n/bracket { %%usage h x y braket\n" " 3 copy 3 -1 roll sub moveto -4 0 rlineto stroke\n" " 2 copy moveto -4 0 rlineto stroke exch 4 sub exch moveto\n" " dup 0 exch neg rlineto -3 0 rlineto 0 exch rlineto\n" " fill\n" "} bind def\n"; static char def_sep[] = "\n/sep0 { %% usage: x1 x2 sep0 - hline separator \n" " 0 moveto 0 lineto stroke\n" "} bind def\n"; /* ----- define_font ------- */ void define_font(FILE *fp, char name[], int num) { if (!strcmp(name,"Symbol")) { fprintf(fp, "/F%d { /%s exch selectfont } bind def\n", num, name); return; } fprintf(fp, "\n/%s findfont\n" "dup length dict begin\n" " {1 index /FID ne {def} {pop pop} ifelse} forall\n" " /Encoding ISOLatin1Encoding def\n" " currentdict\n" "end\n" "/%s-ISO exch definefont pop\n", name, name); fprintf(fp, "/F%d { /%s-ISO exch selectfont } bind def\n", num, name); } /* ----- add_cv ------- */ static void add_cv(FILE *fp, float f1, float f2, float p[][2], int i0, int ncv) { int i,i1,m; i1=i0; for (m=0; m>\n"); fprintf(fp, "matrix\n"); fprintf(fp, "makepattern\n"); fprintf(fp, "/JsaWatermark exch def\n"); } /* ----- define_symbols: write postscript macros to file ------ */ void define_symbols(FILE *fp, char *Watermark, float Gray) { fprintf(fp, def_segno_font); fprintf(fp, def_tw_o); fprintf(fp, def_tw_h); fprintf(fp, def_tw_f); fprintf(fp, def_tw_2); fprintf(fp, def_tw_sixholes); fprintf(fp, def_misc); fprintf(fp, def_stringtab); fprintf(fp, def_jsa_std_sym); def_tclef(fp); def_bclef(fp); def_cclef(fp); def_hd1(fp); def_hd2(fp); def_hd3(fp); def_stems(fp); fprintf(fp, def_beam); def_sl(fp); fprintf(fp, def_dot); def_deco(fp); def_deco1(fp); fprintf(fp, def_hl); def_flags1(fp); def_flags2(fp); def_xflags(fp); def_acc(fp); fprintf(fp, def_gchord); def_rests(fp); fprintf(fp, def_bars); def_ends(fp); def_gnote(fp); def_csg(fp); fprintf(fp, def_sep); fprintf(fp, def_tsig); fprintf(fp, def_staff); fprintf(fp, def_typeset); DefWatermark(fp, Watermark, Gray); }