Re: TextSpanner to end of bar / end of piece
Hi Harm, So this seems to mean that right-broken.text should be changed by a hook that determines if we are at a line break. I'llt try to see if I can figure out how to do this. It seems to suffice to copy right.text into right-broken.text only for the last bit of a broken TextSpanner: \override TextSpanner.after-line-breaking = #(lambda (grob) ; Copies bound-details.right settings to bound-details.right-broken ; for the last part of a broken spanner. ; This is needed because, if to-barline = ##t and the last part ends ; at a line break, the values from right-broken are used. (let* ((orig (ly:grob-original grob)) (siblings (if (ly:grob? orig) (ly:spanner-broken-into orig) '( (if (not (null? siblings)) (if (eq? grob (car (last-pair siblings))) (ly:grob-set-nested-property! grob '(bound-details right-broken) (ly:assoc-get 'right (ly:grob-property grob 'bound-details))) Thanks for the hint, Harm! Lukas \version "2.22" spanTest = { \override TextSpanner.to-barline = ##t \override TextSpanner.bound-details.right-broken.text = ##f \override TextSpanner.after-line-breaking = #(lambda (grob) ; Copies bound-details.right settings to bound-details.right-broken ; for the last part of a broken spanner. ; This is needed because, if to-barline = ##t and the last part ends ; at a line break, the values from right-broken are used. (let* ((orig (ly:grob-original grob)) (siblings (if (ly:grob? orig) (ly:spanner-broken-into orig) '( (if (not (null? siblings)) (if (eq? grob (car (last-pair siblings))) (ly:grob-set-nested-property! grob '(bound-details right-broken) (ly:assoc-get 'right (ly:grob-property grob 'bound-details))) \override TextSpanner.bound-details.right.text = "R" \override TextSpanner.bound-details.left.text = "L" \override TextSpanner.bound-details.left-broken.text = \markup\right-align "(L)" <>\startTextSpan s1 \break <>\stopTextSpan s1 <>\startTextSpan s1 \break s1 \break s1 <>\stopTextSpan <>\startTextSpan s1 \break s1 \break s1 \break <>\stopTextSpan } \new Staff { \spanTest s4 % makes last "right" appear (but extends piece) }
Re: TextSpanner to end of bar / end of piece
Hi Harm, { \override TextSpanner.bound-details.right.text = "R" \override TextSpanner.bound-details.left.text = "L" \override TextSpanner.to-barline = ##t <>\startTextSpan s1 \break <>\stopTextSpan s1 <>\startTextSpan s1 <>\stopTextSpan } Though, if the TextSpanner does not end at line-end you'll need different settings. Probably doable by some scheme-coding ... Ah, yes. It seems that with to-barline, the right-broken.text is used at the end of the line. Thanks! So this seems to mean that right-broken.text should be changed by a hook that determines if we are at a line break. I'llt try to see if I can figure out how to do this. Lukas
Re: TextSpanner to end of bar / end of piece
Am Mo., 24. Mai 2021 um 15:16 Uhr schrieb Lukas-Fabian Moser : > Folks, > > two questions about the behaviour of textSpanners: > > First question: > > If a TextSpanner ends at the beginning at a bar which happens to be a line > break, then > > - with TextSpanner.to-barline = ##f, I get the left-broken.text and the > right.text immediately after one another at the beginning of the second > system, > > - with TextSpanner.to-barline = ##t, I get no artifacts in the next line, > but right.text is missing in the first system. > > What I want: The text spanner should end at the last barline of the first > system, but right.text should be printed. > > Second question: Is it possible to let a TextSpanner end precisely at the > end of a piece (last barline) with right.text being printed? > > I can approximate the desired behaviour in both cases by letting the > TextSpanner end a very short amount of time before the actual end of the > bar, but that feels conceptually wrong and also does not yield the correct > position of "R". > > Lukas > Hi Lukas, below works for me: { \override TextSpanner.bound-details.right.text = "R" \override TextSpanner.bound-details.left.text = "L" \override TextSpanner.to-barline = ##t <>\startTextSpan s1 \break <>\stopTextSpan s1 <>\startTextSpan s1 <>\stopTextSpan } Though, if the TextSpanner does not end at line-end you'll need different settings. Probably doable by some scheme-coding ... Cheers, Harm