]> git.donarmstrong.com Git - lilypond.git/blobdiff - tex/lily-ps-defs.tex
* input/no-notation/safe-include.ly:
[lilypond.git] / tex / lily-ps-defs.tex
index 30e8d1b992590263b704ca5df783885ef7d23adb..8a4522a2e72048a8fe547e359ee2afc80d890ccf 100644 (file)
@@ -1,33 +1,54 @@
+% lily-ps-defs.tex
 %
-% WARNING: don't leave blank lines in the PS-code; they are
-% transformed into \par 
-%
+\edef\lilypsdefsELC{\the\endlinechar}%
+\endlinechar -1\relax
 
-%
-% header info (macros/defs, etc) should go into a \special{! ... }, 
+% Header info (macros/defs, etc) should go into a \special{! ... };
 % note the ! sign.  See dvips.info for details.
 %
-% escape the colon with \string to avoid problems with french babel
-%
-\def\PSsetTeXdimen#1{\expandafter\special{! /#1 (\csname #1\endcsname) set_tex_dimen}}
-\def\lilySpace{ }
+% We protect punctuation characters with \string to avoid problems with
+% language specific shorthands (e.g. `:' for French, `"' for German, etc.).
 
-% for mm: 72.27/25.4
-\def\scaletounit{ 2.845276 mul }
+\gdef\lilypondsetdimen#1{
+  \expandafter\gdef\csname #1ps\endcsname{}
+  \special{
+    \string!
+    /#1 (\csname #1\endcsname) set_tex_dimen
+  }
+}
 
-% for true printers points to postscript points: 
-%\def\scaletounit{1.00375}
-\def\turnOnPostScript{%
-        % This sets CTM so that you get to the currentpoint
-        % by executing a 0 0 moveto
-        \def\embeddedps##1{%
-                \special{ps\string: @beginspecial @setspecial
-                        \lilypondpaperoutputscale\lilySpace\scaletounit
-                        \lilypondpaperoutputscale\lilySpace\scaletounit
-                        % FUCKING REDHAT XDVI -- ARG!
-                        skeel ##1 @endspecial}%
-        }
-        \PSsetTeXdimen{lilypondpaperblotdiameter}
+\gdef\lilypondspace{ }
+
+\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}
+  }
+
+  \lilypondifundefined{lilypondpaperblotdiameterps}
+    {\lilypondsetdimen{lilypondpaperblotdiameter}}
+    {}
 }
-\def\turnOnExperimentalFeatures{}
 
+\gdef\lilypondexperimentalfeatures{}
+
+\endlinechar \lilypsdefsELC
+\endinput