1 %!PS-Adobe-1.0: lilyponddefs.ps
3 % Functions for direct PostScript output
6 % /setgray { 1 add } bind def
8 % To let gs load fonts from builddir, do:
9 % export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
11 /staff-line-thickness lilypondpaperlinethickness def
12 /staff-height lilypondpaperstaffheight def
13 /line-width lilypondpaperlinewidth def
15 % FIXME: why isn't this set (by default) by lily?
16 % /text-height lilypondpapertextheight def
18 /lily-output-units 2.83464 def %% milimeter
19 % /lily-output-units 0.996264 def %% true points.
22 lilypondpaperoutputscale lily-output-units mul
25 /set-ps-scale-to-lily-scale
27 output-scale output-scale scale
30 /paper-size { lilypondpaperpapersize } bind def
33 % urg, read from paper block
34 % fixed base line skip value, for single line staves
35 /base-line-skip lilypondpaperlineheight def
40 clippath pathbbox newpath
42 /hsize exch def pop pop pop
45 %vsize text-height sub 2 div /top-margin exch def
46 144 2 div /top-margin exch def
47 hsize line-width sub 2 div /left-margin exch def
62 /start-system % height
64 dup base-line-skip gt {
68 pop /line-height base-line-skip def
70 line-y top-margin sub base-line-skip lt {
72 /line-y vsize top-margin sub def
75 line-x line-y translate
84 line-y line-height output-scale mul sub /line-y exch def
87 % FIXME: font definitions should come from LilyPond
88 % built-in ps fonts are ugly
90 /Palatino-Bold findfont 20.7 scalefont setfont
94 /Palatino-Bold findfont 17.3 scalefont setfont
98 /Palatino-Bold findfont 14.4 scalefont setfont
102 /Palatino-Roman findfont 14.4 scalefont setfont
105 /large-smallcaps-font {
107 /Bookman-Light findfont 14.4 scalefont setfont
111 /Palatino-Roman findfont 12 scalefont setfont
115 /Palatino-Roman findfont 10 scalefont setfont
118 /get-text-dimensions % path .. width height
120 dup true charpath pathbbox
133 neg line-y add /line-y exch def
134 neg line-width add 2 div 0 rmoveto
142 neg line-y add /line-y exch def
151 neg line-y add /line-y exch def
152 neg line-width add 0 rmoveto
158 currentdict /lilyponddedication known {
159 normal-font lilyponddedication set-centered
160 line-y 10 sub /line-y exch def
162 currentdict /lilypondtitle known {
163 huge-bold-font lilypondtitle set-centered
164 line-y 5 sub /line-y exch def
166 currentdict /lilypondsubtitle known {
167 Large-bold-font lilypondsubtitle set-centered
168 line-y 5 sub /line-y exch def
170 currentdict /lilypondsubsubtitle known {
171 large-bold-font lilypondsubsubtitle set-centered
173 line-y /mini-page exch def
174 currentdict /lilypondcomposer known {
175 large-smallcaps-font lilypondcomposer set-right
176 line-y 2 sub /line-y exch def
178 currentdict /lilypondopus known {
179 normal-font lilypondopus set-right
180 line-y 3 sub /line-y exch def
182 currentdict /lilypondarranger known {
183 normal-font lilypondarranger set-right
184 line-y 3 sub /line-y exch def
186 currentdict /lilypondpoet known {
187 mini-page /line-y exch def
188 normal-font lilypondpoet set-left
189 line-y 3 sub /line-y exch def
191 currentdict /lilypondtexttranslator known {
192 normal-font lilypondtexttranslator set-left
193 line-y 3 sub /line-y exch def
195 currentdict /lilypondinstrument known {
196 large-font lilypondinstrument set-centered
198 currentdict /lilypondpiece known {
199 large-smallcaps-font lilypondpiece set-left
205 /line-y top-margin def
206 footnote-font lilypondtagline set-left
210 /turnOnExperimentalFeatures { } bind def
212 staff-line-thickness setlinewidth
214 % set postscript paper size
217 % initialise paper dimensions
218 staff-height init-paper
220 /line-x left-margin output-scale div def
221 /line-y vsize top-margin sub def
223 % FIXME: testing \markup titles
224 % make-lilypond-title
226 % see if we're there...
227 % 10 setlinewidth 0 0 moveto 400 800 lineto stroke
229 % end lilyponddefs.ps