]> git.donarmstrong.com Git - lilypond.git/blob - tex/lily-ps-defs.tex
patch::: 1.1.5.jcn2: extender
[lilypond.git] / tex / lily-ps-defs.tex
1 %
2 % WARNING: don't leave blank lines in the PS-code; they are
3 % transformed into \par 
4 %
5
6 %
7 % header info (macros/defs, etc) should go into a \special{! ... }, 
8 % note the ! sign.  See dvips.info for details.
9 %
10
11 % Use of 
12 % /foo { operatorname } bind def
13 %
14 % ``compiles'' operatorname binding in the body of foo, making
15 % the code faster, and more reliable (less flexible)
16
17 %must come before PSTeXDimen
18 \special{!
19 % PS helper: convert (0.2pt) to the token 0.2
20 /settexdimen
21 {
22         /thestring exch def
23         thestring 0 thestring length 2 sub
24         getinterval
25         token
26         pop exch pop 
27 } def
28 %
29 /deftexdimen
30 {
31         settexdimen
32         def     
33 } def
34 }
35 % transplant a TeX dimension into the PS output.
36 \def\PSsetTeXdimen#1{\expandafter\special{! /#1 (\the\csname #1\endcsname) deftexdimen}}
37 % must come before lily.ps
38 \PSsetTeXdimen{stafflinethickness}
39 \PSsetTeXdimen{staffheight}
40 {%
41    \def\par{ }%         %Ugh.  Don't try this at home, kids!
42    % neat file-include trick by Piet van Oostrum <piet@cs.uu.nl>
43    \newread\defin 
44    \newtoks\toksfiledefi\newtoks\toksfiledefii 
45    \def\ifnot#1{#1\else\expandafter\expandafter\fi\iffalse\iftrue\fi} 
46    \def\filedef#1#2{%#1=command name, #2=file name 
47            \openin\defin=#2\relax\def#1{} 
48            \ifeof\defin
49                    \message{***************************************}
50                    \message{lily-ps-defs.tex: can't open `#2'}
51                    \message{***************************************}
52                    \end
53            \fi 
54            \loop\ifnot{\ifeof\defin}\read\defin to\tempfiledef
55            \toksfiledefi=\expandafter{#1}% 
56            \toksfiledefii=\expandafter{\tempfiledef}% 
57    %        \expandafter\special\expandafter{!\the\toksfiledefi\the\toksfiledefii}\repeat%
58           \global\edef#1{\the\toksfiledefi\the\toksfiledefii}\repeat%
59    }
60    %
61    % This seems a little backwards, but we don't want to include the PS
62    % stuff too early
63    %
64    \filedef\includelilyps{lily.ps}%
65    \expandafter\special{! \includelilyps}
66 }
67
68
69
70 \def\turnOnPostScript{%
71         \PSsetTeXdimen{stafflinethickness}
72         \PSsetTeXdimen{staffheight}
73         
74         % This sets CTM so that you get to the currentpoint
75         % by executing a 0 0 moveto
76         \def\embeddedps##1{%
77                 \special{ps: @beginspecial @setspecial ##1 @endspecial}       
78         }
79         %
80
81         \special{! 
82 /interline \mudelapaperinterline0  def % ugh.  Only works x.yyyy floats 
83 stafflinethickness 1.2 mul /plet_t exch def
84 interline 3 div /bracket_b exch def
85 interline 2 mul /bracket_w exch def
86 stafflinethickness 2 mul /bracket_t exch def
87 interline 1.5 mul /bracket_v exch def
88 bracket_v /bracket_u exch def
89 50 /bracket_alpha exch def
90 staffheight 4 div /interline exch def
91 1 setlinecap}
92 }
93
94 \def\turnOnExperimentalFeatures{}
95