29.11.2012 Views

mpdolce - LilyPond

mpdolce - LilyPond

mpdolce - LilyPond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 4: Tweaking output 106<br />

�<br />

�<br />

�<br />

�<br />

�<br />

��<br />

�<br />

�<br />

�<br />

� � ��<br />

� � � ��<br />

�<br />

Changing the outside-staff-priority can also be used to control the vertical placement<br />

of individual objects, although the results may not always be desirable. Suppose we would<br />

like “Text3” to be placed above “Text4” in the example under Automatic behavior, above (see<br />

Section 4.4.1 [Automatic behavior], page 99). All we need to do is to look up the priority of<br />

TextScript in the IR or in the tables above, and increase the priority of “Text3” to a higher<br />

value:<br />

c2^"Text1"<br />

c^"Text2"<br />

\once \override TextScript #'outside-staff-priority = #500<br />

c^"Text3"<br />

c^"Text4"<br />

�<br />

�<br />

Text3<br />

Text2<br />

Text1 Text4<br />

�<br />

�<br />

� �<br />

This certainly lifts “Text3” above “Text4” but it also lifts it above “Text2”, and “Text4”<br />

now drops down. Perhaps this is not so good. What we would really like to do is to position all<br />

the annotation at the same distance above the staff. To do this, we clearly will need to space the<br />

notes out horizontally to make more room for the text. This is done using the textLengthOn<br />

command.<br />

\textLengthOn<br />

By default, text produced by markup takes up no horizontal space as far as laying out the music<br />

is concerned. The \textLengthOn command reverses this behavior, causing the notes to be<br />

spaced out as far as is necessary to accommodate the text:<br />

\textLengthOn % Cause notes to space out to accommodate text<br />

c2^"Text1"<br />

c^"Text2"<br />

c^"Text3"<br />

c^"Text4"<br />

�<br />

�<br />

Text1Text2 Text3Text4 � � � �<br />

The command to revert to the default behavior is \textLengthOff. Remember \once only<br />

works with \override, \set, \revert or unset, so cannot be used with \textLengthOn.<br />

Markup text will also avoid notes which project above the staff. If this is not desired, the<br />

automatic displacement upwards may be turned off by setting the priority to #f. Here’s an<br />

example to show how markup text interacts with such notes.<br />

% This markup is short enough to fit without collision<br />

c2^"Tex"<br />

c''2<br />

R1<br />

% This is too long to fit, so it is displaced upwards<br />

�<br />

�<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!