X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=input%2Fregression%2Ftie-chord.ly;h=71ce356efd7d4f6d316725f76a1a43a217d29fb6;hb=edf17353d89f4f6bd831466262402bb9151a26ca;hp=0cc3c753ff730ac833b9edd66fca107f84e8a9f9;hpb=5956be580d291c1460f1c4b5f6e4a1c3e6549602;p=lilypond.git diff --git a/input/regression/tie-chord.ly b/input/regression/tie-chord.ly index 0cc3c753ff..71ce356efd 100644 --- a/input/regression/tie-chord.ly +++ b/input/regression/tie-chord.ly @@ -1,24 +1,103 @@ +\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.3.16" -\header{ -texidoc=" -When tying chords, the outer slurs point outwards, the inner slurs -point away from the center of the staff. The behavior can be overridden -by setting explicitly the @code{direction} of a @code{TieColumn}. -" } +\version "2.11.51" + +\paper { + indent = #0.0 + ragged-right = ##t +} + + + +generateTiePattern += #(define-music-function (parser location is-long chords) (boolean? ly:music?) + + " -t = \relative c' { ~ } +translate x y z to x~x y~y z~z - \score { - \context Voice { - \t - \transpose c g \t +" + + (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)))) - \override TieColumn #'direction = #-1 - \t + (for-each (lambda (e) + (ly:music-set-property! e 'duration dur1)) + (ly:music-property ch1 'elements)) - } + (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 (apply append + (map chord->tied-chord (ly:music-property chords 'elements))))) + +baseChords = +\applyMusic #(lambda (mus) + (ly:music-property mus 'element)) +\relative c'' { + + + + + + + + + + + } +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 +} + +