lilypond-devel
[Top][All Lists]
Advanced

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

Re: [frogs] chord-name-engraver plus capo - schemeing away ...


From: Neil Puttock
Subject: Re: [frogs] chord-name-engraver plus capo - schemeing away ...
Date: Fri, 27 Aug 2010 23:42:01 +0100

On 27 August 2010 21:49, Wols Lists <address@hidden> wrote:

> There's a function called "parenthesize" in define-markup-commands.scm
> that looks like it does what I want (line 3154), but
> ly_lily_module_constant can't find it, and I don't know whether I've got
> the call to it in the line below correct or not, anyway.

ly_lily_module_constant ("parenthesize-markup")

> And lastly, the call to line-markup blows up with "invalid arguments".
> I've found another function - markup-join (markup.scm, l514) - should I
> be using that? But I think it wants a pair, and scm_cons does not seem
> to be the function that creates a pair. There's probably more to it than
> that, though.

scm_cons does create a pair, but you need a list for the arguments to \line.

Just to prove how nasty doing markup in C++ is, here's the above code corrected:

  SCM paren_proc = ly_lily_module_constant ("parenthesize-markup");
  SCM line_proc = ly_lily_module_constant ("line-markup");
  SCM hspace_proc = ly_lily_module_constant ("hspace-markup");
  SCM final_markup = scm_list_n (line_proc,
                                 scm_list_3 (markup,
                                             scm_list_2 (hspace_proc,
                                                         scm_from_int (1)),
                                             scm_list_2 (paren_proc, 
capo_markup)),
                                 SCM_UNDEFINED);
                                        
  chord_name_->set_property ("text", final_markup);

I feel dirty after messing with that. ;)

I haven't used scm_call, since the markup isn't evaluated until the
stencil's created: the 'text property just stores the markup pending
its conversion to a stencil via Text_interface::interpret_markup.

BTW, I forgot that there's no word-space set for ChordName markup,
since it would mess up the spacing of the individual elements, so I
had to add some space using \hspace instead.

Cheers,
Neil



reply via email to

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