Hello, I'm trying to set the font-name for a hairpin with centered text later in the score, and not in the definition of the function. However, my attempt, in the snippet below, doesn't work. How can I fix this?
Thanks, P %%%%% hairpinWithCenteredText = #(define-music-function (text) (markup?) #{ \once \override Score.Hairpin.after-line-breaking = #(lambda (grob) (let* ((stencil (ly:hairpin::print grob)) (par-y (ly:grob-parent grob Y)) (dir (ly:grob-property par-y 'direction)) (new-stencil (ly:stencil-aligned-to (ly:stencil-combine-at-edge (ly:stencil-aligned-to stencil X CENTER) Y dir (ly:stencil-aligned-to (grob-interpret-markup grob text) X CENTER)) X LEFT)) (staff-space (ly:output-def-lookup (ly:grob-layout grob) 'staff-space)) (staff-line-thickness (ly:output-def-lookup (ly:grob-layout grob) 'line-thickness)) (par-x (ly:grob-parent grob X)) (dyn-text (grob::has-interface par-x 'dynamic-text-interface)) (dyn-text-stencil-x-length (if dyn-text (interval-length (ly:stencil-extent (ly:grob-property par-x 'stencil) X)) 0)) (x-shift (if dyn-text (- (+ staff-space dyn-text-stencil-x-length) (* 0.5 staff-line-thickness)) 0))) (ly:grob-set-property! grob 'Y-offset 0) (ly:grob-set-property! grob 'stencil (ly:stencil-translate-axis new-stencil x-shift X)))) #}) #(define textFontName "Liberation Sans, Italic") hairpinPoco = { \once \override Score.DynamicLineSpanner.staff-padding = 2 \hairpinWithCenteredText \markup { \override #(cons 'font-name textFontName) \abs-fontsize #6 poco } } { % The following command doesn't change the font name... #(set! textFontName "Liberation Sans") \hairpinPoco c'4\< c' c' c'\! } %%%%%