-%!PS-Adobe-1.0: lilyponddefs
+%!PS-Adobe-2.0: lilyponddefs.ps
+% TODO:
+% * junk all magic, start-line/stop-line just: placebox @ x.y
+%
+% Functions for direct PostScript output
+
+% /setgray { 1 add } bind def
-% hmm
-/setgray { 1 add } bind def
+% To let gs load fonts from builddir, do:
+% export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
-/stafflinethickness mudelapaperstaffline def
-/staffheight mudelapaperstaffheight def
-/xoffset 30 def
-/yoffset 700 def
+/set-ps-scale-to-lily-scale {
+ lily-output-units output-scale mul
+ lily-output-units output-scale mul scale
+} bind def
+
-/placebox
-{
+/init-paper {
+ gsave
+ clippath pathbbox newpath
+ /vsize exch def
+ /hsize exch def pop pop pop
+ % FIXME
+ /top-margin 2 def
+ hsize line-width sub 2 div /left-margin exch def
+ grestore
+} bind def
+
+
+/place-box {
/object exch def
gsave
- %exch translate
+ % exch translate
translate
0 0 moveto
object
grestore
} bind def
-%
-% FIXME. translate to middle of box.
-%
-
-/draw_box % breapth width depth 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
+% start-system
+/start-system {
+ gsave
} bind def
-/start_line
-{
- gsave
- xoffset yoffset translate
+/start-page {
+ gsave
+ 0
+ vsize translate
} bind def
-/stop_line
-{
- /object exch def
- 0 0 moveto pathbbox exch pop sub exch pop
- object
- grestore
- yoffset add /yoffset exch def
- % urg...
- yoffset mudelapaperstaffheight 8 mul sub /yoffset exch def
-} bind def
-/unknown { (U) setbold } bind def
-/empty { (E) setbold } bind def
+/stop-system {
+ /the-line exch def
+ the-line stroke grestore
+} bind def
-/turnOnExperimentalFeatures { } bind def
-/rulesym % thick length
-{
- gsave
- exch setlinewidth
- 0 lineto stroke
- grestore
+/end-lilypond-output {
+% showpage
} bind def
-(lily.ps) findlibfile
-{
- exch pop //systemdict /run get exec
-}
-{
- /undefinedfilename signalerror
-} ifelse
-stafflinethickness setlinewidth
+/init-lilypond-parameters {
+ staff-line-thickness setlinewidth
+ staff-height init-paper
+} bind def
+
-% see if we're there...
-% 10 setlinewidth 0 0 moveto 400 800 lineto stroke
+% end lilyponddefs.ps