[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Change stanza formatting
From: |
David F. |
Subject: |
Re: Change stanza formatting |
Date: |
Sun, 10 Mar 2019 17:35:30 -0600 |
On Mar 1, 2019, at 6:21 PM, Aaron Hill <address@hidden> wrote:
> On 2019-03-01 10:20 am, David F. wrote:
>> There’s one small issue that I noticed. I’m engraving music with
>> simultaneous bilingual lyrics and I’m using the stanza number to print
>> the language name. Since the language name is almost always longer
>> than the first syllable, it is making that first note column wider
>> than it would be without the stanza number. Is there a way to keep the
>> sanza number from influencing the width of the note column?
>> (On the one hand, the extra space isn’t necessarily a big deal. But
>> the whole reason I want to print the language names on top of the
>> lyrics instead of to the left of them is that I’ve run into cases
>> where the extra text in the stanza number is preventing me from
>> getting everything I want onto the first line of music.)
>
> Would it work to use abbreviations for the languages? (e.g. "E:" and "F:"
> for "English" and "Français".) Unless your first LyricText is particularly
> wide, there should be enough room for such an abbreviation as a traditional
> StanzaNumber without the need to play around with properties.
That’s a great suggestion, but English and French are just what were in the
snippet I got from the Lilypond manual. We’re actually singing in English and
Español. So I could do “Eng.” and “Esp.”, but I’m worried that abbreviations
would be more confusing than helpful.
> As an alternative, you could see if right-aligning the StanzaNumbers works
> for you. Since this means the LyricTexts and StanzaNumbers share a common
> right extent, there should be no additional space added before the next
> syllable:
>
> %%%%
> \version "2.19.82"
>
> \layout { \context { \Lyrics
> \override StanzaNumber.direction = #UP
> \override StanzaNumber.side-axis = #Y
> \override StanzaNumber.padding = #0.2
> \override StanzaNumber.X-offset = #(lambda (grob)
> (define (grob-list-property glst prop)
> (map (lambda (g) (ly:grob-property g prop)) glst))
> (let* ((sse (ly:grob-object grob 'side-support-elements))
> (lyrics (cdr (ly:grob-array->list sse)))
> (lyrics-extents (grob-list-property lyrics 'X-extent))
> (lyrics-widths (map interval-length lyrics-extents))
> (lyrics-offsets (grob-list-property lyrics 'X-offset))
> (lyrics-rights (map + lyrics-offsets lyrics-widths))
> (lyrics-right (apply max lyrics-rights))
> (grob-extent (ly:grob-property grob 'X-extent))
> (grob-width (interval-length grob-extent)))
> (- lyrics-right grob-width)))
> } }
>
> \new Voice \relative { \time 3/4 g'2 e4 a2 f4 g2. }
> \addlyrics { \set stanza = #"English" Hi, my name is Bert. }
> \addlyrics { \set stanza = #"Français" Oooh, ché -- ri, je t'aime }
> %%%%
>
> NOTE: The code above considers all of the LyricTexts in the column, not just
> the current line. As a result, there is a consistent right-alignment of the
> StanzaNumbers based on the widest of the LyricTexts.
I had to add \override StanzaNumber.Y-offset =
#ly:side-position-interface::y-aligned-side in order for the stanza text to not
overlap the lyrics. And I did’t like the way it looked at first. But it’s
grown on me. I’ll probably play with it some more.
> Assuming you want left-alignment without the added space to the right, you
> will probably have to resort to altering the actual extents of the
> StanzaNumber:
>
> %%%%
> \version "2.19.82"
>
> #(define (interval-max . args) (reduce interval-union empty-interval args))
> #(define ((side-support-property func prop) grob)
> (let* ((sse (ly:grob-object grob 'side-support-elements))
> (elems (cdr (ly:grob-array->list sse)))
> (props (map (lambda (g) (ly:grob-property g prop)) elems)))
> (apply func props)))
>
> \layout { \context { \Lyrics
> \override StanzaNumber.direction = #UP
> \override StanzaNumber.side-axis = #Y
> \override StanzaNumber.padding = #0.2
> \override StanzaNumber.X-offset = #(side-support-property min 'X-offset)
> \override StanzaNumber.X-extent = #(side-support-property interval-max
> 'X-extent)
> \override StanzaNumber.Y-offset = #ly:side-position-interface::y-aligned-side
> } }
>
> \new Voice \relative { \time 3/4 g'2 c,4 a'2 f4 g2. }
> \addlyrics { \set stanza = #"English" Hi, my name is Bert. }
> \addlyrics { \set stanza = #"Français" Oooh, ché -- ri, je t'aime }
> %%%%
>
> But be advised this approach can generate overlapping ink. In the example
> above, I lowered the E in the first measure to middle C to demonstrate this.
> The collision occurs because we told LilyPond that the StanzaNumber only
> extended as far to the right as the supporting LyricTexts.
This does what I was looking for. Thanks for all your help! I see your point
about overlapping ink. I suspect that in practice it won’t be much of an
issue. And I can always set the StanzaNumber.Y-extent to put some vertical
padding between the Stanza and what ever is above it. Definitely workable.
That said, now that I’ve got what I want, I’m not really happy with it. It
looks very busy visually and feels more confusing than helpful. I’m thinking
that your idea for right-aligning the stanzas may be the more fruitful
direction to pursue.
Thanks again!
David