Am Di., 19. Nov. 2024 um 11:58 Uhr schrieb Mark Knoop <m...@opus11.net>: > > I'm looking for a way to set a hairpin's to-barline property depending on > whether the terminating grob it is attached to is a note or a rest. I'd like > hairpins which end on a rest to stop at the barline (to-barline = ##t), and > hairpins which end on a note to continue to the notehead column (to-barline = > ##f). > > In a grob-transformer function, how do I lookup the terminating grob? > > MWE: > > { > \override Hairpin.minimum-length = #5 > \override Hairpin.to-barline = ##t > r2 > e'2\ff\>~ 2~ 2~\p-\tweak color red \<^\markup \tiny "wrong: continue to > notehead" 8\! r8 r4 > e'2\ff\>~ 2~ 2\p\<^\markup \tiny "correct: stop at barline" r2\! > \break > \override Hairpin.to-barline = ##f > e'2\ff\>~ 2~ 2~\p\<^\markup \tiny "correct: continue to notehead" 8\! r8 r4 > e'2\ff\>~ 2~ 2\p-\tweak color red \< ^\markup \tiny "wrong: stop at > barline" r2\! > } > > > > -- > Mark Knoop >
Hi Mark, probably: \override Hairpin.to-barline = #(grob-transformer 'to-barline (lambda (grob orig) (let* ((right-bound (ly:spanner-bound grob RIGHT)) (nhds (ly:grob-object right-bound 'note-heads))) (if (ly:grob-array? nhds) #f #t)))) Cheers, Harm