]> git.donarmstrong.com Git - lilypond.git/blobdiff - ps/lilyponddefs.ps
* ps/music-drawing-routines.ps:
[lilypond.git] / ps / lilyponddefs.ps
index d4994a0e0f5757fd8fdc0b80f78273f218b73fb9..cc4bf26f4e8ad04c02b0de118c66667c41b5ea0c 100644 (file)
@@ -1,26 +1,36 @@
-%!PS-Adobe-1.0: lilyponddefs
+%!PS-Adobe-1.0: lilyponddefs.ps
 %
 % Functions for direct PostScript output
 
 % hmm
 % /setgray { 1 add } bind def
 
-/staff-line-thickness lilypondpaperstafflinethickness def
+/staff-line-thickness lilypondpaperlinethickness 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
+/lily-output-units 2.83464  def  %% milimeter
+% /lily-output-units 0.996264  def  %% true points.
+
+/output-scale
+lilypondpaperoutputscale lily-output-units mul 
+def
+
+/set-ps-scale-to-lily-scale
+{
+output-scale output-scale scale
+} bind def
+
 /paper-size { lilypondpaperpapersize } bind def
 
 % FIXME
 % urg, read from paper block
-% fixed base line skip value, for single line staffs
+% fixed base line skip value, for single line staves
 /base-line-skip lilypondpaperlineheight def
 
-
 /init-paper {
        gsave
        .1 setlinewidth
        grestore
 } bind def
 
-%
-% FIXME.  translate to middle of box.
-%
-
-/draw-box % breapth width depth height
+/start-system % height
 {
-       /h exch def
-       /d exch def
-       /w exch def
-       /b exch def
-       gsave
-
-       0 setlinewidth
-       b neg d neg rmoveto
-       b w add 0 rlineto
-       0 d h add rlineto
-       b w add neg 0 rlineto
-       closepath % 0 d h add neg rlineto
-       fill
-
-       grestore
-} bind def
-
-/start-line
-{ 
+       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
        line-x line-y translate
 } bind def
 
-/stop-line
+/stop-system
 { 
        /the-line exch def
-       0 0 moveto the-line clippath pathbbox
+       the-line
        stroke
        grestore
-       exch 4 -1 roll
-       sub
-       3 1 roll
-       exch sub
-       %pstack
-       %
-       % ugh: now we should have `width height' on stack,
-       % but it's probably just the width and height of last element
-       % (the last staff)
-       % How do we get all heights of all staffs in a line?
-       %
-       % output-scale div neg line-y add /line-y exch def
-       %
-       % discarding height...
-       pop
-       %
-       % discard width
-       pop
-       % use fixed base-line-skip for now
-       line-y base-line-skip output-scale mul sub /line-y exch def
+       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
+       /Palatino-Bold findfont 20.7 scalefont setfont
 } bind def
 
 /Large-bold-font {
-       /Times-Bold findfont 17.3 scalefont setfont
+       /Palatino-Bold findfont 17.3 scalefont setfont
 } bind def
 
 /large-bold-font {
-       /Times-Bold findfont 14.4 scalefont setfont
+       /Palatino-Bold findfont 14.4 scalefont setfont
 } bind def
 
 /large-font {
-       /Times-Roman findfont 14.4 scalefont setfont
+       /Palatino-Roman findfont 14.4 scalefont setfont
 } bind def
 
 /large-smallcaps-font {
        % urg
-       /Helvetica findfont 14.4 scalefont setfont
+       /Bookman-Light findfont 14.4 scalefont setfont
 } bind def
 
 /normal-font {
-       /Times-Roman findfont 12 scalefont setfont
+       /Palatino-Roman findfont 12 scalefont setfont
 } bind def
 
 /footnote-font {
-       /Times-Roman findfont 10 scalefont setfont
+       /Palatino-Roman findfont 10 scalefont setfont
 } bind def
 
 /get-text-dimensions % path .. width height
 
 /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
        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
 
 /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-x left-margin output-scale div 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