lilypond-user
[Top][All Lists]
Advanced

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

Re: is shapeSlur broken?


From: David Nalesnik
Subject: Re: is shapeSlur broken?
Date: Fri, 27 Apr 2012 08:22:25 -0500

Hi Urs,

On Fri, Apr 27, 2012 at 6:51 AM, David Nalesnik <address@hidden> wrote:
Hi Urs,

I've rewritten shape-slur so that you should be able to use lists of offsets which don't match with the number of slur fragments.  I've tested it somewhat, but if you run into a problem, let me know.

I noticed that you'll produce an error if you apply a list of lists to a slur which isn't broken (i.e., if a layout change results in a once-broken slur appearing on a single line).  Here is a fix for that:

 #(define ((shape-slur offsets) 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) '() ))
          (total-found (length siblings)))

     (define (helper sibs offs)
       (if (and (eq? (car sibs) grob)
                (pair? offs))
           ((alter-curve (car offs)) grob)
           (if (pair? offs)
               (helper (cdr sibs) (cdr offs))
               ((alter-curve '()) grob))))

     (if (>= total-found 2)
         (helper siblings offsets)
         (if (list? (car offsets))
             ((alter-curve (car offsets)) grob)
             ((alter-curve offsets) grob)))))

reply via email to

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