Re: [frogs] Changing subproperties with grob-set-property (working on bug #40)

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


Marc Hohl schrieb:
[...]
(Attached is the full file)

Arrgh! Now it is...
\version "2.13.6"

\paper {
   indent = 0
   ragged-right = ##f
}

#(define (glissando::calc-extra-dy grob)
   (let* ((original (ly:grob-original grob))
          (left-bound (ly:spanner-bound original LEFT))
          (right-bound (ly:spanner-bound original RIGHT))
          (left-pitch (ly:event-property (event-cause left-bound) 'pitch))
          (right-pitch (ly:event-property (event-cause right-bound) 'pitch)))

     (if (and (= (ly:pitch-octave left-pitch) (ly:pitch-octave right-pitch))
              (= (ly:pitch-notename left-pitch) (ly:pitch-notename right-pitch)))
         (- (ly:pitch-alteration right-pitch) (ly:pitch-alteration left-pitch))
         0 )))

#(define (glissando::calc-accidental-X grob)
    (let* ((original (ly:grob-original grob))
           (right-bound (ly:spanner-bound original RIGHT))
           (right-bound-info (ly:line-spanner::calc-right-bound-info grob))
           (right-X (assoc-get 'X right-bound-info 0))
           (accidental (ly:grob-object right-bound 'accidental-grob)))

           (if (ly:grob? accidental)
               (set! right-X (- right-X 30)))

           (ly:grob-set-property! grob '(bound-details right X) right-X)
           (ly:line-spanner::print grob)))


noten = \relative c {
   c4 \glissando cis
   c4   \glissando cis
   c4 \glissando ces
   c4 \glissando ces
   c4 \glissando d \glissando e \glissando f
   c2 \glissando c
    c4 \glissando dis e \glissando ges
}

\score {
    \new Staff { \clef "G_8"
                 \noten \break
                 \override Glissando #'extra-dy = #glissando::calc-extra-dy
                 \override  Glissando #'stencil = #glissando::calc-accidental-X
                 \noten }
}



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/