[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:27:23 +0100 |
2016-01-19 1:04 GMT+01:00 Thomas Morley <address@hidden>:
> 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))))))
Probably even better:
#(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
(if (interval-sane? left-x-ext) (cdr left-x-ext) 0)
(if (interval-sane? right-x-ext) (cdr right-x-ext) 0))))))
>
> Please report back, whether it works now.
>
> Cheers,
> Harm
- Re: Controlling hairpin length, David Sumbler, 2016/01/17
- Re: Controlling hairpin length, Thomas Morley, 2016/01/17
- Re: Controlling hairpin length, David Sumbler, 2016/01/17
- Re: Controlling hairpin length, Thomas Morley, 2016/01/17
- Re: Controlling hairpin length, David Sumbler, 2016/01/18
- Re: Controlling hairpin length, Thomas Morley, 2016/01/18
- Re: Controlling hairpin length,
Thomas Morley <=
- Re: Controlling hairpin length, David Sumbler, 2016/01/19
- Re: Controlling hairpin length, Thomas Morley, 2016/01/19
- Re: Controlling hairpin length, David Sumbler, 2016/01/21
- Re: Controlling hairpin length, Thomas Morley, 2016/01/22
- Re: Controlling hairpin length, David Sumbler, 2016/01/22
- Re: Controlling hairpin length, Thomas Morley, 2016/01/23
- Re: Controlling hairpin length, Michael Gerdau, 2016/01/23
- Re: Controlling hairpin length, David Sumbler, 2016/01/24