Hi Torsten,
Am 12.10.2018 um 00:56 schrieb Torsten Hämmerle:
Hi Urs, The centering of the slur stencil destroys its alignment (i.e. reference point), so I'd just leave it alone and center-align the text by explicitly calculating the necessary markup x shift from the stencil extents. %%%%%%%%%%%%%%%%%% \version "2.19.82" annotatedSlur = #(define-music-function (padding text) ((number? 1) markup?) #{ \once \override Slur.after-line-breaking = #(lambda (grob) (let* ((stencil (ly:slur::print grob)) (dir (ly:grob-property grob 'direction)) (markup-stencil (grob-interpret-markup grob text)) (shift (- (interval-center (ly:stencil-extent stencil X)) (interval-center (ly:stencil-extent markup-stencil X)))) (new-stencil (ly:stencil-combine-at-edge stencil Y dir (ly:stencil-translate-axis markup-stencil shift X) padding))) (ly:grob-set-property! grob 'stencil new-stencil))) #}) { \annotatedSlur %\markup \score { c''' } \markup "hin." c''4 ( g' g' c'' ) } %%%%%%%%%%%%%%%%%% HTH, Torsten
Thank you very much, this indeed fixes the horizontal alignment problem in a clean and understandable way - although I wouldn't have known how to do it. What is 'interval-center'? Grepping the source doesn't show a definition, so I'd assume it's in the C++ domain? I haven't found anything about that in the documentation (or through Google).
Urs _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user