lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vowel aligned lyrics - want to improve it


From: Carl Sorensen
Subject: Re: vowel aligned lyrics - want to improve it
Date: Wed, 17 Feb 2010 06:48:39 -0700



On 2/17/10 3:32 AM, "Wolf Alight" <address@hidden> wrote:

>> 
>> You could do interpret-markup and get a stencil of an individual character,
>> then get its X-extent, I think.  It would involve getting the 'text, then
>> going through the text elements one by one and creating a stencil.
>> 
>> Hope this is helpful,
>> 
>> Carl
>> 
> 
> Thank you Carl for that needle in the haystack! I have been trying the stencil
> function out and with a define-markup-command I can now calculate the vowel
> aligned X for a word! 

Great news!

> 
> The only challenge is how to pass the alignment value on to the
> define-music-function that runs through the music elements? 
> Is it even possible to call a define-markup-command from
> a define-music-function? 

There is a markup interface for use with Scheme, that may make things doable
for you.  You can read about it in section 6.4 of the notation reference for
2.12.

> Or can I make a function which has access to both the music, layout and props
> objects at the same time?

I think the straightforward way to do this, rather than trying to adjust the
self-alignment-X property (which is the way I approached it in my snippet),
is to leave self-alignment-X at 0, and write a new scheme function for
X-offset (which currently uses
ly:self-alignment-interface::aligned-on-x-parent).  Then, instead of writing
a music function that tweaks the self-alignment-X property for each lyric
syllable, you simply override LyricText #'X-offset = #'center-on-vowel.

Then, for each syllable of the Lyrics, the output routines will call
center-on-vowel, and you can do your centering magic.

And one of the great things about this approach is that it should be able to
be modified very easily to be part of the LilyPond core functionality!

Thanks for working on this.

HTH,

Carl






reply via email to

[Prev in Thread] Current Thread [Next in Thread]