2009/5/10 Marc Hohl <m...@hohlart.de>: > And here's my solution for tablature: > > #(define (glissando::calc-tab-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)) > (left-staff-position (ly:grob-property left-bound 'staff-position)) > (right-staff-position (ly:grob-property right-bound > 'staff-position)) > (extra-dy > (if (and (= left-staff-position right-staff-position) > (ly:pitch<? right-pitch left-pitch))
Be careful here: ly:pitch<? compares pitches lexicographically, so you'll come unstuck if the pitches differ only in alteration: #(let ((c-natural (ly:make-pitch 0 0 0)) (c-sharp (ly:make-pitch 0 0 SHARP))) (display (ly:pitch<? c-natural c-sharp)) (newline) (display (ly:pitch<? c-sharp c-natural))) > -1 > 1 ))) ;; I don't know why, but "0" doesn't work properly in > tablature, compare glissando::calc-extra-dy Unless you can return the correct value or 0 (in the same way as glissando::calc-extra-dy), you'll probably need to use cond and else: (cond ((right pitch is lower) -1) (right pitch is higher) 1) (else 0)) Regards, Neil _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user