X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=input%2Fregression%2Ftie-chord.ly;h=f867e54613beb3128b401c12b8611e5ac9778d18;hb=cb04c4c790e5ad83a03b3761421db17a72aeae61;hp=0f7e83589a9df21e4fc362845c3741aadc1f214e;hpb=95e7eaeeffd28d3a32b3e32578e257197248456b;p=lilypond.git diff --git a/input/regression/tie-chord.ly b/input/regression/tie-chord.ly index 0f7e83589a..f867e54613 100644 --- a/input/regression/tie-chord.ly +++ b/input/regression/tie-chord.ly @@ -1,22 +1,101 @@ -\version "1.5.68" -\header{ -texidoc=" -When tieing chords, the outer slurs point outwards, the inner slurs -point away from the center of the staff. Override with -@code{tieVerticalDirection}. -" +\header { + + texidoc = "In chords, ties keep closer to the note head vertically, +but never collide with heads or stems. Seconds are formatted up/@/down; +the rest of the ties are positioned according to their vertical +position. + +The code does not handle all cases. Sometimes ties will printed on top +of or very close to each other. This happens in the last chords of +each system." + +} + +\version "2.19.22" + +\paper { + indent = #0.0 + ragged-right = ##t } -t = \notes \relative c' { ~ } - \score { -\notes \context Voice { - \t - \transpose g' \t +generateTiePattern += #(define-music-function (is-long chords) (boolean? ly:music?) + + " + +translate x y z to x~x y~y z~z + +" + + (define (chord->tied-chord chord) + (let* + ((ch1 (ly:music-deep-copy chord)) + (ch2 (ly:music-deep-copy chord)) + (dur1 (ly:make-duration + (if is-long + 1 2))) + (dur2 (ly:make-duration + (if is-long + 3 2)))) + + (for-each (lambda (e) + (ly:music-set-property! e 'duration dur1)) + (ly:music-property ch1 'elements)) - \property Voice.TieColumn \override #'direction = #-1 - \t + (for-each (lambda (e) + (ly:music-set-property! e 'duration dur2)) + (ly:music-property ch2 'elements)) + + (set! (ly:music-property ch1 'elements) + (cons + (make-music 'TieEvent) + (ly:music-property ch1 'elements))) - } + (list ch1 ch2))) + + (make-music 'SequentialMusic 'elements (append-map + chord->tied-chord (ly:music-property chords 'elements)))) + +baseChords = +\applyMusic #(lambda (mus) + (ly:music-property mus 'element)) +\relative { + + + + + + + + + + + } + +testShort = +{ + \key c \major + \generateTiePattern ##f \baseChords +} + +testLong = +{ + \key c \major + \generateTiePattern ##t \baseChords +} + +\new Voice +{ + \time 2/4 + + \testShort \break + \transpose c d \testShort \break + \time 5/8 + \testLong \break + \transpose c d \testLong \break +} + +