[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: space the width of key signature
From: |
Thomas Morley |
Subject: |
Re: space the width of key signature |
Date: |
Sun, 3 Jul 2016 01:25:38 +0200 |
2016-07-02 20:07 GMT+02:00 David Nalesnik <address@hidden>:
> Hi,
>
> On Sat, Jul 2, 2016 at 12:49 PM, David Nalesnik
> <address@hidden> wrote:
>> Hi Harm,
>>
>> On Sat, Jul 2, 2016 at 10:43 AM, Thomas Morley <address@hidden> wrote:
>>> 2016-07-01 20:43 GMT+02:00 Br. Gabriel-Marie | SSPX <address@hidden>:
>>>> Because stanza numbers only appear on the first line. Using instrumentName
>>>> to label verse numbers provides automatic numbering on every line. It
>>>> wasn't my idea, actually, credit for that goes to Thomas Morley a few
>>>> issues ago in Vol 163:issue 95. It works quite well.
>>>>
>>>> On 7/1/2016 1:30 PM, address@hidden wrote:
>>>>>
>>>>> Why not use StanzaNumbers instead of instrumentName to label verse
>>>>> numbers?
>>>
>>>
>>> Meanwhile I tried to make StanzaNumber at every line-begin work, see
>>> attached.
>>> Though, it's stacking workarounds, thus pretty expensive.
>>> At least it _is_ possible, even now.
>>> Maybe someone steps in futher improving it.
>>
>> It is possible to check the break status of the NonMusicalPaperColumn
>> to the left of the StanzaNumber. This eliminates the need to filter a
>> list of all grobs on the line.
>>
>> First, you need the StanzaNumber's column. Then you can get its left
>> neighbor (which is needed b/c the stanza's column is a PaperColumn and
>> won't carry useful break info.). If the neighbor is non-musical and
>> right-broken, we're at the start of the line.
>>
>> &=====================
>>
>> #(define (at-line-beginning? grob)
>> (let* ((col (ly:item-get-column grob))
>> (ln (ly:grob-object col 'left-neighbor)))
>> (not (and (eq? #t (ly:grob-property ln 'non-musical))
>> (= 1 (ly:item-break-dir ln))))))
>>
>> #(define (keep-stanza-number-at-line-begin grob)
>> (if (at-line-beginning? grob)
>> (ly:grob-suicide! grob)))
>>
>> &====================
>
> Sorry, logic fail:
>
> #(define (at-line-beginning? grob)
> (let* ((col (ly:item-get-column grob))
> (ln (ly:grob-object col 'left-neighbor))
> (col-to-check (if (ly:grob? ln) ln col)))
> (and (eq? #t (ly:grob-property col-to-check 'non-musical))
> (= 1 (ly:item-break-dir col-to-check)))))
>
> #(define (keep-stanza-number-at-line-begin grob)
> (if (not (at-line-beginning? grob))
> (ly:grob-suicide! grob)))
>
> %%%%%%%%%%%%%
>
> This should work with grobs whose column is itself non-musical. So
> you could do this:
>
> \new Staff {
> \override Staff.Clef.after-line-breaking =
> #(lambda (grob)
> (if (at-line-beginning? grob)
> (set! (ly:grob-property grob 'color) red)))
>
> c1
> \break
> c1 \clef bass c1
> \break
> \clef treble c1
> }
>
>
> %%%%%%%%%%%%%%%%%%%%%%%
>
> Best,
> DN
Thanks for your code, it will be a great simplification.
Now I'd love to get rid of the engraver. All those StanzaNumber-grobs,
first they are created and then most of them thrown away...
The exercise is to set the stanza-context-property exactly at line-break...
Thanks,
Harm
- space the width of key signature, Br. Gabriel-Marie | SSPX, 2016/07/01
- Re: space the width of key signature, Br. Gabriel-Marie | SSPX, 2016/07/01
- Re: space the width of key signature, Thomas Morley, 2016/07/02
- Re: space the width of key signature, David Nalesnik, 2016/07/02
- Re: space the width of key signature, David Nalesnik, 2016/07/02
- Re: space the width of key signature,
Thomas Morley <=
- Re: space the width of key signature, David Nalesnik, 2016/07/02
- Re: space the width of key signature, David Nalesnik, 2016/07/02
- Re: space the width of key signature, David Nalesnik, 2016/07/02
- Re: space the width of key signature, David Nalesnik, 2016/07/02
- Re: space the width of key signature, Br. Gabriel-Marie | SSPX, 2016/07/04
- Re: space the width of key signature, David Nalesnik, 2016/07/04
- Re: space the width of key signature, Br. Gabriel-Marie | SSPX, 2016/07/04
- Re: space the width of key signature, Brian Barker, 2016/07/04
- Re: space the width of key signature, Thomas Morley, 2016/07/04
- Re: space the width of key signature, Br. Gabriel-Marie | SSPX, 2016/07/04