> I've managed to bypass using before-line-breaking AND after-line-breaking
> by assigning the function to the 'thickness property and having each grob
> internally calculate its own control points rather than relying on it
> being
> calculated elsewhere (also attached):

Works great! I improved it further by making it compatible with ties too:


#(define (variable-slur-thickness min-l max-l min-t max-t) (lambda (grob)
  (let* ((cpf (if (grob::has-interface grob 'tie-interface)
                  ly:tie::calc-control-points
                  ly:slur::calc-control-points))
         (cpt (cpf grob))
         (cp0 (car cpt)) (cp3 (cadddr cpt))
         (dx (- (car cp3) (car cp0)))
         (dy (- (cdr cp3) (cdr cp0)))
         (len (magnitude (make-rectangular dx dy)))
         (thickness
           (cond ((< len min-l) min-t)
                 ((> len max-l) max-t)
                 (else (+ min-t (* (- len min-l)
                         (/ (- max-t min-t) (- max-l min-l))))))))
         
         thickness)))


> The only thing I'm (slightly) concerned with is
> the duplicate control-point calculation in this function and how it might
> affect compilation times if this were applied to a large orchestral score,
> for example.

A preliminary check with a 17-page score shows a pretty negligible effect on
compilation time, 0.6s (the total time is about 21s), or about 2.7%
additional compilation time. A small price to pay for more beauty!

Sharon



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Variable-slur-thickness-tp188374p188441.html
Sent from the User mailing list archive at Nabble.com.

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to