X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=input%2Fregression%2Ftie-chord.ly;h=1bea075b306962ecc9abf0e4852f9a1f7678e63c;hb=25be0aa5e4481df77568b99357764f5b1ff46ceb;hp=c77c51a6bad2764470eacbe59560e3cff43650a5;hpb=c8a2d1a4ac433ab596ca7d3b35655f4d49de5712;p=lilypond.git diff --git a/input/regression/tie-chord.ly b/input/regression/tie-chord.ly index c77c51a6ba..1bea075b30 100644 --- a/input/regression/tie-chord.ly +++ b/input/regression/tie-chord.ly @@ -1,67 +1,101 @@ \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." - +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.7.7" +\version "2.14.0" \paper { indent = #0.0 - raggedright = ##t + ragged-right = ##t +} + + + +generateTiePattern += #(define-music-function (parser location 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)) + + (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 = { - \time 4/4 \key c \major - \relative c'' { - % c ~ c - ~ - ~ - ~ - ~ - ~ - } - - \relative c' { - ~ - ~ - - ~ - ~ - ~ - } + \generateTiePattern ##f \baseChords } testLong = { - \time 5/8 \key c \major - \relative c'' { - 2 ~ 8 - 2 ~ 8 - 2 ~ 8 - 2 ~ 8 - 2 ~ 8 - } - - \relative c' { - 2 ~ 8 - 2 ~ 8 - 2 ~ 8 - 2 ~ 8 - } + \generateTiePattern ##t \baseChords } \new Voice -{ \testShort \break +{ + \time 2/4 + + \testShort \break \transpose c d \testShort \break + \time 5/8 \testLong \break \transpose c d \testLong \break } +