lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spacing broken tie away from key signature


From: Nick Payne
Subject: Re: Spacing broken tie away from key signature
Date: Sat, 30 Apr 2011 16:14:08 +1000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10

On 09/04/11 18:30, Nick Payne wrote:
When a tie is broken across staves, the second part of the tie defaults to starting right at the key signature. How can I move it slightly away? Setting extra-spacing-width for the KeySignature moves the first note further away but doesn't move the starting point of the broken tie. I also played around with the various space-alist values for KeySignature without being able to move the tie. When I look at commercial scores I have, there is usually about one staff unit space between the key signature and broken tie in this situation

I was just playing around with this again. Maybe someone who knows Scheme can show me where I'm going wrong - in the callback-b function for after-line-breaking I'm trying to call the alter-tie-curve function to move the beginning of the second part of the tie that is broken across staves, but although the code builds without reporting any errors, the tie doesn't get moved. The callback-a function is just the example function from the documentation, which I used to test that I could actually get a change to happen with the broken tie.

I call the alter-tie-curve function separately on the tie between the 1st and 2nd notes to verify that it works ok on an unbroken tie.

%=============================================
\version "2.13.60"

#(set-global-staff-size 26.5)

#(define ((alter-tie-curve offsets) grob)
    ;; get default control-points
    (let ((coords (ly:tie::calc-control-points grob))
        (n 0))
    ;; add offsets to default coordinates
    (define loop (lambda (n)
        (set-car! (list-ref coords n)
            (+ (list-ref offsets (* 2 n))
                (car (list-ref coords n))))
        (set-cdr! (list-ref coords n)
            (+ (list-ref offsets (1+ (* 2 n)))
                (cdr (list-ref coords n))))
        (if (< n 3)
            (loop (1+ n)))))
    ;; return altered coordinates
    (loop n)
    coords))

#(define (callback-a grob)
    (let* (
        ;; have we been split?
        (orig (ly:grob-original grob))
        ;; if yes, get the split pieces (our siblings)
        (siblings (if (ly:grob? orig)
            (ly:spanner-broken-into orig)
            '())))
    (if (and (>= (length siblings) 2)
        (eq? (car (last-pair siblings)) grob))
    (ly:grob-set-property! grob 'extra-offset '(-2 . 5)))))

#(define (callback-b grob)
    (let* (
        ;; have we been split?
        (orig (ly:grob-original grob))

        ;; if yes, get the split pieces (our siblings)
        (siblings (if (ly:grob? orig)
            (ly:spanner-broken-into orig)
            '())))

    (if (and (>= (length siblings) 2)
        (eq? (car (last-pair siblings)) grob))
    (ly:grob-set-property! grob 'control-points
        (alter-tie-curve '(1.5 0 1 0 0.5 0 0 0))))))

shapeTie = #(define-music-function (parser location offsets) (list?)
    #{
        \once \override Tie #'control-points = #(alter-tie-curve $offsets)
    #})

\relative c'' {
    \key g \major
    \override Staff.KeySignature #'extra-spacing-width = #'(0 . 4)
    \override Tie #'after-line-breaking = #callback-b
    \shapeTie #'(1.5 0 1 0 0.5 0 0 0)
c1 ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c ~ c
}
%=============================================



reply via email to

[Prev in Thread] Current Thread [Next in Thread]