]> git.donarmstrong.com Git - lilypond.git/blobdiff - tex/lily-ps-defs.tex
(ly:optimal-page-breaks): Bugfix: underful
[lilypond.git] / tex / lily-ps-defs.tex
index 99a7e13c2cc83c882feb389c0f39d6d01b4421d6..8a4522a2e72048a8fe547e359ee2afc80d890ccf 100644 (file)
@@ -1,66 +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.
 %
+% 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
+  }
+}
 
-% transplant a TeX dimension into the PS output.
-\def\PSsetTeXdimen#1{\expandafter\special{! /#1 (\the\csname #1\endcsname) deftexdimen}}
+\gdef\lilypondspace{ }
 
-\def\turnOnPostScript{%
-\special{!
-% PS helper: convert (0.2pt) to the token 0.2
-/settexdimen
-{
-       /thestring exch def
-        thestring 0 thestring length 2 sub
-        getinterval
-        token
-        pop exch pop 
-} def
-%
-/deftexdimen
-{
-        settexdimen
-        def     
-} def
-}
-\PSsetTeXdimen{staffrulethickness}
-\PSsetTeXdimen{staffheight}
-% urg, no dvips.info over here...
-%\special{! \input lily.ps }
-\special{!
-(lily.ps) findlibfile 
-{
-       exch pop //systemdict /run get exec
-} 
-{ 
-       /undefinedfilename signalerror 
-} ifelse
-}
-%
-\def\embeddedps##1{%
-        % This sets CTM so that you get to the currentpoint
-        % by executing a 0 0 moveto
-        \special{ps: @beginspecial @setspecial ##1 @endspecial}       
-}
-%
-%
-%\PSsetTeXdimen{staffrulethickness}
-%\PSsetTeXdimen{staffheight}
+\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{%
-\special{ps:
-}}
+\gdef\lilypondexperimentalfeatures{}
 
+\endlinechar \lilypsdefsELC
+\endinput