[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Pedal bracket to end of note duration
From: |
David Nalesnik |
Subject: |
Re: Pedal bracket to end of note duration |
Date: |
Sun, 5 Mar 2017 09:55:06 -0600 |
On Sun, Mar 5, 2017 at 9:36 AM, David Kastrup <address@hidden> wrote:
> David Nalesnik <address@hidden> writes:
>
>> How about something like the following?
>>
>> It resets the right bound of the spanner to the next PaperColumn or
>> NonMusicalPaperColumn. In so doing it gets a bit close to the
>> next note, so you can use 'shorten-pair for consistent offsets.
>>
>> %%%%%%%%%%%%
>> \version "2.19.55"
>>
>> #(define (encompass-duration grob)
>> (let* ((rb (ly:spanner-bound grob RIGHT))
>> (sys (ly:grob-system grob))
>> (cols (ly:grob-array->list (ly:grob-object sys 'columns)))
>> (me-forward (memq rb cols)))
>> (if (and me-forward (> (length me-forward) 1))
>> (ly:spanner-set-bound! grob RIGHT (cadr me-forward)))
>> (ly:piano-pedal-bracket::print grob)))
>>
>> {
>> \override Staff.PianoPedalBracket.stencil = #encompass-duration
>> \override Staff.PianoPedalBracket.shorten-pair = #'(0 . 0.5)
>> \set Staff.pedalSustainStyle = #'bracket
>> c'4\sustainOn c' c' c'\sustainOff
>> c'4 c'\sustainOn c'\sustainOff c'
>> c'4\sustainOn c' c' c'
>> \break
>> c'4\sustainOff c' c' c'
>> }
>>
>> %%%%%%%
>>
>> Hope this helps.
>
> Shouldn't to-barline do something of that kind? That would have been my
> first suggestion but doesn't appear to work, regardless of whether the
> spanner ends with the last note or the following note.
>
> The question is whether it should do something helpful? The default
> documentation suggests that it _shortens_ spanners to the _preceding_
> bar-line. We could make this do something sensible depending on the
> grob in question, or we could add a direction or something to make it
> possible just which direction a bar-line might sit in order to have an
> influence.
>
Since this may bring you or someone else in contact with
PianoPedalBracket stencil code, I should mention that I'm planning to
put a patch up for review in a day or so which fixes the confusing use
of TupletBracket code (a call to TupletBracket::make_bracket here).
-DN