]> git.donarmstrong.com Git - lilypond.git/blobdiff - ps/lilyponddefs.ps
* lily/ly-module.cc (LY_DEFINE): bugfix.
[lilypond.git] / ps / lilyponddefs.ps
index a862db2153221135239ab9c882dbc84229aee678..edd8448155b9180914a47431e81cb10e090f4b95 100644 (file)
-%!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
 
-/xoffset 30 def
-/yoffset 700 def
-/staffrulethickness 1 def
-/staffheight 20 def
+% To let gs load fonts from builddir, do:
+% export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
 
-/placebox
-{
-       /object exch def
-       gsave
-       %exch translate
-       translate
-       0 0 moveto
-       object
-       grestore
-} bind def
 
-/setbold % '(' text ')'
-{
-       settext
-} bind def
-/settext % '(' text ')'
-{
-       gsave
-       % urg
-       /Times-Roman findfont 12 scalefont setfont
-       show
-       grestore
-} bind def
+/set-ps-scale-to-lily-scale { output-scale output-scale scale } bind def
 
-/setfinger % '(' text ')'
-{
-       gsave
-       % urg
-       /feta-nummer5 findfont 12 scalefont setfont
-       show
-       grestore
-} bind def
 
-/setitalic % '(' text ')'
-{
+/init-paper {
        gsave
-       % urg
-       /Times-Italic findfont 12 scalefont setfont
-       show
+       .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
 
-/vrule % width height depth
-{
-       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
-} bind def
-
-/extender % width
+/place-box
 {
+       /object exch def
        gsave
+       %exch translate
+       translate
        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
+       object
        grestore
 } bind def
 
-/doublebar
-{
-       thinbar
-} bind def
+%% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
 
-/repeatbar
-{
-       thickbar
-} bind def
-
-/repeatbarstartrepeat
-{
-       thickbar
-} bind def
+%/FONTLENGTH 256 bind def
 
-/startbar
+%<font> <encoding> <name> reencode-font
+/reencode-dict 5 dict def
+/reencode-font
 {
-       thickbar
+    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
 
-/startrepeat
+/start-system % x y
 {
-       thickbar
+    gsave
+    exch output-scale mul exch
+    output-scale mul vsize exch sub translate
 } 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
-} bind def
-
-/unknown { (U) setbold } bind def
-/empty { (E) setbold } bind def
-
-/turnOnExperimentalFeatures { } bind def
-
-/rulesym % thick length
+/end-lilypond-output
 {
-       gsave
-       exch setlinewidth
-       0 lineto stroke
-       grestore
+%    showpage
 } bind def
 
-(lily.ps) findlibfile 
-{
-       exch pop //systemdict /run get exec
-} 
-{ 
-       /undefinedfilename signalerror 
-} ifelse
+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