X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ps%2Flilyponddefs.ps;h=f7974111c6008853de7b0bd483130a650393e2de;hb=HEAD;hp=2ff908e42038b28efbe65d39b8a701f7c57a6c2b;hpb=be6b7669873b8b227c224e9ff1e1e101c43426df;p=lilypond.git diff --git a/ps/lilyponddefs.ps b/ps/lilyponddefs.ps index 2ff908e420..f7974111c6 100644 --- a/ps/lilyponddefs.ps +++ b/ps/lilyponddefs.ps @@ -1,212 +1,29 @@ -%!PS-Adobe-1.0: lilyponddefs +%!PS-Adobe-2.0: lilyponddefs.ps % % Functions for direct PostScript output -% hmm % /setgray { 1 add } bind def -/staff-line-thickness lilypondpaperstafflinethickness def -/staff-height lilypondpaperstaffheight def -/line-width lilypondpaperlinewidth def - -% FIXME: why isn't this set (by default) by lily? -% /text-height lilypondpapertextheight def - -/output-scale lilypondpaperoutputscale def -/paper-size { lilypondpaperpapersize } bind def - -% FIXME -% urg, read from paper block -% fixed base line skip value, for single line staves -/base-line-skip lilypondpaperlineheight def - -/init-paper { - gsave - .1 setlinewidth - clippath pathbbox newpath - /vsize exch def - /hsize exch def pop pop pop - - %FIXME: - %vsize text-height sub 2 div /top-margin exch def - 144 2 div /top-margin exch def - hsize line-width sub 2 div /left-margin exch def - grestore +/set-ps-scale-to-lily-scale { + lily-output-units output-scale mul dup scale } bind def -/place-box -{ - /object exch def - gsave - %exch translate - translate - 0 0 moveto - object - grestore -} bind def -/start-line % height -{ - dup base-line-skip gt { - /line-height exch def - } - { - pop /line-height base-line-skip def - } ifelse - line-y top-margin sub base-line-skip lt { - showpage - /line-y vsize top-margin sub def - } if +/init-paper { gsave - line-x line-y translate -} bind def - -/stop-line -{ - /the-line exch def - the-line - stroke + clippath pathbbox newpath + /paper-height exch def + /paper-width exch def pop pop pop + % FIXME + /top-margin 2 def + paper-width line-width sub 2 div /left-margin exch def grestore - line-y line-height output-scale mul sub /line-y exch def -} bind def - -% FIXME: font definitions should come from LilyPond -% built-in ps fonts are ugly -/huge-bold-font { - /Times-Bold findfont 20.7 scalefont setfont -} bind def - -/Large-bold-font { - /Times-Bold findfont 17.3 scalefont setfont -} bind def - -/large-bold-font { - /Times-Bold findfont 14.4 scalefont setfont -} bind def - -/large-font { - /Times-Roman findfont 14.4 scalefont setfont } bind def -/large-smallcaps-font { - % urg - /Helvetica findfont 14.4 scalefont setfont +/init-lilypond-parameters { + staff-line-thickness setlinewidth + staff-height init-paper } bind def -/normal-font { - /Times-Roman findfont 12 scalefont setfont -} bind def - -/footnote-font { - /Times-Roman findfont 10 scalefont setfont -} bind def - -/get-text-dimensions % path .. width height -{ - dup true charpath pathbbox - newpath - line-x line-y moveto - exch 4 -1 roll - sub - 3 1 roll - exch sub -} bind def - -/set-centered -{ - line-x line-y moveto - get-text-dimensions - neg line-y add /line-y exch def - neg line-width add 2 div 0 rmoveto - show -} bind def - -/set-left -{ - line-x line-y moveto - get-text-dimensions - neg line-y add /line-y exch def - pop - show -} bind def - -/set-right -{ - line-x line-y moveto - get-text-dimensions - neg line-y add /line-y exch def - neg line-width add 0 rmoveto - show -} bind def - -/make-lilypond-title -{ - currentdict /lilyponddedication known { - normal-font lilyponddedication set-centered - line-y 10 sub /line-y exch def - } if - currentdict /lilypondtitle known { - huge-bold-font lilypondtitle set-centered - line-y 5 sub /line-y exch def - } if - currentdict /lilypondsubtitle known { - Large-bold-font lilypondsubtitle set-centered - line-y 5 sub /line-y exch def - } if - currentdict /lilypondsubsubtitle known { - large-bold-font lilypondsubsubtitle set-centered - } if - line-y /mini-page exch def - currentdict /lilypondcomposer known { - large-smallcaps-font lilypondcomposer set-right - line-y 2 sub /line-y exch def - } if - currentdict /lilypondopus known { - normal-font lilypondopus set-right - line-y 3 sub /line-y exch def - } if - currentdict /lilypondarranger known { - normal-font lilypondarranger set-right - line-y 3 sub /line-y exch def - } if - currentdict /lilypondpoet known { - mini-page /line-y exch def - normal-font lilypondpoet set-left - line-y 3 sub /line-y exch def - } if - currentdict /lilypondtexttranslator known { - normal-font lilypondtexttranslator set-left - line-y 3 sub /line-y exch def - } if - currentdict /lilypondinstrument known { - large-font lilypondinstrument set-centered - } if - currentdict /lilypondpiece known { - large-smallcaps-font lilypondpiece set-left - } if -} bind def - -/end-lilypond-output -{ - /line-y top-margin def - footnote-font lilypondtagline set-left - showpage -} bind def - -/turnOnExperimentalFeatures { } bind def - -staff-line-thickness setlinewidth - -% set postscript paper size -paper-size - -% initialise paper dimensions -staff-height init-paper - -/line-x left-margin def -/line-y vsize top-margin sub def - -make-lilypond-title -% see if we're there... -% 10 setlinewidth 0 0 moveto 400 800 lineto stroke +% end lilyponddefs.ps