]> git.donarmstrong.com Git - lilypond.git/blob - tex/lily-ps-defs.tex
patch::: 1.1.25.jcn1: jcn1
[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 % transplant a TeX dimension into the PS output.
18 \def\PSsetTeXdimen#1{\expandafter\special{! /#1 (\the\csname #1\endcsname) deftexdimen}}
19
20 {%
21    \def\par{ }%         %Ugh.  Don't try this at home, kids!
22    % neat file-include trick by Piet van Oostrum <piet@cs.uu.nl>
23    \newread\defin 
24    \newtoks\toksfiledefi\newtoks\toksfiledefii 
25    \def\ifnot#1{#1\else\expandafter\expandafter\fi\iffalse\iftrue\fi} 
26    \def\filedef#1#2{%#1=command name, #2=file name 
27            \openin\defin=#2\relax\def#1{} 
28            \ifeof\defin
29                    \message{***************** CAN NOT OPEN #2 ********************}
30                    \end
31            \fi 
32            \loop\ifnot{\ifeof\defin}\read\defin to\tempfiledef
33            \toksfiledefi=\expandafter{#1}% 
34            \toksfiledefii=\expandafter{\tempfiledef}% 
35    %        \expandafter\special\expandafter{!\the\toksfiledefi\the\toksfiledefii}\repeat%
36           \global\edef#1{\the\toksfiledefi\the\toksfiledefii}\repeat%
37    }
38    %
39    % This seems a little backwards, but we don't want to include the PS
40    % stuff too early
41    %
42    \filedef\includelilyps{lily.ps}%
43    \expandafter\special{! \includelilyps }
44 }
45
46
47 \special{!
48 % PS helper: convert (0.2pt) to the token 0.2
49 /settexdimen
50 {
51         /thestring exch def
52         thestring 0 thestring length 2 sub
53         getinterval
54         token
55         pop exch pop 
56 } def
57 %
58 /deftexdimen
59 {
60         settexdimen
61         def     
62 } def
63 }
64
65 \def\turnOnPostScript{%
66         \PSsetTeXdimen{stafflinethickness}
67         \PSsetTeXdimen{staffheight}
68         
69         % This sets CTM so that you get to the currentpoint
70         % by executing a 0 0 moveto
71         \def\embeddedps##1{%
72                 \special{ps: @beginspecial @setspecial ##1 @endspecial}       
73         }
74         %
75
76         \special{! 
77 /interline \mudelapaperinterline0  def % ugh.  Only works x.yyyy floats 
78 interline 3 div /bracket_b exch def
79 interline 2 mul /bracket_w exch def
80 stafflinethickness 2 mul /bracket_t exch def
81 interline 1.5 mul /bracket_v exch def
82 bracket_v /bracket_u exch def
83 50 /bracket_alpha exch def
84 staffheight 4 div /interline exch def
85 1 setlinecap}
86 }
87
88 \def\turnOnExperimentalFeatures{}
89