-%!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
-% hmm
% /setgray { 1 add } bind def
-/stafflinethickness mudelapaperstaffline def
-/staffheight mudelapaperstaffheight def
+% To let gs load fonts from builddir, do:
+% export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
+
+
+/set-ps-scale-to-lily-scale { output-scale output-scale scale } bind def
-/xoffset 30 def
-/yoffset 700 def
-/placebox
+/init-paper {
+ gsave
+ .1 setlinewidth
+ clippath pathbbox newpath
+ /vsize exch def
+ /hsize exch def pop 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
grestore
} bind def
-%
-% FIXME. translate to middle of box.
-%
+%% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
-/draw_box % breapth width depth height
-{
- /h exch def
- /d exch def
- /w exch def
- /b exch def
- gsave
+%/FONTLENGTH 256 bind def
- 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
+%<font> <encoding> <name> reencode-font
+/reencode-dict 5 dict def
+/reencode-font
+{
+ reencode-dict
+ begin
+ /name exch def
+ /encoding exch def
+ /base-font exch def
+ % note: Needs ps level 2
+ /font base-font maxlength dict def
+ base-font {
+ exch dup dup /FID ne exch /Encoding ne and
+ { exch font 3 1 roll put }
+ { pop pop } ifelse
+ } forall
+ font /FontName name put
+ font /Encoding encoding put
+ name font definefont pop
+ end
+} bind def
- grestore
+/start-system % x y
+{
+ gsave
+ exch output-scale mul exch
+ output-scale mul vsize exch sub translate
} bind def
-/start_line
+/stop-system
{
- gsave
- xoffset yoffset translate
+ /the-line exch def
+ the-line stroke grestore
} 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
+/end-lilypond-output
+{
+% showpage
} bind def
-/turnOnExperimentalFeatures { } bind def
+staff-line-thickness setlinewidth
+
+% set postscript paper size
+paper-size
-stafflinethickness setlinewidth
+% initialise paper dimensions
+staff-height init-paper
-% see if we're there...
-% 10 setlinewidth 0 0 moveto 400 800 lineto stroke
+% end lilyponddefs.ps