Hello LilyPonders,
I have a client who is working on a hymnal, and they would like for the
beginning of the lines of verses to be left justified. The best way I
can see to do this, from a visual standpoint, is to make the longest
syllable on the first note of each line centered like it normally is,
and then left-align all the others to that syllable.
Please see the attached minimal example.
First, I want to know whether it is possible to automate this behavior
with LilyPond (I think it is).
And next, I'd like it if someone would point me in the direction of how
to achieve this. My sense is that it is going to require some
function-writing. I'm not a programmer (at all, really), but I'm not
opposed to learning how to do this. Actually, I've been meaning to learn
how to extend and modify some aspects of LilyPond for my own projects
and doing so for a client-project is the best excuse I might have for
jumping in.
Also, it's something that may be useful for other users as well, so at
the very least it should be included in the LSR, and maybe made
available for everyone in a future release.
I'm also open to collaboration on this, if anyone else is interested.
So, my hunch is that I'm going to write a function that queries the
value of the left edge of the centered syllable in one verse, and then
calculates the amount of offset to apply to the syllables at the same
point in other verses on a case-by-case basis.
1) where can I start with learning this sort of tinkering, and 2) does
anyone have other functions that behave in a similar way (fetching a
value, making a calculation, and then applying it somewhere else) that I
could study to figure out how I might do this?
Again, I have no idea, so let me know if I'm way off base here.
Thanks,
David
\version "2.18.2"
\paper {
%line-width = 10\in
indent = 0\in
ragged-right = ##t
}
%% Default LilyPond beginning-of-line lyric alignment and spacing
\score {
\new Staff <<
\new Voice = "hymn" {
\relative c'' {
\partial 2 a4 a \bar "|"
}
}
\new Lyrics \lyricsto "hymn" {
with my
}
\new Lyrics \lyricsto "hymn" {
through the
}
\new Lyrics \lyricsto "hymn" {
praise the
}
\new Lyrics \lyricsto "hymn" {
bless -- ed
}
>>
}
%% Left justifying the first syllable in each verse results in funky
note spacing
syllableLeft = { \once \override LyricText.self-alignment-X = #LEFT }
\score {
\new Staff <<
\new Voice = "hymn" {
\relative c'' {
\partial 2 a4 a \bar "|"
}
}
\new Lyrics \lyricsto "hymn" {
\syllableLeft with my
}
\new Lyrics \lyricsto "hymn" {
\syllableLeft through the
}
\new Lyrics \lyricsto "hymn" {
\syllableLeft praise the
}
\new Lyrics \lyricsto "hymn" {
\syllableLeft bless -- ed
}
>>
}
%% Left justifying syllables to the longest syllable by hand is
time-consuming, inaccurate, and not persistent
%% if a different lyric font is chosen later
\score {
\new Staff <<
\new Voice = "hymn" {
\relative c'' {
\partial 2 a4 a \bar "|"
}
}
\new Lyrics \lyricsto "hymn" {
\once \override LyricText.self-alignment-X = #1 with my
}
\new Lyrics \lyricsto "hymn" {
through the
}
\new Lyrics \lyricsto "hymn" {
\once \override LyricText.self-alignment-X = #0.35 praise the
}
\new Lyrics \lyricsto "hymn" {
\once \override LyricText.self-alignment-X = #0.8 bless -- ed
}
>>
}
\version "2.18.2"
\paper {
%line-width = 10\in
indent = 0\in
ragged-right = ##t
}
%% Default LilyPond beginning-of-line lyric alignment and spacing
\score {
\new Staff <<
\new Voice = "hymn" {
\relative c'' {
\partial 2 a4 a \bar "|"
}
}
\new Lyrics \lyricsto "hymn" {
with my
}
\new Lyrics \lyricsto "hymn" {
through the
}
\new Lyrics \lyricsto "hymn" {
praise the
}
\new Lyrics \lyricsto "hymn" {
bless -- ed
}
>>
}
%% Left justifying the first syllable in each verse results in funky note spacing
syllableLeft = { \once \override LyricText.self-alignment-X = #LEFT }
\score {
\new Staff <<
\new Voice = "hymn" {
\relative c'' {
\partial 2 a4 a \bar "|"
}
}
\new Lyrics \lyricsto "hymn" {
\syllableLeft with my
}
\new Lyrics \lyricsto "hymn" {
\syllableLeft through the
}
\new Lyrics \lyricsto "hymn" {
\syllableLeft praise the
}
\new Lyrics \lyricsto "hymn" {
\syllableLeft bless -- ed
}
>>
}
%% Left justifying syllables to the longest syllable by hand is time-consuming, inaccurate, and not persistent
%% if a different lyric font is chosen later
\score {
\new Staff <<
\new Voice = "hymn" {
\relative c'' {
\partial 2 a4 a \bar "|"
}
}
\new Lyrics \lyricsto "hymn" {
\once \override LyricText.self-alignment-X = #1 with my
}
\new Lyrics \lyricsto "hymn" {
through the
}
\new Lyrics \lyricsto "hymn" {
\once \override LyricText.self-alignment-X = #0.35 praise the
}
\new Lyrics \lyricsto "hymn" {
\once \override LyricText.self-alignment-X = #0.8 bless -- ed
}
>>
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user