lilypond-user
[Top][All Lists]
Advanced

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

Equal ends of glissandi


From: Thomas Morley
Subject: Equal ends of glissandi
Date: Sat, 30 Sep 2017 11:46:46 +0200

Hi all,

consider the code below

\score {
  \relative c' {
    <c e g b>4\glissando
    <d' fis g bes>\glissando
    <c, e g ais>
  }
  %% for better viewing:
  \layout {
    ragged-right = ##f
    \override Glissando.color = #red
    \override Glissando.thickness = 2.5
  }
}

I want to create an override which should end all glissandi (starting
at the NoteHeads of a certain NoteColumn) at the same X-coordinate
left from all target-NoteHeads.

I tried:

#(define same-gliss-end
  (lambda (grob)
    (let* ((vertical-axis-group-elts
             (ly:grob-object (ly:grob-parent grob Y) 'elements))
           (all-gliss
             (if (ly:grob-array? vertical-axis-group-elts)
                 (filter
                   (lambda (elt)
                     (grob::has-interface elt 'glissando-interface))
                   (ly:grob-array->list vertical-axis-group-elts))
                 '()))
           (gliss-X
             (map
               (lambda (gliss)
                 (assoc-get 'X (ly:line-spanner::calc-right-bound-info gliss)))
               all-gliss))
           (min-x (apply min gliss-X)))

        (ly:grob-set-nested-property! grob '(right-bound-info X) min-x))))

tst = \override Glissando.after-line-breaking = #same-gliss-end

\score {
  \relative c' {
      \tst
    <c e g b>4\glissando
    <d' fis g bes>\glissando
    <c, e g ais>
  }
  %% for better viewing:
  \layout {
    ragged-right = ##f
    \override Glissando.color = #red
    \override Glissando.thickness = 2.5
  }
}

Which indeed does the job for the first group of glissandi.
But all other vanish, because I take the glissandi from
VertivalAxisGroup. Meaning the last call of the override points
_every_ glissando to the same X-value, which is the minimum-X of _all_
glissandi of the current system.

Do I overlook something simple?
If not, how to do it different?

Any hint appreciated!


Thanks,
  Harm



reply via email to

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