lilypond-user
[Top][All Lists]
Advanced

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

Re: Controlling hairpin length


From: Thomas Morley
Subject: Re: Controlling hairpin length
Date: Tue, 19 Jan 2016 01:04:28 +0100

Hi David,

2016-01-18 22:56 GMT+01:00 David Sumbler <address@hidden>:

> After spending some hours trying to get to the bottom of this problem,
[...]

Well, I spend some hours creating the function(s) ;)

> I narrowed it down to 3 different elements in my files
[...]
> I feel
> that ideally an improvement in an area where Lilypond is somewhat
> unsatisfactory (so far as the user is concerned) should not at the same
> time break some other aspect(s) of the program's output,

Indeed.
Though I can't fix a problem which I didn't foresee or which wasn't reported.
Thus, thanks for your examples.

Please replace
#(define ((hairpin-minimum-length my-minimum) grob)
...

with the code below:

#(define ((hairpin-minimum-length my-minimum) grob)
  (let* ((bound-left (ly:spanner-bound grob LEFT))
         (bound-right (ly:spanner-bound grob RIGHT))
         (sys (look-up-for-parent 'System Y grob))
         (left-x-ext (ly:grob-extent bound-left sys X))
         (right-x-ext (ly:grob-extent bound-right sys X)))
    (ly:grob-set-property! grob 'minimum-length
      ;; keep 'minimum-length user-settable
      (max (ly:grob-property-data grob 'minimum-length)
           ;; nb, this calculation is only an approximation
           ;; should work in most cases, though
           (+ my-minimum
              (max (cdr left-x-ext) 0)
              (max (cdr right-x-ext) 0))))))

Please report back, whether it works now.

Cheers,
  Harm



reply via email to

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