1 %!PS-Adobe-1.0: lilyponddefs
3 % Functions for direct PostScript output
6 % /setgray { 1 add } bind def
8 /staff-line-thickness lilypondpaperstafflinethickness def
9 /staff-height lilypondpaperstaffheight def
10 /line-width lilypondpaperlinewidth def
12 % FIXME: why isn't this set (by default) by lily?
13 % /text-height lilypondpapertextheight def
15 /output-scale lilypondpaperoutputscale def
16 /paper-size { lilypondpaperpapersize } bind def
19 % urg, read from paper block
20 % fixed base line skip value, for single line staffs
21 /base-line-skip lilypondpaperlineheight def
27 clippath pathbbox newpath
29 /hsize exch def pop pop pop
32 %vsize text-height sub 2 div /top-margin exch def
33 144 2 div /top-margin exch def
34 hsize line-width sub 2 div /left-margin exch def
50 % FIXME. translate to middle of box.
53 /draw-box % breapth width depth height
66 closepath % 0 d h add neg rlineto
74 dup base-line-skip gt {
78 pop /line-height base-line-skip def
80 line-y top-margin sub base-line-skip lt {
82 /line-y vsize top-margin sub def
85 line-x line-y translate
94 line-y line-height output-scale mul sub /line-y exch def
97 % FIXME: font definitions should come from LilyPond
98 % built-in ps fonts are ugly
100 /Times-Bold findfont 20.7 scalefont setfont
104 /Times-Bold findfont 17.3 scalefont setfont
108 /Times-Bold findfont 14.4 scalefont setfont
112 /Times-Roman findfont 14.4 scalefont setfont
115 /large-smallcaps-font {
117 /Helvetica findfont 14.4 scalefont setfont
121 /Times-Roman findfont 12 scalefont setfont
125 /Times-Roman findfont 10 scalefont setfont
128 /get-text-dimensions % path .. width height
130 dup true charpath pathbbox
143 neg line-y add /line-y exch def
144 neg line-width add 2 div 0 rmoveto
152 neg line-y add /line-y exch def
161 neg line-y add /line-y exch def
162 neg line-width add 0 rmoveto
168 currentdict /lilyponddedication known {
169 normal-font lilyponddedication set-centered
170 line-y 10 sub /line-y exch def
172 currentdict /lilypondtitle known {
173 huge-bold-font lilypondtitle set-centered
174 line-y 5 sub /line-y exch def
176 currentdict /lilypondsubtitle known {
177 Large-bold-font lilypondsubtitle set-centered
178 line-y 5 sub /line-y exch def
180 currentdict /lilypondsubsubtitle known {
181 large-bold-font lilypondsubsubtitle set-centered
183 line-y /mini-page exch def
184 currentdict /lilypondcomposer known {
185 large-smallcaps-font lilypondcomposer set-right
186 line-y 2 sub /line-y exch def
188 currentdict /lilypondopus known {
189 normal-font lilypondopus set-right
190 line-y 3 sub /line-y exch def
192 currentdict /lilypondarranger known {
193 normal-font lilypondarranger set-right
194 line-y 3 sub /line-y exch def
196 currentdict /lilypondpoet known {
197 mini-page /line-y exch def
198 normal-font lilypondpoet set-left
199 line-y 3 sub /line-y exch def
201 currentdict /lilypondtexttranslator known {
202 normal-font lilypondtexttranslator set-left
203 line-y 3 sub /line-y exch def
205 currentdict /lilypondinstrument known {
206 large-font lilypondinstrument set-centered
208 currentdict /lilypondpiece known {
209 large-smallcaps-font lilypondpiece set-left
215 /line-y top-margin def
216 footnote-font lilypondtagline set-left
220 /turnOnExperimentalFeatures { } bind def
222 staff-line-thickness setlinewidth
224 % set postscript paper size
227 % initialise paper dimensions
228 staff-height init-paper
230 /line-x left-margin def
231 /line-y vsize top-margin sub def
235 % see if we're there...
236 % 10 setlinewidth 0 0 moveto 400 800 lineto stroke