/* **** prologue_ps **** /* this program was automatically generated by EMBED_PS.EXE. */ /* you should probably not edit it */ #include void prologue_ps(FILE *ofp) { fprintf(ofp,"%%!PS-Adobe\n"); fprintf(ofp,"%% This program prints cassette covers in a variety of formats\n"); fprintf(ofp,"%%%%Pages: (at end)\n"); fprintf(ofp,"%%%%EndComments\n"); fprintf(ofp,"%%%%BeginProlog\n"); fprintf(ofp,"%%%%%%\n"); fprintf(ofp,"%%%%%%\n"); fprintf(ofp,"%%%%%% This program provides a set of functions that will generate\n"); fprintf(ofp,"%%%%%% covers for cassette or DAT tapes.\n"); fprintf(ofp,"%%%%%%\n"); fprintf(ofp,"%%%%%% It may be used as a prologue for a postscript program that\n"); fprintf(ofp,"%%%%%% references these functions.\n"); fprintf(ofp,"%%%%%%\n"); fprintf(ofp,"%%%%%% Another way to use this program, however, is with the C program\n"); fprintf(ofp,"%%%%%% pscover, which provides a user-friendly front end that can be used\n"); fprintf(ofp,"%%%%%% by people who are not familiar with programming and/or PostScript.\n"); fprintf(ofp,"%%%%%%\n"); fprintf(ofp,"%%%%%% To use with the pscover program, use embed_ps to convert this\n"); fprintf(ofp,"%%%%%% file to cass.c. Then compile cass.c and link it with the other\n"); fprintf(ofp,"%%%%%% source files for pscover. This package should contain a makefile\n"); fprintf(ofp,"%%%%%% to assist you in this operation.\n"); fprintf(ofp,"%%%%%%\n"); fprintf(ofp,"%%%%%% Change History\n"); fprintf(ofp,"%%%%%%\n"); fprintf(ofp,"%%%%%% 1.0 Initial release\n"); fprintf(ofp,"%%%%%%\n"); fprintf(ofp,"%%%%%% 1.1 Added code to handle DAT covers, thanks to Brian Redman\n"); fprintf(ofp,"%%%%%% (ber@bellcore.com)\n"); fprintf(ofp,"%%%%%%\n"); fprintf(ofp,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); fprintf(ofp,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); fprintf(ofp,"%%%%%%%% define constants\n"); fprintf(ofp,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); fprintf(ofp,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); fprintf(ofp,"\n"); fprintf(ofp,"/inch { 72 mul } def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/FirstCass true def %% first cassette\n"); fprintf(ofp,"/PageNo 0 def %% number of pages\n"); fprintf(ofp,"/CassType 1 def %% cassette cover type\n"); fprintf(ofp,"/DatType 2 def %% DAT cover type\n"); fprintf(ofp,"/UndefType 0 def %% undefined cover\n"); fprintf(ofp,"/CovType /UndefType def %% no cover type yet\n"); fprintf(ofp,"\n"); fprintf(ofp,"%% font definitions\n"); fprintf(ofp,"\n"); fprintf(ofp,"/TitleFont /Helvetica def\n"); fprintf(ofp,"/TitleSize 12 def\n"); fprintf(ofp,"/ArtistFont /Helvetica-Bold def\n"); fprintf(ofp,"/ArtistSize 12 def\n"); fprintf(ofp,"/TabFont /Helvetica-Narrow def\n"); fprintf(ofp,"/TabSize 10 def\n"); fprintf(ofp,"/SongFont /Palatino-Bold def\n"); fprintf(ofp,"/SongSize 8 def\n"); fprintf(ofp,"/DateFont /Times-Bold def\n"); fprintf(ofp,"/DateSize 10 def\n"); fprintf(ofp,"/NoiseFont /Times-Bold def\n"); fprintf(ofp,"/NoiseSize 10 def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/TextUp { 5 } def %% offset for text\n"); fprintf(ofp,"/WordBreak ( ) def %% word break string (space)\n"); fprintf(ofp,"/INDENT 10 def %% indentation for new lines\n"); fprintf(ofp,"\n"); fprintf(ofp,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); fprintf(ofp,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); fprintf(ofp,"%%%%%%%% Define functions\n"); fprintf(ofp,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); fprintf(ofp,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); fprintf(ofp,"\n"); fprintf(ofp,"/CassCover %% no arguments\n"); fprintf(ofp,"{ %% define shape of cassette cover\n"); fprintf(ofp," /CovType CassType def %% this is a cassette cover type\n"); fprintf(ofp," /StartXL { 1 inch } def %% where to start left cover\n"); fprintf(ofp," /StartXC { 5 inch } def %% where to start center cover (not used)\n"); fprintf(ofp," /StartXR { 5 inch } def %% where to start right cover\n"); fprintf(ofp," /StartYL { 10 inch } def %% where to start left cover\n"); fprintf(ofp," /StartYC { 0 } def %% where to start center cover (not used)\n"); fprintf(ofp," /StartYR { 0 } def %% where to start right cover\n"); fprintf(ofp," /LeftMarg { 0 } def %% left margin\n"); fprintf(ofp," /BottMarg { 0 } def %% bottom of cover\n"); fprintf(ofp," /MidHoriz { 2 inch } def %% middle of cover (horizontally)\n"); fprintf(ofp," /RightMarg { 4 inch } def %% right margin\n"); fprintf(ofp," /TopMarg { 6.30 inch } def %% top of cover\n"); fprintf(ofp," /TopTitle { 5.65 inch } def %% top of title bar (fold)\n"); fprintf(ofp," /MidTitle { 5.40 inch } def %% middle of title bar\n"); fprintf(ofp," /BottTitle { 5.15 inch } def %% bottom of title bar (fold)\n"); fprintf(ofp," /BottTab { 4.85 inch } def %% bottom of tab\n"); fprintf(ofp," /MidVert { 2.525 inch } def %% fold point for songs\n"); fprintf(ofp," /Corner { .25 inch } def %% size of corner slice\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/DatCover %% no arguments\n"); fprintf(ofp,"{ %% define shape of cassette cover\n"); fprintf(ofp," /CovType DatType def %% DAT cover type\n"); fprintf(ofp," /StartXL { 1 inch } def %% where to start left cover\n"); fprintf(ofp," /StartXC { 3.5 inch } def %% where to start center cover (not used)\n"); fprintf(ofp," /StartXR { 3.5 inch } def %% where to start right cover\n"); fprintf(ofp," /StartYL { 10.25 inch } def %% where to start left cover\n"); fprintf(ofp," /StartYC { 0 } def %% where to start center cover (not used)\n"); fprintf(ofp," /StartYR { 0 } def %% where to start right cover\n"); fprintf(ofp," /LeftMarg { 0 } def %% left margin\n"); fprintf(ofp," /BottMarg { 0 } def %% bottom of cover\n"); fprintf(ofp," /MidHoriz { 2 inch } def %% middle of cover (horizontally)\n"); fprintf(ofp," /RightMarg { 2.84 inch } def %% right margin\n"); fprintf(ofp," /TopMarg { 5.14 inch } def %% top of cover\n"); fprintf(ofp," /TopTitle { 4.63 inch } def %% top of title bar (fold)\n"); fprintf(ofp," /MidTitle { 4.40 inch } def %% middle of title bar\n"); fprintf(ofp," /BottTitle { 4.15 inch } def %% bottom of title bar (fold)\n"); fprintf(ofp," /BottTab { 4.85 inch } def %% bottom of tab\n"); fprintf(ofp," /MidVert { 2.00 inch } def %% fold point for songs\n"); fprintf(ofp," /Corner { .50 inch } def %% size of corner slice\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"%% draw overall box shape\n"); fprintf(ofp,"/DrawShape %% no args\n"); fprintf(ofp,"{ %% draw overall shape of cover\n"); fprintf(ofp," gsave\n"); fprintf(ofp," %% print colored box for top flap\n"); fprintf(ofp," newpath\n"); fprintf(ofp," LeftMarg TopTitle moveto\n"); fprintf(ofp," RightMarg TopTitle lineto\n"); fprintf(ofp," RightMarg TopMarg Corner sub lineto\n"); fprintf(ofp," RightMarg Corner sub TopMarg lineto\n"); fprintf(ofp," LeftMarg Corner add TopMarg lineto\n"); fprintf(ofp," LeftMarg TopMarg Corner sub lineto\n"); fprintf(ofp," closepath\n"); fprintf(ofp," .8 setgray fill 0 setgray %% color in flap\n"); fprintf(ofp,"\n"); fprintf(ofp," %% print general outline\n"); fprintf(ofp," newpath\n"); fprintf(ofp," 2 setlinewidth\n"); fprintf(ofp," LeftMarg BottMarg moveto\n"); fprintf(ofp," RightMarg BottMarg lineto\n"); fprintf(ofp," RightMarg TopMarg Corner sub lineto\n"); fprintf(ofp," RightMarg Corner sub TopMarg lineto\n"); fprintf(ofp," LeftMarg Corner add TopMarg lineto\n"); fprintf(ofp," LeftMarg TopMarg Corner sub lineto\n"); fprintf(ofp," closepath\n"); fprintf(ofp," %% print title box and middle fold line\n"); fprintf(ofp," LeftMarg TopTitle moveto %% top of title box\n"); fprintf(ofp," RightMarg TopTitle lineto\n"); fprintf(ofp," LeftMarg BottTitle moveto %% bottom of title box\n"); fprintf(ofp," RightMarg BottTitle lineto\n"); fprintf(ofp," LeftMarg MidVert moveto %% fold along middle of songs\n"); fprintf(ofp," RightMarg MidVert lineto\n"); fprintf(ofp," stroke\n"); fprintf(ofp," %% print dotted lines for tab & middle column\n"); fprintf(ofp," .3 setlinewidth\n"); fprintf(ofp," [ .3 1 ] 5 setdash\n"); fprintf(ofp," LeftMarg BottTab RightMarg BottTab DashLine\n"); fprintf(ofp," stroke\n"); fprintf(ofp," grestore\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/DashLine %% begx begy endx endy\n"); fprintf(ofp,"{ %% draw dotted line\n"); fprintf(ofp," gsave\n"); fprintf(ofp," .3 setlinewidth\n"); fprintf(ofp," [ .3 1 ] 5 setdash\n"); fprintf(ofp," moveto\n"); fprintf(ofp," lineto\n"); fprintf(ofp," stroke\n"); fprintf(ofp," grestore\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/NewFont %% FontName FontSize\n"); fprintf(ofp,"{\n"); fprintf(ofp," /PS exch def\n"); fprintf(ofp," /FontName exch def\n"); fprintf(ofp," FontName findfont PS scalefont setfont %% initialize font\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/NewLine\n"); fprintf(ofp,"{ %% go to next line at the left margin\n"); fprintf(ofp," currentpoint PS 1.33 mul sub exch pop LM exch moveto\n"); fprintf(ofp," CheckFold\n"); fprintf(ofp," INDENT 0 rmoveto\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/OldLine\n"); fprintf(ofp,"{ %% go to next line at the left margin\n"); fprintf(ofp," currentpoint PS 1.33 mul add exch pop LM exch moveto\n"); fprintf(ofp," BackFold\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/GoLeft\n"); fprintf(ofp,"{ %% go to left margin on current line\n"); fprintf(ofp," currentpoint exch pop LM INDENT add exch moveto\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/GoRight\n"); fprintf(ofp,"{ %% go to right margin on current line\n"); fprintf(ofp," currentpoint exch pop RM exch moveto\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/GoCenter\n"); fprintf(ofp,"{ %% go to center point of current line\n"); fprintf(ofp," GoLeft %% go to left margin\n"); fprintf(ofp," RM LM sub 2 div 0 rmoveto\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/CheckFold\n"); fprintf(ofp,"{ %% check for fold area\n"); fprintf(ofp," /Yloc currentpoint exch pop def %% get Y location\n"); fprintf(ofp," Yloc MidVert lt %% see if in lower half\n"); fprintf(ofp," {\n"); fprintf(ofp," Yloc HotZone gt %% see if on fold\n"); fprintf(ofp," %% skip fold and go to left margin\n"); fprintf(ofp," { NewLine currentpoint exch pop LM exch moveto }\n"); fprintf(ofp," if\n"); fprintf(ofp," }\n"); fprintf(ofp," if\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/BackFold\n"); fprintf(ofp,"{ %% check for backing into the fold area\n"); fprintf(ofp," /Yloc currentpoint exch pop def %% get Y location\n"); fprintf(ofp," Yloc HotZone gt %% see if above hot zone\n"); fprintf(ofp," {\n"); fprintf(ofp," Yloc MidVert lt %% if on fold, go up another line\n"); fprintf(ofp," { OldLine }\n"); fprintf(ofp," if\n"); fprintf(ofp," }\n"); fprintf(ofp," if\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/PrintDate %% date-string\n"); fprintf(ofp,"{ %% print date of recording\n"); fprintf(ofp," /LM LeftMarg def\n"); fprintf(ofp," /RM RightMarg def\n"); fprintf(ofp," LM TopMarg Corner sub moveto NewLine %% position\n"); fprintf(ofp," DateFont DateSize NewFont\n"); fprintf(ofp," (Date: ) show show %% preceed date with label\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/PrintNoise %% noise-string\n"); fprintf(ofp,"{ %% print noise suppression\n"); fprintf(ofp," /LM LeftMarg def\n"); fprintf(ofp," /RM RightMarg def\n"); fprintf(ofp," LM INDENT add TopTitle TextUp add moveto\n"); fprintf(ofp," NoiseFont NoiseSize NewFont\n"); fprintf(ofp," (N.R.) show show\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/ArtistTitle %% title-string artist-string\n"); fprintf(ofp,"{ %% artist title - print title box\n"); fprintf(ofp," /LM LeftMarg def\n"); fprintf(ofp," /RM RightMarg def\n"); fprintf(ofp," PrintTitle\n"); fprintf(ofp," PrintArtist\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/FullArtist %% artist-string\n"); fprintf(ofp,"{ %% string - print artist name in title box\n"); fprintf(ofp," /LM LeftMarg def\n"); fprintf(ofp," /RM RightMarg def\n"); fprintf(ofp," PrintArtist\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/LeftArtist %% artist-string\n"); fprintf(ofp,"{ %% string - print artist name on left side of title\n"); fprintf(ofp," /LM LeftMarg def\n"); fprintf(ofp," /RM MidHoriz def\n"); fprintf(ofp," PrintArtist\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/RightArtist %% artist-string\n"); fprintf(ofp,"{ %% string - print artist name on right side of title\n"); fprintf(ofp," /LM MidHoriz def\n"); fprintf(ofp," /RM RightMarg def\n"); fprintf(ofp," PrintArtist\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/PrintArtist\n"); fprintf(ofp,"{\n"); fprintf(ofp," ArtistFont ArtistSize NewFont\n"); fprintf(ofp," LM TopTitle PS 1.2 mul sub moveto\n"); fprintf(ofp," CenterLine\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/FullTitle\n"); fprintf(ofp,"{ %% string - print title centered across entire cover\n"); fprintf(ofp," /LM LeftMarg def\n"); fprintf(ofp," /RM RightMarg def\n"); fprintf(ofp," PrintTitle\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/LeftTitle\n"); fprintf(ofp,"{ %% string - print title on left half of title box\n"); fprintf(ofp," /LM LeftMarg def\n"); fprintf(ofp," /RM MidHoriz def\n"); fprintf(ofp," PrintTitle\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/RightTitle\n"); fprintf(ofp,"{ %% string - print title on right half of title box\n"); fprintf(ofp," /LM MidHoriz def\n"); fprintf(ofp," /RM RightMarg def\n"); fprintf(ofp," PrintTitle\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/PrintTitle %% title string\n"); fprintf(ofp,"{ %% string - print title in bottom of title box\n"); fprintf(ofp," TitleFont TitleSize NewFont\n"); fprintf(ofp," LM BottTitle TextUp add moveto\n"); fprintf(ofp," CenterLine\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/FullTab %% tab-string\n"); fprintf(ofp,"{ %% print text on one tab\n"); fprintf(ofp," /LM LeftMarg def\n"); fprintf(ofp," /RM RightMarg def %% left & right margins\n"); fprintf(ofp," PrintTab\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/LeftTab %% left-tab-string\n"); fprintf(ofp,"{ %% print left tab\n"); fprintf(ofp," MidHoriz BottTitle MidHoriz BottTab DashLine\n"); fprintf(ofp," /LM LeftMarg def\n"); fprintf(ofp," /RM MidHoriz def\n"); fprintf(ofp," PrintTab\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/RightTab %% right-tab-string\n"); fprintf(ofp,"{ %% print left tab\n"); fprintf(ofp," /LM MidHoriz def\n"); fprintf(ofp," /RM RightMarg def\n"); fprintf(ofp," PrintTab\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/PrintTab %% tab-string\n"); fprintf(ofp,"{ %% print tab - LM & RM are set up\n"); fprintf(ofp," TabFont TabSize NewFont\n"); fprintf(ofp," LM BottTab TextUp add moveto\n"); fprintf(ofp," CenterLine\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/Songs %% no arguments\n"); fprintf(ofp,"{ %% starting songs - set up things\n"); fprintf(ofp," SongFont SongSize NewFont\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/LeftSide %% no arguments\n"); fprintf(ofp,"{ %% array_of_strings - print strings as songs\n"); fprintf(ofp," %% draw a line down the middle of the tab space\n"); fprintf(ofp," MidHoriz BottMarg MidHoriz BottTab DashLine\n"); fprintf(ofp," Songs\n"); fprintf(ofp," /LM LeftMarg def /RM MidHoriz INDENT sub def %% set margins\n"); fprintf(ofp," /HotZone MidVert PS sub def %% skip over fold area\n"); fprintf(ofp," LM BottTab moveto NewLine %% start at line under tab\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/RightSide %% no arguments\n"); fprintf(ofp,"{ %% array of strings - print strings as songs\n"); fprintf(ofp," /LM MidHoriz def /RM RightMarg INDENT sub def %% set margins\n"); fprintf(ofp," /HotZone MidVert PS sub def %% skip over fold area\n"); fprintf(ofp," LM BottTab moveto NewLine %% start at line under tab\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/FullSide %% no arguments\n"); fprintf(ofp,"{ %% array of strings - print strings as songs across entire side\n"); fprintf(ofp," Songs\n"); fprintf(ofp," %% set margins\n"); fprintf(ofp," /LM LeftMarg def /RM RightMarg INDENT sub def\n"); fprintf(ofp," /HotZone MidVert PS sub def %% skip over fold area\n"); fprintf(ofp," LM BottTab moveto NewLine %% start of songs\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/PrintSongs %% array-of-strings\n"); fprintf(ofp,"{ %% array of strings - print strings as songs\n"); fprintf(ofp," SongFont SongSize NewFont\n"); fprintf(ofp," LM BottTab moveto NewLine %% start at line under tab\n"); fprintf(ofp," { LeftSong } forall %% print each song\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/LeftSong %% song-string\n"); fprintf(ofp,"{ %% string - print this song\n"); fprintf(ofp," LeftLine\n"); fprintf(ofp," NewLine\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/CenterLine %% string\n"); fprintf(ofp,"{ %% string - center between LM and RM\n"); fprintf(ofp," GoLeft %% make sure we are the left marging\n"); fprintf(ofp," FitsLine %% see if it will fit on a line\n"); fprintf(ofp," { %% fits - center this line\n"); fprintf(ofp," %% (It fits) show\n"); fprintf(ofp," %% move to left margin\n"); fprintf(ofp," currentpoint exch pop LM exch moveto %% left margin\n"); fprintf(ofp," dup stringwidth pop %% get width of string\n"); fprintf(ofp," LM add RM exch sub 2 div %% how much to move\n"); fprintf(ofp," 0 rmoveto %% move right\n"); fprintf(ofp," show %% now print centered\n"); fprintf(ofp," }\n"); fprintf(ofp," { %% doesn't fit - reduce point size\n"); fprintf(ofp," %% (Too big) show\n"); fprintf(ofp," PS .8 mul /PS exch def %% shrink font size\n"); fprintf(ofp," FontName findfont PS scalefont setfont\n"); fprintf(ofp," CenterLine\n"); fprintf(ofp," PS .8 div /PS exch def %% restore font size\n"); fprintf(ofp," }\n"); fprintf(ofp," ifelse\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/CenterSong %% song-string\n"); fprintf(ofp,"{ %% string - print this song centered\n"); fprintf(ofp," CenterLine\n"); fprintf(ofp," NewLine\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/RightSong %% song-string\n"); fprintf(ofp,"{ %% string - print this song right justified\n"); fprintf(ofp," RightLine\n"); fprintf(ofp," NewLine\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/DoubleSong %% left_string right_string\n"); fprintf(ofp,"{ %% print two entries on a line (e.g., title & time or artist)\n"); fprintf(ofp," DoubleLine %% print left & right portions\n"); fprintf(ofp," NewLine %% go to next line\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/DoubleLine %% left_string right_string\n"); fprintf(ofp,"{ %% print left & right strings on line\n"); fprintf(ofp," exch %% swap left & right\n"); fprintf(ofp," LeftLine %% first write left justified (song?)\n"); fprintf(ofp," RightLine %% right justify time or artist or whatever\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/FitsLine %% string FitsLine bool\n"); fprintf(ofp,"{ %% string\n"); fprintf(ofp," %% dup (FitsLine passed: ) show show NewLine\n"); fprintf(ofp," dup %% save copy for return\n"); fprintf(ofp," stringwidth pop %% X width of string\n"); fprintf(ofp," currentpoint pop %% current X position\n"); fprintf(ofp," add RM lt %% see if within margin\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/LeftLine %% string-to-print\n"); fprintf(ofp,"{ %% print line after checking that it fits\n"); fprintf(ofp," %% dup (Printline passed: ) show show NewLine\n"); fprintf(ofp," %% see if rest of string fits on line\n"); fprintf(ofp," GoLeft %% make sure we are the left margin\n"); fprintf(ofp," FitsLine\n"); fprintf(ofp," { show }\n"); fprintf(ofp," { BreakLine }\n"); fprintf(ofp," ifelse\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/RightLine %% string-to-print\n"); fprintf(ofp,"{ %% print line right justified\n"); fprintf(ofp," %% if doesn't fit, then do a left line\n"); fprintf(ofp," GoLeft %% make sure we are the left margin\n"); fprintf(ofp," FitsLine\n"); fprintf(ofp," {\n"); fprintf(ofp," dup stringwidth pop \n"); fprintf(ofp," currentpoint pop add\n"); fprintf(ofp," RM exch sub 0 rmoveto\n"); fprintf(ofp," show\n"); fprintf(ofp," }\n"); fprintf(ofp," { LeftLine }\n"); fprintf(ofp," ifelse\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/BreakLine %% string-to-break-into-lines\n"); fprintf(ofp,"{ %% print line word by word until right margin\n"); fprintf(ofp," {\n"); fprintf(ofp," ( ) search %% get next word\n"); fprintf(ofp," { %% space found - see if word fits\n"); fprintf(ofp," FitsLine %% see if word fits\n"); fprintf(ofp," { show show } %% yes, print it and space\n"); fprintf(ofp," %% doesn't print - print on next line\n"); fprintf(ofp," { NewLine INDENT 0 rmoveto show show }\n"); fprintf(ofp," ifelse\n"); fprintf(ofp," }\n"); fprintf(ofp," {\n"); fprintf(ofp," %% new line if needed\n"); fprintf(ofp," FitsLine not { NewLine INDENT 0 rmoveto } if\n"); fprintf(ofp," show %% display last word\n"); fprintf(ofp," exit %% exit loop\n"); fprintf(ofp," }\n"); fprintf(ofp," ifelse %% print word or new line\n"); fprintf(ofp," } loop\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/LeftCover\n"); fprintf(ofp,"{ %% print left most cover\n"); fprintf(ofp," CovType UndefType eq { CassCover } if %% default is cassette\n"); fprintf(ofp," StartXL StartYL translate\n"); fprintf(ofp," 270 rotate\n"); fprintf(ofp," PrintCover\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/CenterCover\n"); fprintf(ofp,"{ %% print center cover\n"); fprintf(ofp," StartXC StartYC translate\n"); fprintf(ofp," PrintCover\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/RightCover\n"); fprintf(ofp,"{ %% second cover - right side\n"); fprintf(ofp," StartXR StartYR translate\n"); fprintf(ofp," PrintCover\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/PrintCover\n"); fprintf(ofp,"{\n"); fprintf(ofp," DrawShape\n"); fprintf(ofp," /Helvetica 10 NewFont\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"/WrapUp\n"); fprintf(ofp,"{\n"); fprintf(ofp," showpage\n"); fprintf(ofp,"} def\n"); fprintf(ofp,"\n"); fprintf(ofp,"%%%%EndPrologue\n"); fprintf(ofp,"\n"); }