]> git.donarmstrong.com Git - lilypond.git/blobdiff - tex/lily-ps-defs.tex
Merge branch 'master' of ssh://kainhofer@git.sv.gnu.org/srv/git/lilypond into dev...
[lilypond.git] / tex / lily-ps-defs.tex
index e94d19886979f04b6313bd9bdf116306d64c67eb..4a05f9d46fba820359d498e7d56eb8a9f41f3cef 100644 (file)
@@ -1,42 +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}}
 
-{%
-   \def\par{ }%         %Ugh.  Don't try this at home, kids!
-   % neat file-include trick by Piet van Oostrum <piet@cs.uu.nl>
-   \newread\defin 
-   \newtoks\toksfiledefi\newtoks\toksfiledefii 
-   \def\ifnot#1{#1\else\expandafter\expandafter\fi\iffalse\iftrue\fi} 
-   \def\filedef#1#2{%#1=command name, #2=file name 
-           \openin\defin=#2\relax\def#1{} 
-           \ifeof\defin
-                   \message{***************** CAN NOT OPEN #2 ********************}
-                   \end
-           \fi 
-           \loop\ifnot{\ifeof\defin}\read\defin to\tempfiledef
-           \toksfiledefi=\expandafter{#1}% 
-           \toksfiledefii=\expandafter{\tempfiledef}% 
-   %        \expandafter\special\expandafter{!\the\toksfiledefi\the\toksfiledefii}\repeat%
-          \global\edef#1{\the\toksfiledefi\the\toksfiledefii}\repeat%
-   }
-   %
-   % This seems a little backwards, but we don't want to include the PS
-   % stuff too early
-   %
-   \filedef\includelilyps{lily.ps}%
-   \expandafter\special{! \includelilyps }
-}
+\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}}}
+
+\endlinechar \lilypsdefsELC
+\endinput
+
+%% end lily-ps-defs.tex