Thanks for the direction. I'd love to have a crack at doing it properly. Can
you suggest an existing engraver that I could use as a starting point? Would
the existing lyric engraver be best? Any suggestions on a name for the new
engraver would also be valuable.
Glen
> -----Original Message-----
> From: Han-Wen Nienhuys [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 12 July 2000 23:01
> To: Glen Prideaux
> Cc: 'Glen Prideaux'; [EMAIL PROTECTED]
> Subject: RE: Lilypond lyrics alignment
>
>
> [EMAIL PROTECTED] writes:
> >Please let me know if what I have done really duplicates
> functionality
> >already there.
>
> There are also some problems with your patch:
>
> * It is a kludge (because of the guesswork for the notehead width, and
> the manual entry)
>
> * It changes the semantics of \property: it resets the value after
> using it once. This is serious, because it means that it has to be
> changed some time.
>
> (I know that I'm guilty of this mistake as well, in a few places.
> It is one the things I'll try to fix, some time.)
>
> Your patch doesn't duplicate much, but I feel uncomfortable about
> letting kludges enter the source code, especially if they're not mine
>
> (Explanation: I have less problems with letting my own kludges enter
> the code, because I know that I will be around to fix it when that
> time has come. However, I usually end up being the guy that fixes
> other's kludges as well. When I see a kludge authored by someone else,
> I instinctively think about the time it will cost me to fix it.)
>
> In any case, the following changes the issue:
>
> > This is what my patch attempts to address, so we can set songs like:
> > | | | | | | | | | | |
> > o o o o o o o o o o o
> > ... camped by a bil - a - bong, un - der the
> shade of ...
> > ... mounted on his thor - ough - bred, down came the
> troop - ers ...
> > ^ ^
> > end of phrase right aligned ----------/ \------start of
> phrase left
> > aligned
>
> Why don't we try to solve the problem completely? Sketch of the
> solution:
>
> * Build an engraver that catches noteheads and lyrics.
>
> (It needs to be in a context above Staff and Lyrics, eg. in Score
> context.)
>
> * Determine which heads belong to which lyrics
>
> (eg. by looking at the names of their originating contexts, or maybe
> some \properties)
>
> * Attach the lyrics to the appropriate heads
>
> (by doing lyric->set_parent (head, X_AXIS), that will fix the current
> noteheadwidth guessing kludge)
>
> * Check if the lyric syllables end or start a phrase.
>
> (eg. check if the syllable ends with punctuation, and remember that
> fact for the next one.)
>
> * Adjust their alignment accordingly.
>
> (eg. by doing lyric->add_offset_callback(centered_on_parent,X_AXIS)
> and setting self-alignment-X)
>
> * Add a property to switch on/off the engraver (for multi stanza
> vs. single stanza music)
>
> Maybe this engraver could also take care of correct lyric alignment
> for melismas as well.
>
> >I'm still getting the hang of how Lilypond hangs together.
>
> I hope the above explains a better way doing it. If you want to try
> implementing this, feel free to ask any further questions.
>
>
> --
>
> Han-Wen Nienhuys | [EMAIL PROTECTED] | http://www.cs.uu/~hanwen/
>
>