]> git.donarmstrong.com Git - lilypond.git/blobdiff - ps/lilyponddefs.ps
* lily/ly-module.cc (LY_DEFINE): bugfix.
[lilypond.git] / ps / lilyponddefs.ps
index 49c77c451d08bc4ff6e547f556743e8e19c5be14..edd8448155b9180914a47431e81cb10e090f4b95 100644 (file)
@@ -1,24 +1,16 @@
-%!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
 
-/staff-line-thickness lilypondpaperstafflinethickness def
-/staff-height lilypondpaperstaffheight def
-/line-width lilypondpaperlinewidth def
+% To let gs load fonts from builddir, do:
+% export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
 
-% FIXME: why isn't this set (by default) by lily?
-% /text-height lilypondpapertextheight def
 
-/output-scale lilypondpaperoutputscale def
-/paper-size { lilypondpaperpapersize } bind def
-
-% FIXME
-% urg, read from paper block
-% fixed base line skip value, for single line staffs
-/base-line-skip lilypondpaperlineheight def
+/set-ps-scale-to-lily-scale { output-scale output-scale scale } bind def
 
 
 /init-paper {
        .1 setlinewidth
        clippath pathbbox newpath
        /vsize exch def
-       /hsize exch def  pop pop pop
-
-       %FIXME:
-       %vsize text-height sub 2 div /top-margin exch def
-       144 2 div /top-margin 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
        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
+%% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
 
-       grestore
-} bind def
+%/FONTLENGTH 256 bind def
 
-/start-line % height
+%<font> <encoding> <name> reencode-font
+/reencode-dict 5 dict def
+/reencode-font
 {
-       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
-       } if
-       gsave
-       line-x line-y translate
-} bind def
-
-/stop-line
-{ 
-       /the-line exch def
-       the-line
-       stroke
-       grestore
-       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
-} bind def
-
-/Large-bold-font {
-       /Times-Bold findfont 17.3 scalefont setfont
-} bind def
-
-/large-bold-font {
-       /Times-Bold findfont 14.4 scalefont setfont
-} bind def
-
-/large-font {
-       /Times-Roman findfont 14.4 scalefont setfont
-} bind def
-
-/large-smallcaps-font {
-       % urg
-       /Helvetica findfont 14.4 scalefont setfont
-} bind def
-
-/normal-font {
-       /Times-Roman findfont 12 scalefont setfont
-} bind def
-
-/footnote-font {
-       /Times-Roman findfont 10 scalefont setfont
-} bind def
-
-/get-text-dimensions % path .. width height
-{
-       dup true charpath pathbbox
-       newpath
-       line-x line-y moveto
-       exch 4 -1 roll
-       sub
-       3 1 roll
-       exch sub
-} bind def
-
-/set-centered
+    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
+
+/start-system % x y
 {
-       line-x line-y moveto
-       get-text-dimensions
-       neg line-y add /line-y exch def
-       neg line-width add 2 div 0 rmoveto
-       show
+    gsave
+    exch output-scale mul exch
+    output-scale mul vsize exch sub translate
 } bind def
 
-/set-left
-{
-       line-x line-y moveto
-       get-text-dimensions
-       neg line-y add /line-y exch def
-       pop
-       show
-} bind def
-
-/set-right
-{
-       line-x line-y moveto
-       get-text-dimensions
-       neg line-y add /line-y exch def
-       neg line-width add 0 rmoveto
-       show
-} bind def
-
-/make-lilypond-title
-{
-       currentdict /lilypondtitle known {
-               huge-bold-font lilypondtitle set-centered
-               line-y 5 sub /line-y exch def
-       } if
-       currentdict /lilypondsubtitle known {
-               Large-bold-font lilypondsubtitle set-centered
-               line-y 5 sub /line-y exch def
-       } if
-       currentdict /lilypondsubsubtitle known {
-               large-bold-font lilypondsubsubtitle set-centered
-       } if
-       currentdict /lilypondcomposer known {
-               large-smallcaps-font lilypondcomposer set-right
-       } if
-       currentdict /lilypondopus known {
-               normal-font lilypondopus set-right
-       } if
-       currentdict /lilypondarranger known {
-               normal-font lilypondarranger set-right
-       } if
-       currentdict /lilypondinstrument known {
-               large-font lilypondinstrument set-centered
-       } if
-       currentdict /lilypondpiece known {
-               large-smallcaps-font lilypondpiece set-left
-       } if
+/stop-system
+{ 
+    /the-line exch def
+    the-line stroke grestore
 } bind def
 
 /end-lilypond-output
 {
-       /line-y top-margin def
-       footnote-font lilypondtagline set-left
-       showpage
+%    showpage
 } bind def
 
-/turnOnExperimentalFeatures { } bind def
-
 staff-line-thickness setlinewidth
 
 % set postscript paper size
@@ -210,10 +88,4 @@ paper-size
 % initialise paper dimensions
 staff-height init-paper
 
-/line-x left-margin 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