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 %% /base-line-skip lilypondpaperlineheight def
28 %%/base-line-skip lilypondpaperlineheight lilypondpaperoutputscale div def
34 clippath pathbbox newpath
36 /hsize exch def pop pop pop pop
39 hsize line-width sub 2 div /left-margin exch def
54 %% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
56 %/FONTLENGTH 256 bind def
58 %<font> <encoding> <name> reencode-font
59 /reencode-dict 5 dict def
67 % note: Needs ps level 2
68 /font base-font maxlength dict def
70 exch dup dup /FID ne exch /Encoding ne and
71 { exch font 3 1 roll put }
74 font /FontName name put
75 font /Encoding encoding put
76 name font definefont pop
82 /line-x left-margin output-scale div def
83 /line-y vsize top-margin sub def
91 % dump using baselineskip, fold to new page
92 /start-system % height
94 dup base-line-skip gt {
98 pop /line-height base-line-skip def
100 line-y top-margin sub base-line-skip lt {
102 /line-y vsize top-margin sub def
105 line-x line-y translate
114 line-y line-height output-scale mul sub /line-y exch def
117 % FIXME: font definitions should come from LilyPond
118 % built-in ps fonts are ugly
120 /Palatino-Bold findfont 20.7 scalefont setfont
124 /Palatino-Bold findfont 17.3 scalefont setfont
128 /Palatino-Bold findfont 14.4 scalefont setfont
132 /Palatino-Roman findfont 14.4 scalefont setfont
135 /large-smallcaps-font {
137 /Bookman-Light findfont 14.4 scalefont setfont
141 /Palatino-Roman findfont 12 scalefont setfont
145 /Palatino-Roman findfont 10 scalefont setfont
148 /get-text-dimensions % path .. width height
150 dup true charpath pathbbox
163 neg line-y add /line-y exch def
164 neg line-width add 2 div 0 rmoveto
172 neg line-y add /line-y exch def
181 neg line-y add /line-y exch def
182 neg line-width add 0 rmoveto
188 currentdict /lilyponddedication known {
189 normal-font lilyponddedication set-centered
190 line-y 10 sub /line-y exch def
192 currentdict /lilypondtitle known {
193 huge-bold-font lilypondtitle set-centered
194 line-y 5 sub /line-y exch def
196 currentdict /lilypondsubtitle known {
197 Large-bold-font lilypondsubtitle set-centered
198 line-y 5 sub /line-y exch def
200 currentdict /lilypondsubsubtitle known {
201 large-bold-font lilypondsubsubtitle set-centered
203 line-y /mini-page exch def
204 currentdict /lilypondcomposer known {
205 large-smallcaps-font lilypondcomposer set-right
206 line-y 2 sub /line-y exch def
208 currentdict /lilypondopus known {
209 normal-font lilypondopus set-right
210 line-y 3 sub /line-y exch def
212 currentdict /lilypondarranger known {
213 normal-font lilypondarranger set-right
214 line-y 3 sub /line-y exch def
216 currentdict /lilypondpoet known {
217 mini-page /line-y exch def
218 normal-font lilypondpoet set-left
219 line-y 3 sub /line-y exch def
221 currentdict /lilypondtexttranslator known {
222 normal-font lilypondtexttranslator set-left
223 line-y 3 sub /line-y exch def
225 currentdict /lilypondinstrument known {
226 large-font lilypondinstrument set-centered
228 currentdict /lilypondpiece known {
229 large-smallcaps-font lilypondpiece set-left
235 /line-y top-margin def
236 footnote-font lilypondtagline set-left
240 /turnOnExperimentalFeatures { } bind def
242 staff-line-thickness setlinewidth
244 % set postscript paper size
247 % initialise paper dimensions
248 staff-height init-paper
250 % end lilyponddefs.ps