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