2017-09-12 0:03 GMT+02:00 Thomas Morley <thomasmorle...@gmail.com>: > Hi Xavier, > > 2017-09-11 22:05 GMT+02:00 Xavier Scheuer <x.sche...@gmail.com>: >> Thank you Thomas for working on this. >> >> Personally I came recently to think that "Doing The Right Thing™" >> would be to have on option to **align** texts on dynamics. >> >> Something like >> >> \override TextScript.align-on-simultaneous-dynamic = ##t >> >> and then >> >> c'1\mp_\markup \italic "dolce" % would give "mp dolce" >> >> We could even have an option to place text right or left from dynamics > > Well, I would need to do some tests. > Reading out DynamicText and TextScript and joining them into a single > expression for DynamicText. > Probably not impossible ...
A very first shot. No security, no conditions, don't use it for typesetting serious stuff, just an idea: #(define merge-dyn-txt (lambda (grob) (let* ((nc (ly:grob-parent grob X)) (pap-col (ly:item-get-column grob)) (elts-array (ly:grob-object pap-col 'elements)) (elts (if (ly:grob-array? elts-array) (ly:grob-array->list elts-array) '())) (dyn (filter (lambda (d) (grob::has-interface d 'dynamic-text-interface) ) elts)) (txt-scrpt (filter (lambda (txt) (eq? (grob::name txt) 'TextScript)) elts))) (ly:grob-set-property! (car txt-scrpt) 'stencil #f) (grob-interpret-markup grob (make-line-markup (list (ly:grob-property (car dyn) 'text) (make-normal-text-markup (ly:grob-property (car txt-scrpt) 'text)))))))) foo = \once \override DynamicText.stencil = #merge-dyn-txt { \foo c'1\mp_\markup \italic "dolce" d'-\tweak stencil #merge-dyn-txt \ffff-\markup \italic "barbaro" } Have fun, lol, Ham _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user