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
94 % dump using baselineskip, fold to new page
95 /start-system % height
97 dup base-line-skip gt {
101 pop /line-height base-line-skip def
103 line-y top-margin sub base-line-skip lt {
105 /line-y vsize top-margin sub def
108 line-x line-y translate
117 line-y line-height output-scale mul sub /line-y exch def
120 % FIXME: font definitions should come from LilyPond
121 % built-in ps fonts are ugly
123 /Palatino-Bold findfont 20.7 scalefont setfont
127 /Palatino-Bold findfont 17.3 scalefont setfont
131 /Palatino-Bold findfont 14.4 scalefont setfont
135 /Palatino-Roman findfont 14.4 scalefont setfont
138 /large-smallcaps-font {
140 /Bookman-Light findfont 14.4 scalefont setfont
144 /Palatino-Roman findfont 12 scalefont setfont
148 /Palatino-Roman findfont 10 scalefont setfont
151 /get-text-dimensions % path .. width height
153 dup true charpath pathbbox
166 neg line-y add /line-y exch def
167 neg line-width add 2 div 0 rmoveto
175 neg line-y add /line-y exch def
184 neg line-y add /line-y exch def
185 neg line-width add 0 rmoveto
191 currentdict /lilyponddedication known {
192 normal-font lilyponddedication set-centered
193 line-y 10 sub /line-y exch def
195 currentdict /lilypondtitle known {
196 huge-bold-font lilypondtitle set-centered
197 line-y 5 sub /line-y exch def
199 currentdict /lilypondsubtitle known {
200 Large-bold-font lilypondsubtitle set-centered
201 line-y 5 sub /line-y exch def
203 currentdict /lilypondsubsubtitle known {
204 large-bold-font lilypondsubsubtitle set-centered
206 line-y /mini-page exch def
207 currentdict /lilypondcomposer known {
208 large-smallcaps-font lilypondcomposer set-right
209 line-y 2 sub /line-y exch def
211 currentdict /lilypondopus known {
212 normal-font lilypondopus set-right
213 line-y 3 sub /line-y exch def
215 currentdict /lilypondarranger known {
216 normal-font lilypondarranger set-right
217 line-y 3 sub /line-y exch def
219 currentdict /lilypondpoet known {
220 mini-page /line-y exch def
221 normal-font lilypondpoet set-left
222 line-y 3 sub /line-y exch def
224 currentdict /lilypondtexttranslator known {
225 normal-font lilypondtexttranslator set-left
226 line-y 3 sub /line-y exch def
228 currentdict /lilypondinstrument known {
229 large-font lilypondinstrument set-centered
231 currentdict /lilypondpiece known {
232 large-smallcaps-font lilypondpiece set-left
238 /line-y top-margin def
239 footnote-font lilypondtagline set-left
243 /turnOnExperimentalFeatures { } bind def
245 staff-line-thickness setlinewidth
247 % set postscript paper size
250 % initialise paper dimensions
251 staff-height init-paper
253 %/line-x left-margin output-scale div def
254 %/line-y vsize top-margin sub def
258 % end lilyponddefs.ps