]> git.donarmstrong.com Git - lilypond.git/blobdiff - tex/lily-ps-defs.tex
Merge master into nested-bookparts
[lilypond.git] / tex / lily-ps-defs.tex
index da9907c536de0d950d32eee236e6d375a25182cc..4a05f9d46fba820359d498e7d56eb8a9f41f3cef 100644 (file)
@@ -1,38 +1,43 @@
-%
-% WARNING: don't leave blank lines in the PS-code; they are
-% transformed into \par 
-%
+%% lily-ps-defs.tex
+%%
+\edef\lilypsdefsELC{\the\endlinechar}%
+\endlinechar -1\relax
 
-%
-% header info (macros/defs, etc) should go into a \special{! ... }, 
-% note the ! sign.  See dvips.info for details.
-%
+%% Header info (macros/defs, etc) should go into a \special{! ... };
+%% note the ! sign.  See dvips.info for details.
+%%
+%% We protect punctuation characters with \string to avoid problems with
+%% language specific shorthands (e.g. `:' for French, `"' for German, etc.).
 
-% Use of 
-% /foo { operatorname } bind def
-%
-% ``compiles'' operatorname binding in the body of foo, making
-% the code faster, and more reliable (less flexible)
+\gdef\lilypondsetdimen#1{
+  \expandafter\gdef\csname #1ps\endcsname{}
+  \special{
+    \string!
+    /#1 (\csname #1\endcsname) set_tex_dimen}}
 
+\gdef\lilypondspace{ }
 
-\def\turnOnPostScript{%
-        % This sets CTM so that you get to the currentpoint
-        % by executing a 0 0 moveto
-        \def\embeddedps##1{%
-                \special{ps: @beginspecial @setspecial ##1 @endspecial}       
-        }
-        %
-        \special{! 
-/stafflinethickness \mudelapaperstaffline\space def
-/interline \mudelapaperinterline\space def
-interline 3 div /bracket_b exch def
-interline 2 mul /bracket_w exch def
-stafflinethickness 2 mul /bracket_t exch def
-interline 1.5 mul /bracket_v exch def
-bracket_v /bracket_u exch def
-50 /bracket_alpha exch def
-1 setlinecap}
-}
+\gdef\lilypondpostscript{
+  %% A document processed with lilypond-book can contain music fragments in
+  %% different sizes.  To reduce overhead, we define `lyscaleXXX' PS macros
+  %% only once.
+  \lilypondifundefined{lyscale\lilypondpaperoutputscale}
+    {\expandafter\gdef\csname lyscale\lilypondpaperoutputscale\endcsname{}
+     %% This sets CTM so that you get to the currentpoint
+     %% by executing a 0 0 moveto
+     \special{
+       \string!
+       /lyscale\lilypondpaperoutputscale
+         {\lilypondpaperoutputscale\lilypondspace\scaletounit %
+          dup scale} def}}
+    {}
+                      
+  \def\embeddedps##1{
+    \special{
+      \string"
+      lyscale\lilypondpaperoutputscale\lilypondspace ##1}}}
 
-\def\turnOnExperimentalFeatures{}
+\endlinechar \lilypsdefsELC
+\endinput
 
+%% end lily-ps-defs.tex