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 line-y top-margin sub base-line-skip lt {
76 /line-y vsize top-margin sub def
79 line-x line-y translate
85 0 0 moveto the-line clippath pathbbox
94 % ugh: now we should have `width height' on stack,
95 % but it's probably just the width and height of last element
97 % How do we get all heights of all staffs in a line?
99 % output-scale div neg line-y add /line-y exch def
101 % discarding height...
106 % use fixed base-line-skip for now
107 line-y base-line-skip output-scale mul sub /line-y exch def
110 % FIXME: font definitions should come from LilyPond
111 % built-in ps fonts are ugly
113 /Times-Bold findfont 20.7 scalefont setfont
117 /Times-Bold findfont 17.3 scalefont setfont
121 /Times-Bold findfont 14.4 scalefont setfont
125 /Times-Roman findfont 14.4 scalefont setfont
128 /large-smallcaps-font {
130 /Helvetica findfont 14.4 scalefont setfont
134 /Times-Roman findfont 12 scalefont setfont
138 /Times-Roman findfont 10 scalefont setfont
141 /get-text-dimensions % path .. width height
143 dup true charpath pathbbox
156 neg line-y add /line-y exch def
157 neg line-width add 2 div 0 rmoveto
165 neg line-y add /line-y exch def
174 neg line-y add /line-y exch def
175 neg line-width add 0 rmoveto
181 currentdict /lilypondtitle known {
182 huge-bold-font lilypondtitle set-centered
183 line-y 5 sub /line-y exch def
185 currentdict /lilypondsubtitle known {
186 Large-bold-font lilypondsubtitle set-centered
187 line-y 5 sub /line-y exch def
189 currentdict /lilypondsubsubtitle known {
190 large-bold-font lilypondsubsubtitle set-centered
192 currentdict /lilypondcomposer known {
193 large-smallcaps-font lilypondcomposer set-right
195 currentdict /lilypondopus known {
196 normal-font lilypondopus set-right
198 currentdict /lilypondarranger known {
199 normal-font lilypondarranger set-right
201 currentdict /lilypondinstrument known {
202 large-font lilypondinstrument set-centered
204 currentdict /lilypondpiece known {
205 large-smallcaps-font lilypondpiece set-left
211 /line-y top-margin def
212 footnote-font lilypondtagline set-left
216 /turnOnExperimentalFeatures { } bind def
219 staff-line-thickness setlinewidth
223 staff-height init-paper
225 /line-x left-margin def
226 /line-y vsize top-margin sub def
230 % see if we're there...
231 % 10 setlinewidth 0 0 moveto 400 800 lineto stroke