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