lilypond-user
[Top][All Lists]
Advanced

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

Re: Automatic lyric extenders


From: Knut Petersen
Subject: Re: Automatic lyric extenders
Date: Wed, 14 Dec 2016 07:12:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

Am 13.12.2016 um 22:43 schrieb Alexander Kobel:
On 2016-12-12 13:48, Knut Petersen wrote:
Hi everybody!

Please test and comment, patch and examples attached.

Hi Knut,

works beautifully, as far as your code is concerned. But I found a bug in my 
function (add-lyric-extenders): Unintuitively, adding an extender after _ makes 
extenders disappear: compare { Foo __ _ } against { Foo __ _ __ }.


Very interesting. Have a look at the scheme code produced from your example, you'll see the reason: 
every _ is translated to an " " and an extender event is added by your scheme code. But 
then in lyric-engraver.cc there is a special handling for the " " case:

Lyric_engraver::process_music ()
{
  if (event_)
    {
      SCM text = event_->get_property ("text");

      if (ly_is_equal (text, scm_from_ascii_string (" ")))
        {
          if (last_text_)
            last_text_->set_property ("self-alignment-X",
                                      get_property ("lyricMelismaAlignment"));
        }
      else
        text_ = make_item ("LyricText", event_->self_scm ());
    }

A hackish solution, but it works ;-)

The fixed function is in your regtest, along with a testcase for it.

Yes, your extended \add-lyric-extenders is correct.

I think \has-hypen? and \add-extender! should be merged with 
add-lyric-extenders. Then the code should be put into a file in the scm 
directory. E.g. scm/music-functions.scm. It's your code, will you prepare a 
patch?

cu,
 Knut



reply via email to

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