]> git.donarmstrong.com Git - lilypond.git/blob - ps/lilyponddefs.ps
(dump-stencil-as-EPS): robustness: ensure
[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
13 /set-ps-scale-to-lily-scale {
14         lily-output-units output-scale mul
15         lily-output-units output-scale mul scale
16 } bind def
17
18
19 /init-paper {
20         gsave
21         clippath pathbbox newpath
22         /vsize exch def
23         /hsize exch def pop pop pop
24         % FIXME
25         /top-margin 2 def
26         hsize line-width sub 2 div /left-margin exch def
27         grestore
28 } bind def
29
30
31 /place-box {
32         /object exch def
33         gsave
34         % exch translate
35         translate
36         0 0 moveto
37         object
38         grestore
39 } bind def
40
41 %% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
42
43 %/FONTLENGTH 256 bind def
44
45
46 /reencode-dict 5 dict def
47
48
49 %<font> <encoding> <name> reencode-font
50 /reencode-font {
51         reencode-dict begin
52                 /name exch def
53                 /encoding exch def
54                 /base-font exch def
55                 % note: Needs ps level 2
56                 /font base-font maxlength dict def
57                 base-font {
58                         exch dup dup /FID ne exch /Encoding ne and
59                         { exch font 3 1 roll put }
60                         { pop pop } ifelse
61                 } forall
62                 font /FontName name put
63                 font /Encoding encoding put
64                 name font definefont pop
65         end
66 } bind def
67
68
69 % start-system
70 /start-system {
71     gsave
72 } bind def
73
74 /start-page {
75     gsave
76     0
77     vsize translate
78 } bind def
79
80
81 /stop-system {
82         /the-line exch def
83         the-line stroke grestore
84 } bind def
85
86
87 /end-lilypond-output {
88 %       showpage
89 } bind def
90
91
92 /init-lilypond-parameters {
93         staff-line-thickness setlinewidth
94         staff-height init-paper
95 } bind def
96
97
98 % end lilyponddefs.ps