]> git.donarmstrong.com Git - lilypond.git/blob - ps/lilyponddefs.ps
b4116e2b21276363c483052fb4b85d47852856f0
[lilypond.git] / ps / lilyponddefs.ps
1 %!PS-Adobe-2.0: lilyponddefs.ps
2 % TODO:
3 %  * junk all magic, start-line/stop-line just: placebox @ x.y
4 %
5 % Functions for direct PostScript output
6
7 % /setgray { 1 add } bind def
8
9 % To let gs load fonts from builddir, do:
10 % export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
11
12 /staff-line-thickness lilypondpaperlinethickness def
13 /staff-height lilypondpaperstaffheight def
14 /line-width lilypondpaperlinewidth def
15
16 /lily-output-units 2.83464  def  %% milimeter
17 % /lily-output-units 0.996264  def  %% true points.
18
19 /output-scale lilypondpaperoutputscale lily-output-units mul def
20
21 /set-ps-scale-to-lily-scale { output-scale output-scale scale } bind def
22
23 /paper-size { lilypondpaperpapersize } bind def
24
25 /init-paper {
26         gsave
27         .1 setlinewidth
28         clippath pathbbox newpath
29         /vsize exch def
30         /hsize exch def pop pop pop pop
31         % FIXME
32         /top-margin 2 def
33         hsize line-width sub 2 div /left-margin exch def
34         grestore
35 } bind def
36
37 /place-box
38 {
39         /object exch def
40         gsave
41         %exch translate
42         translate
43         0 0 moveto
44         object
45         grestore
46 } bind def
47
48 %% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
49
50 %/FONTLENGTH 256 bind def
51
52 %<font> <encoding> <name> reencode-font
53 /reencode-dict 5 dict def
54 /reencode-font
55 {
56     reencode-dict
57     begin
58     /name exch def
59     /encoding exch def
60     /base-font exch def
61     % note: Needs ps level 2
62     /font base-font maxlength dict def
63     base-font {
64         exch dup dup /FID ne exch /Encoding ne and
65         { exch font 3 1 roll put }
66         { pop pop } ifelse
67     } forall
68     font /FontName name put
69     font /Encoding encoding put
70     name font definefont pop
71     end
72 } bind def
73
74 /start-page
75 {
76 } bind def
77
78 /stop-page
79 {
80     showpage
81 } bind def
82
83 /stop-last-page
84 {
85 } bind def
86
87 /start-system % x y
88 {
89     gsave
90     exch output-scale mul exch
91     output-scale mul vsize exch sub translate
92 } bind def
93
94 /stop-system
95
96     /the-line exch def
97     the-line stroke grestore
98 } bind def
99
100 /end-lilypond-output
101 {
102 %    showpage
103 } bind def
104
105 staff-line-thickness setlinewidth
106
107 % set postscript paper size
108 paper-size
109
110 % initialise paper dimensions
111 staff-height init-paper
112
113 % end lilyponddefs.ps