Hello, LSR 393 contains many methods to align a piece of custom dynamics text like "sub. pp" or something on the dynamics, with each methods having some drawbacks, like using TextScript, overriding X-offset, adding nonsensical horizontal space at the end, setting the dimensions of the text to (0,0), (0,0), using translation in the markup and setting X-offset.
I’ve come up with a nice method that achieves this with much less effort and caveats. The idea is to create a markup command to wrap (ly:stencil-combine-at-edge markup2 X LEFT markup1 nice-value-for-padding) and then define our #(make- dynamic-script ...) with the dynamics centered and the text added to the left using this command. Now we only need to prevent the self-alignment-interface to center this thing again, which we can do by simply tweaking self-alignment-X to #f. We can of course also do this to add to the right, though this does not require such a custom function. The important thing is that the "first" (not counting markups added to the left) markup is centered. So I thought I’d share this with you. Cheers, Valentin
#(define-markup-command (add-left layout props m1 m2) (markup? markup?) (let* ((stc1 (interpret-markup layout props m1)) (stc2 (interpret-markup layout props m2))) (ly:stencil-combine-at-edge stc2 X LEFT stc1 0.6))) %%% sub. pp aligned on pp subpp = \tweak self-alignment-X ##f #(make-dynamic-script (markup #:add-left #:normal-text #:italic "sub." ; sub. added on the left #:center-align #:dynamic "pp")) % core markup (pp) %%% ff molto aligned on ff ffmolto = \tweak self-alignment-X ##f #(make-dynamic-script (markup #:center-align #:dynamic "ff" ; core markup (ff) #:normal-text #:italic "molto")) % molto on the right %%% sub. f molto aligned on f subfmolto = \tweak self-alignment-X ##f #(make-dynamic-script (markup #:add-left #:normal-text #:italic "sub." ; sub. added on the left #:center-align #:dynamic "f" ; core markup (f) #:normal-text #:italic "molto")) % molto added on the right %%% p.f with explaining text behind aligned on the p.f pocofbutless = \tweak self-alignment-X ##f #(make-dynamic-script (markup #:center-align ; CORE MARKUP #:concat ( #:normal-text #:italic "p." ;; p. #:dynamic "f" ;; f ) ; END OF CORE MARKUP #:normal-text #:italic ; some text added on the right #:fontsize -3 "(but less than before)")) %%% p/f with explanation before choice = \tweak self-alignment-X ##f #(make-dynamic-script (markup #:add-left #:normal-text #:italic ; some text added on the left #:fontsize -3 #:line ( "(choose different dynamics at repeats)" ) #:center-align ; CORE MARKUP #:concat ( #:dynamic "p" ;; p #:normal-text #:bold #:fontsize 2 #:lower 0.5 "/" ;; / #:hspace 0.2 ;; small kern for the f #:dynamic "f" ;; f ))) % END OF CORE MARKUP { f'4\f f' f' f' f'\subpp\< f' f' f' f'\ffmolto f' f' f' f'4\pp f' f' f' f'\subfmolto f' f' f' f'\pocofbutless f' f' f' \break R1*2 f'1\choice }
signature.asc
Description: This is a digitally signed message part.