10.04.2013 Views

in Snippets - LilyPond

in Snippets - LilyPond

in Snippets - 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.

Tweaks and overrides 421<br />

Horizontally align<strong>in</strong>g custom dynamics (e.g. "sempre pp" "piu<br />

f" "subito p")<br />

Some dynamic expressions <strong>in</strong>volve additional text, like “sempre pp”. S<strong>in</strong>ce dynamics are usually<br />

centered under the note, the \pp would be displayed way after the note it applies to.<br />

To correctly align the “sempre pp” horizontally, so that it is aligned as if it were only the<br />

\pp, there are several approaches:<br />

* Simply use \once\override DynamicText #'X-offset = #-9.2 before the note with the<br />

dynamics to manually shift it to the correct position. Drawback: This has to be done manually<br />

each time you use that dynamic markup... * Add some padd<strong>in</strong>g (#:hspace 7.1) <strong>in</strong>to the<br />

def<strong>in</strong>ition of your custom dynamic mark, so that after lilypond center-aligns it, it is already<br />

correctly aligned. Drawback: The padd<strong>in</strong>g really takes up that space and does not allow any<br />

other markup or dynamics to be shown <strong>in</strong> that position.<br />

* Shift the dynamic script \once\override ... #'X-offset = ... Drawback:<br />

\once\override is needed for every <strong>in</strong>vocation!<br />

* Set the dimensions of the additional text to 0 (us<strong>in</strong>g #:with-dimensions '(0 . 0) '(0 .<br />

0)). Drawback: To <strong>LilyPond</strong> “sempre” has no extent, so it might put other stuff there and<br />

create collisions (which are not detected by the collision detection!). Also, there seems to be<br />

some spac<strong>in</strong>g, so it’s not exactly the same alignment as without the additional text<br />

* Add an explicit shift<strong>in</strong>g directly <strong>in</strong>side the scheme function for the dynamic-script.<br />

* Set an explicit alignment <strong>in</strong>side the dynamic-script. By default, this won’t have any effect,<br />

only if one sets X-offset! Drawback: One needs to set DynamicText #'X-offset, which will<br />

apply to all dynamic texts! Also, it is aligned at the right edge of the additional text, not at the<br />

center of pp.<br />

\header { title = "Horizontally align<strong>in</strong>g custom dynamics" }<br />

\paper { ragged-right = ##f }<br />

% Solution 1: Us<strong>in</strong>g a simple markup with a particular halign value<br />

% Drawback: It's a markup, not a dynamic command, so \dynamicDown<br />

% etc. will have no effect<br />

semppMarkup = \markup { \halign #1.4 \italic "sempre" \dynamic "pp" }<br />

% Solution 2: Us<strong>in</strong>g a dynamic script & shift<strong>in</strong>g with<br />

% \once \override ... #'X-offset = ..<br />

% Drawback: \once \override needed for every <strong>in</strong>vocation<br />

semppK =<br />

#(make-dynamic-script<br />

(markup #:l<strong>in</strong>e<br />

(#:normal-text<br />

#:italic "sempre"<br />

#:dynamic "pp")))<br />

% Solution 3: Padd<strong>in</strong>g the dynamic script so the center-alignment<br />

% puts it at the correct position<br />

% Drawback: the padd<strong>in</strong>g really reserves the space, noth<strong>in</strong>g else can be there<br />

semppT =<br />

#(make-dynamic-script<br />

(markup #:l<strong>in</strong>e<br />

(#:normal-text<br />

#:italic "sempre"<br />

#:dynamic "pp"

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

Saved successfully!

Ooh no, something went wrong!