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
32 %% FIXME: base-line-skip is too big, is this RIGHT?
33 %% /base-line-skip lilypondpaperlineheight def
34 /base-line-skip lilypondpaperlineheight lilypondpaperoutputscale div def
39 clippath pathbbox newpath
41 /hsize exch def pop pop pop
44 %vsize text-height sub 2 div /top-margin exch def
45 % 144 2 div /top-margin exch def
47 hsize line-width sub 2 div /left-margin exch def
62 %% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
64 %/FONTLENGTH 256 bind def
66 %<font> <encoding> <name> reencode-font
67 /reencode-dict 5 dict def
75 % note: Needs ps level 2
76 /font base-font maxlength dict def
78 exch dup dup /FID ne exch /Encoding ne and
79 { exch font 3 1 roll put }
82 font /FontName name put
83 font /Encoding encoding put
84 name font definefont pop
88 /start-system % height
90 dup base-line-skip gt {
94 pop /line-height base-line-skip def
96 line-y top-margin sub base-line-skip lt {
98 /line-y vsize top-margin sub def
101 line-x line-y translate
110 line-y line-height output-scale mul sub /line-y exch def
113 % FIXME: font definitions should come from LilyPond
114 % built-in ps fonts are ugly
116 /Palatino-Bold findfont 20.7 scalefont setfont
120 /Palatino-Bold findfont 17.3 scalefont setfont
124 /Palatino-Bold findfont 14.4 scalefont setfont
128 /Palatino-Roman findfont 14.4 scalefont setfont
131 /large-smallcaps-font {
133 /Bookman-Light findfont 14.4 scalefont setfont
137 /Palatino-Roman findfont 12 scalefont setfont
141 /Palatino-Roman findfont 10 scalefont setfont
144 /get-text-dimensions % path .. width height
146 dup true charpath pathbbox
159 neg line-y add /line-y exch def
160 neg line-width add 2 div 0 rmoveto
168 neg line-y add /line-y exch def
177 neg line-y add /line-y exch def
178 neg line-width add 0 rmoveto
184 currentdict /lilyponddedication known {
185 normal-font lilyponddedication set-centered
186 line-y 10 sub /line-y exch def
188 currentdict /lilypondtitle known {
189 huge-bold-font lilypondtitle set-centered
190 line-y 5 sub /line-y exch def
192 currentdict /lilypondsubtitle known {
193 Large-bold-font lilypondsubtitle set-centered
194 line-y 5 sub /line-y exch def
196 currentdict /lilypondsubsubtitle known {
197 large-bold-font lilypondsubsubtitle set-centered
199 line-y /mini-page exch def
200 currentdict /lilypondcomposer known {
201 large-smallcaps-font lilypondcomposer set-right
202 line-y 2 sub /line-y exch def
204 currentdict /lilypondopus known {
205 normal-font lilypondopus set-right
206 line-y 3 sub /line-y exch def
208 currentdict /lilypondarranger known {
209 normal-font lilypondarranger set-right
210 line-y 3 sub /line-y exch def
212 currentdict /lilypondpoet known {
213 mini-page /line-y exch def
214 normal-font lilypondpoet set-left
215 line-y 3 sub /line-y exch def
217 currentdict /lilypondtexttranslator known {
218 normal-font lilypondtexttranslator set-left
219 line-y 3 sub /line-y exch def
221 currentdict /lilypondinstrument known {
222 large-font lilypondinstrument set-centered
224 currentdict /lilypondpiece known {
225 large-smallcaps-font lilypondpiece set-left
231 /line-y top-margin def
232 footnote-font lilypondtagline set-left
236 /turnOnExperimentalFeatures { } bind def
238 staff-line-thickness setlinewidth
240 % set postscript paper size
243 % initialise paper dimensions
244 staff-height init-paper
246 /line-x left-margin output-scale div def
247 /line-y vsize top-margin sub def
249 % FIXME: testing \markup titles
250 % make-lilypond-title
252 % see if we're there...
253 % 10 setlinewidth 0 0 moveto 400 800 lineto stroke
255 % end lilyponddefs.ps