lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glissando lines and accidentals


From: Aaron Hill
Subject: Re: glissando lines and accidentals
Date: Tue, 11 Aug 2020 05:05:12 -0700
User-agent: Roundcube Webmail/1.4.2

On 2020-08-11 3:43 am, Werner LEMBERG wrote:
  { <e' c''>2\glissando <d' bes'> }

Due to the flat, the lower glissando line is far too short.

beyond my capabilities right now.  Is there a solution to
circumvent this temporarily?

%%%%
\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))))

  <e' c''>2\glissando <d' bes'>
}
%%%%

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:

%%%%
\version "2.20.0"

{
  \override Glissando.after-line-breaking =
  #(lambda (grob)
    (let* ((nh (ly:spanner-bound grob RIGHT))
           (acc (ly:grob-object nh 'accidental-grob))
           (acc? (ly:grob? acc)))
      (if 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)))))))
      (ly:grob-set-nested-property!
        grob
        '(bound-details right end-on-accidental)
        acc?)))

  \time 6/2
  <e' c''>2\glissando <d' bes'>
  <e' c''>2\glissando <d' b'>
  <e' c''>2\glissando <d' bis'>
}
%%%%


-- Aaron Hill

Attachment: gliss-accid.cropped.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]