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 108<br />
We were able to do this for markup text by using the \textLengthOn command, but there is<br />
no equivalent command for dynamic marks. So we shall have to work out how to do this using<br />
\override commands.<br />
Grob sizing<br />
First we must learn how grobs are sized. All grobs have a reference point defined within them<br />
which is used to position them relative to their parent object. This point in the grob is then<br />
positioned at a horizontal distance, X-offset, and at a vertical distance, Y-offset, from its<br />
parent. The horizontal extent of the object is given by a pair of numbers, X-extent, which say<br />
where the left and right edges are relative to the reference point. The vertical extent is similarly<br />
defined by a pair of numbers, Y-extent. These are properties of all grobs which support the<br />
grob-interface.<br />
By default, outside-staff objects are given a width of zero so that they may overlap in the<br />
horizontal direction. This is done by the trick of adding infinity to the leftmost extent and<br />
minus infinity to the rightmost extent by setting the extra-spacing-width to '(+inf.0 . -<br />
inf.0). So to ensure they do not overlap in the horizontal direction we must override this value<br />
of extra-spacing-width to '(0 . 0) so the true width shines through. This is the command<br />
to do this for dynamic text:<br />
\override DynamicText #'extra-spacing-width = #'(0 . 0)<br />
Let’s see if this works in our previous example:<br />
\dynamicUp<br />
\override DynamicText #'extra-spacing-width = #'(0 . 0)<br />
a4\f b\mf c\mp b\p<br />
�<br />
�<br />
fmfmp<br />
p<br />
� � � �<br />
Well, it has certainly stopped the dynamic marks being displaced, but two problems remain.<br />
The marks should be spaced a little further apart and it would be better if they were all the<br />
same distance from the staff. We can solve the first problem easily. Instead of making the<br />
extra-spacing-width zero we could add a little more to it. The units are the space between<br />
two staff lines, so moving the left edge half a unit to the left and the right edge half a unit to<br />
the right should do it:<br />
\dynamicUp<br />
% Extend width by 1 staff space<br />
\override DynamicText #'extra-spacing-width = #'(-0.5 . 0.5)<br />
a4\f b\mf c\mp b\p<br />
�<br />
� mp f mf p<br />
� � � �<br />
This looks better, but maybe we would prefer the dynamic marks to be aligned along the same<br />
baseline rather than going up and down with the notes. The property to do this is staffpadding<br />
which is covered in the following section.