-% ugh
-% see e.g. input/test/beam-pos.ly
-%
-% something's wrong with the aligment; sometimes all symbols
-% look to be placed a bit too high (there's an ugly fix for
-% the staccato-dot in script.cc)
-% but this varies from line to line: it seems that xdvi
-% does some rounding; i can't really check this from screen on i
-% 600x600 res.
-%
-\def\rulesym#1#2{\dimen0=#1 %obsolete
- \vrule height .5\dimen0 depth .5\dimen0 width #2}
-\def\shiftedrulesym#1#2{\dimen0=#1%
- \vrule height .7\dimen0 depth .3\dimen0 width #2}
-\def\tinyrulesym#1#2{\dimen0=#1%
- \vrule height .1\dimen0 depth .1\dimen0 width #2}
-%would be nice for checking alignment
-\def\openrulesym#1#2{\dimen0=#1%
- \vbox to \dimen0{\vss%
- \hbox{\vrule height .1\dimen0 width #2}%
- \hbox{\vrule height .2\dimen0 width 0pt}%
- \hbox{\vrule height .4\dimen0 width #2}%
- \hbox{\vrule height .2\dimen0 width 0pt}%
- \hbox{\vrule height .1\dimen0 width #2}%
- \vss}}
-%\let\rulesym\shiftedrulesym
-%\let\rulesym\tinyrulesym
-%\let\rulesym\openrulesym
-
-% the interline symbol. Redefine to remove it.
-\def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
-\def\lineseparator{\defaultlineseparator}
-\def\beauty{%
- \par\vskip 10pt plus 30pt minus 10pt\par
- \hskip -5pt\lineseparator
- \par\vskip 10pt plus 30pt minus 10pt\par
-}
+ {%% Otherwise center output horizontally, without changing the
+ %% vertical positioning.
+ \hsize\lilypondpaperlinewidth\lilypondpaperunit
+ \lytempdim \paperwidth
+ \advance\lytempdim -\the\hsize
+ \lytempdim 0.5\lytempdim
+ \advance\lytempdim -1in
+ \oddsidemargin \lytempdim
+ \evensidemargin \lytempdim}
+
+ \parindent 0pt
+
+ %% We can't directly say `\begin{document}' in this macro since
+ %% older versions of texinfo.tex define \begin as \outer; this
+ %% means that it causes an error if \begin is found within another
+ %% macro (even if the corresponding code will never be executed).
+ %% As a workaround we use \csname to call \begin.
+ \csname begin\endcsname{document}}}
+ \x}
+
+%% The opposite of \lilypondstart.
+%%
+\gdef\lilypondend{
+ %% Handle the `lastpagefill' parameter from the \layout block.
+ %% Ignore it if \lilypondbook is defined.
+ \lilypondifundefined{lilypondbook}
+ {\lilypondifundefined{lilypondpaperlastpagefill}
+ {\vskip 0pt plus\lilypondpaperinterscorelinefill00 fill}
+ {}}
+ {}
+
+ \begingroup
+ \lilypondifundefined{lilyponddocument}
+ {\def\x{
+ \endgroup}}
+ {\def\x{
+ \endgroup
+ \csname end\endcsname{document}}}
+ \x}
+
+%% Load the PostScript drawing routines. This is done using \special.
+%% To avoid multiple inclusions, redefine \lilypondspecial to a no-op
+%% afterwards.
+%%
+\gdef\lilypondspecial{
+ \special{header=music-drawing-routines.ps}
+ \gdef\lilypondspecial{}}
+
+%% The most used macro in LilyPond output. Put #3 into a zero-width box
+%% which is moved to the right by #1 (scaled by \outputscale) and moved
+%% up by #2 (also scaled by \outputscale).
+%%
+\gdef\lyitem#1#2#3{
+ \raise #2\outputscale \hbox to 0pt {
+ \kern #1\outputscale
+ #3
+ \hss}}
+
+%% All LilyPond music data is enclosed in this macro (as third argument).
+%% The data (which consists of boxes with zero width) gets an artificial
+%% width of #1 and a height of #2. The resulting box is then centered
+%% vertically along the x-height of the current font.
+%%
+%% Parameters #1 and #2 are scaled by \outputscale.
+%%
+\gdef\lybox#1#2#3{
+ \lytempdim #2\outputscale
+ \lytempdim -0.5\lytempdim
+ \advance\lytempdim 1ex
+ \leavevmode
+ \raise \lytempdim \hbox to #1\outputscale {
+ %% Convert depth of #3 into height only.
+ \vbox to #2\outputscale {\hbox{#3}\vss}
+ \hss}}