|
From: | Aaron Hill |
Subject: | Re: glissando lines and accidentals |
Date: | Tue, 11 Aug 2020 05:38:04 -0700 |
User-agent: | Roundcube Webmail/1.4.2 |
On 2020-08-11 5:05 am, Aaron Hill wrote:
On 2020-08-11 3:43 am, Werner LEMBERG wrote:Very nice, thanks! The only thing now is to get the two lines parallel, which looks like a lot of additional work...Oof... I am almost certainly overlooking something easier, but this appears to work: %%%% . . . %%%%
Wait. How did that code even work? Surely the change to end-on-accidental should happen in before-line-breaking before ly:line-spanner::calc-bound-info has been called. I had to switch to after-line-breaking so that left-bound-info and right-bound-info were valid, but somehow even a seemingly late change to end-on-accidental makes a difference. ??!
Here is a theoretically better version of the code, along with an improved test case so that the slopes are more easily compared:
%%%% \version "2.20.0" { \override Glissando.before-line-breaking = #(lambda (grob) (let* ((nh (ly:spanner-bound grob RIGHT)) (acc (ly:grob-object nh 'accidental-grob))) (ly:grob-set-nested-property! grob '(bound-details right end-on-accidental) (ly:grob? acc)))) \override Glissando.after-line-breaking = #(lambda (grob) (let* ((nh (ly:spanner-bound grob RIGHT)) (acc (ly:grob-object nh 'accidental-grob))) (if (ly:grob? acc) (let* ((refp (ly:grob-common-refpoint nh acc X)) (nh-xex (ly:grob-robust-relative-extent nh refp X)) (acc-xex (ly:grob-robust-relative-extent acc refp X)) (dx (- (interval-index acc-xex LEFT) (interval-index nh-xex LEFT))) (lbi (ly:grob-property grob 'left-bound-info)) (rbi (ly:grob-property grob 'right-bound-info)) (left-x (ly:assoc-get 'X lbi)) (left-y (ly:assoc-get 'Y lbi)) (right-x (ly:assoc-get 'X rbi)) (right-y (ly:assoc-get 'Y rbi)) (max-x (- right-x dx))) (ly:grob-set-nested-property! grob '(right-bound-info Y) (+ left-y (* (- right-y left-y) (/ (- right-x left-x) (- max-x left-x))))))))) \time 6/1 \stemUp <a' f''>1\glissando <d' bes'> <a' f''>1\glissando <d' b'> <a' f''>1\glissando <d' bis'> } %%%% -- Aaron Hill
gliss-accid.cropped.png
Description: PNG image
[Prev in Thread] | Current Thread | [Next in Thread] |