-%!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
+% /setgray { 1 add } bind def
-% urg
-1 /stafflinethickness exch def
+% To let gs load fonts from builddir, do:
+% export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
-/xoffset 30 def
-/yoffset 700 def
-/staffrulethickness 1 def
-/staffheight 20 def
-/placebox
+/set-ps-scale-to-lily-scale { output-scale output-scale scale } bind def
+
+/init-paper {
+ gsave
+ .1 setlinewidth
+ 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
grestore
} bind def
-/setbold % '(' text ')'
-{
- settext
-} bind def
-
-/settext % '(' text ')'
-{
- gsave
- % urg
- /Times-Roman findfont 12 scalefont setfont
- show
- grestore
-} bind def
+%% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
-/setfinger % '(' text ')'
-{
- gsave
- % urg
- /feta-nummer5 findfont 12 scalefont setfont
- show
- grestore
-} bind def
+%/FONTLENGTH 256 bind def
-/setitalic % '(' text ')'
+%<font> <encoding> <name> reencode-font
+/reencode-dict 5 dict def
+/reencode-font
{
- gsave
- % urg
- /Times-Italic findfont 12 scalefont setfont
- show
- grestore
+ 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
-/vrule % width height depth
+/start-system % x y
{
- gsave
- 3 -1 roll setlinewidth
- neg 0 exch moveto
- 0 exch lineto stroke
- grestore
-} bind def
-
-/draw_stem % kern width height depth
-{
- gsave
- 4 -1 roll neg 0 translate
- vrule
- grestore
+ gsave
+ 0
+ vsize translate
} bind def
-/extender % width
-{
- gsave
- 0 0 moveto
- stafflinethickness 0.8 mul setlinewidth
- 0 lineto stroke
- grestore
-} bind def
-
-/widthbar % height width
-{
- gsave
- setlinewidth
- 2 div dup neg 0 exch moveto
- 0 exch lineto stroke
- 2 div
- grestore
-} bind def
-
-/thickbar % height
-{
- stafflinethickness 2 mul widthbar
-} bind def
-
-/thinbar % height
-{
- stafflinethickness 1.6 mul widthbar
-} bind def
-
-/maatstreep % height
-{
- thinbar
-} bind def
-
-/fatdoublebar
-{
- thickbar
-} bind def
-
-/finishbar
-{
- thickbar
-} bind def
-
-/generalmeter % num den
-{
- pop pop
-} bind def
-
-/pianobrace % '(' char ')'
-{
- gsave
- /feta-braces20 findfont 12 scalefont setfont%
- show
- grestore
-} bind def
-
-/doublebar
-{
- thinbar
-} bind def
-
-/repeatbar
-{
- thickbar
-} bind def
-
-/repeatbarstartrepeat
-{
- thickbar
-} bind def
-
-/startbar
-{
- thickbar
-} bind def
-
-/startrepeat
-{
- thickbar
-} bind def
-
-/stoprepeat
-{
- thickbar
-} 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 staffheight 8 mul sub /yoffset exch def
+/end-lilypond-output
+{
+% showpage
} bind def
-/unknown { (U) setbold } bind def
-/empty { (E) setbold } bind def
+staff-line-thickness setlinewidth
-/turnOnExperimentalFeatures { } bind def
-/rulesym % thick length
-{
- gsave
- exch setlinewidth
- 0 lineto stroke
- grestore
-} bind def
-
-(lily.ps) findlibfile
-{
- exch pop //systemdict /run get exec
-}
-{
- /undefinedfilename signalerror
-} ifelse
+staff-height init-paper
+
-stafflinethickness setlinewidth
-% see if we're there...
-% 10 setlinewidth 0 0 moveto 400 800 lineto stroke
+% end lilyponddefs.ps