1 %!PS-Adobe-2.0: lilyponddefs.ps
3 % Functions for direct PostScript output
5 % /setgray { 1 add } bind def
7 % To let gs load fonts from builddir, do:
8 % export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
10 /staff-line-thickness lilypondpaperlinethickness def
11 /staff-height lilypondpaperstaffheight def
12 /line-width lilypondpaperlinewidth def
14 % FIXME: why isn't this set (by default) by lily?
15 % /text-height lilypondpapertextheight def
17 /lily-output-units 2.83464 def %% milimeter
18 % /lily-output-units 0.996264 def %% true points.
20 /output-scale lilypondpaperoutputscale lily-output-units mul def
22 /set-ps-scale-to-lily-scale { output-scale output-scale scale } bind def
24 /paper-size { lilypondpaperpapersize } bind def
26 %% FIXME: base-line-skip is too big, is this RIGHT?
27 %% /line-height 14 staff-space mul def
28 %% /base-line-skip lilypondpaperlineheight def
29 %%/base-line-skip lilypondpaperlineheight lilypondpaperoutputscale div def
35 clippath pathbbox newpath
37 /hsize exch def pop pop pop pop
40 hsize line-width sub 2 div /left-margin exch def
55 %% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
57 %/FONTLENGTH 256 bind def
59 %<font> <encoding> <name> reencode-font
60 /reencode-dict 5 dict def
68 % note: Needs ps level 2
69 /font base-font maxlength dict def
71 exch dup dup /FID ne exch /Encoding ne and
72 { exch font 3 1 roll put }
75 font /FontName name put
76 font /Encoding encoding put
77 name font definefont pop
83 /line-x left-margin output-scale div def
84 /line-y vsize top-margin sub def
92 % dump using baselineskip, fold to new page
93 /start-system % height
95 dup base-line-skip gt {
99 pop /line-height base-line-skip def
101 line-y top-margin sub base-line-skip lt {
103 /line-y vsize top-margin sub def
106 line-x line-y translate
115 line-y line-height output-scale mul sub /line-y exch def
118 % FIXME: font definitions should come from LilyPond
119 % built-in ps fonts are ugly
121 /Palatino-Bold findfont 20.7 scalefont setfont
125 /Palatino-Bold findfont 17.3 scalefont setfont
129 /Palatino-Bold findfont 14.4 scalefont setfont
133 /Palatino-Roman findfont 14.4 scalefont setfont
136 /large-smallcaps-font {
138 /Bookman-Light findfont 14.4 scalefont setfont
142 /Palatino-Roman findfont 12 scalefont setfont
146 /Palatino-Roman findfont 10 scalefont setfont
149 /get-text-dimensions % path .. width height
151 dup true charpath pathbbox
164 neg line-y add /line-y exch def
165 neg line-width add 2 div 0 rmoveto
173 neg line-y add /line-y exch def
182 neg line-y add /line-y exch def
183 neg line-width add 0 rmoveto
189 currentdict /lilyponddedication known {
190 normal-font lilyponddedication set-centered
191 line-y 10 sub /line-y exch def
193 currentdict /lilypondtitle known {
194 huge-bold-font lilypondtitle set-centered
195 line-y 5 sub /line-y exch def
197 currentdict /lilypondsubtitle known {
198 Large-bold-font lilypondsubtitle set-centered
199 line-y 5 sub /line-y exch def
201 currentdict /lilypondsubsubtitle known {
202 large-bold-font lilypondsubsubtitle set-centered
204 line-y /mini-page exch def
205 currentdict /lilypondcomposer known {
206 large-smallcaps-font lilypondcomposer set-right
207 line-y 2 sub /line-y exch def
209 currentdict /lilypondopus known {
210 normal-font lilypondopus set-right
211 line-y 3 sub /line-y exch def
213 currentdict /lilypondarranger known {
214 normal-font lilypondarranger set-right
215 line-y 3 sub /line-y exch def
217 currentdict /lilypondpoet known {
218 mini-page /line-y exch def
219 normal-font lilypondpoet set-left
220 line-y 3 sub /line-y exch def
222 currentdict /lilypondtexttranslator known {
223 normal-font lilypondtexttranslator set-left
224 line-y 3 sub /line-y exch def
226 currentdict /lilypondinstrument known {
227 large-font lilypondinstrument set-centered
229 currentdict /lilypondpiece known {
230 large-smallcaps-font lilypondpiece set-left
236 /line-y top-margin def
237 footnote-font lilypondtagline set-left
241 /turnOnExperimentalFeatures { } bind def
243 staff-line-thickness setlinewidth
245 % set postscript paper size
248 % initialise paper dimensions
249 staff-height init-paper
251 % end lilyponddefs.ps