2016-07-04 18:49 GMT+02:00 Br. Gabriel-Marie | SSPX <brgabr...@sspx.org>:
> So, Mr. Harm, I'd like to use your stanza-number-every-line but I am running
> the release version of lilypond: 2.18.2-1 and your code calls for version
> 2.19.44. It won't compile using the older lilypond either.
>
> So, the download page only provides version 2.18.2-1.
>
> Where can I get a Windows binary for 2.19.44?
>
>
>>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. Cheers, Harm
Gabriel-Marie,
attached you'll find the most recent coding.
It indeed needs a newer devel-version because of `ly:item-get-column'-usage
David,
thanks a lot for your research and findings.
Your suggestions are all implemented leading to geat simplifications.
In `keep-at-line-begin' I added some fool-proof.
Regrettable StanzaNumber does not respond correctly for 'break-visibility...
Thanks,
Harm
\version "2.19.44"
%% Thanks to David Nalesnik
%% http://lists.gnu.org/archive/html/lilypond-user/2016-07/msg00028.html
#(define create-stanza-number-grob-engraver
;; puts out a StanzaNumber for every LyricText-grob
(lambda (context)
(let ((stanza (ly:context-property context 'stanza)))
`((acknowledgers
(lyric-syllable-interface .
,(lambda (engraver grob source-engraver)
(let ((new-stanza-grob
(ly:engraver-make-grob engraver 'StanzaNumber '())))
(ly:grob-set-property! new-stanza-grob 'text stanza)))))))))
#(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-at-line-begin grob)
(if (and (ly:item? grob) (not (at-line-beginning? grob)))
(ly:grob-suicide! grob)
grob))
keepLineStartStanzaNumbers =
\layout {
\context {
\Lyrics
\override StanzaNumber.after-line-breaking =
#keep-at-line-begin
}
}
numberLyrics =
#(define-scheme-function (nmbr)(number?)
"Return a context-modification setting @code{stanza} and consisting
@code{create-stanza-number-grob-engraver}."
#{
\with {
stanza = \markup \italic #(format #f "~a." nmbr)
\consists #create-stanza-number-grob-engraver
}
#})
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paper { ragged-last-bottom = ##f }
\score {
<<
\new Staff { \key cis \major \repeat unfold 6 { c''4 d'' e'' } }
\new Lyrics \with \numberLyrics 1
\lyricmode {
\repeat unfold 6 { foo -- bar -- buzz }
}
\new Lyrics \with \numberLyrics 2
\lyricmode {
\repeat unfold 6 { very-very-long-syllable bur -- buuuzz }
}
\new Lyrics \with \numberLyrics 3
\lyricmode {
\repeat unfold 6 { fuu -- bla -- blibbb }
}
>>
\header { piece = \markup \rounded-box \fill-line { "Using StanzaNumber" } }
\layout { \keepLineStartStanzaNumbers }
}
\score {
<<
\new Staff { \key cis \major \repeat unfold 6 { c''4 d'' e'' } }
\new Lyrics \with { instrumentName = "1." shortInstrumentName = "1." }
\lyricmode {
\repeat unfold 6 { foo -- bar -- buzz }
}
\new Lyrics \with { instrumentName = "2." shortInstrumentName = "2." }
\lyricmode {
\repeat unfold 6 { very-very-long-syllable bur -- buuuzz }
}
\new Lyrics \with { instrumentName = "3." shortInstrumentName = "3." }
\lyricmode {
\repeat unfold 6 { fuu -- bla -- blibbb }
}
>>
\header { piece = \markup \rounded-box \fill-line { "Using InstrumentName" } }
\layout {
\context {
\Score
\override InstrumentName.X-offset = #'()
\override InstrumentName.font-series = #'bold
\override InstrumentName.font-shape = #'italic
}
\context {
\Lyrics
\revert InstrumentName.font-size
}
}
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user