lilypond-user
[Top][All Lists]
Advanced

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

Re: Creating a callback with an additional argument?


From: Reinhold Kainhofer
Subject: Re: Creating a callback with an additional argument?
Date: Sun, 26 Sep 2010 20:36:22 +0200
User-agent: KMail/1.13.5 (Linux/2.6.32-24-generic; KDE/4.5.1; i686; ; )

Am Sonntag, 26. September 2010, um 20:19:28 schrieb Marc Hohl:
> is it possible to create a callback with an additional argument?

Yes, that's possible. I'm using it for example for the glyph-flag flag style.



> I tried
> 
> #(define-public (my-callback string grob)
> ...
> ..
> )

#(define-public ((glyph-flag flag-style) stem-grob)
  "Simulates the default way of generating flags: look up glyphs
   flags.style[ud][1234] from the feta font and use it for the flag stencil."
  (create-glyph-flag flag-style "" stem-grob))

Notice that the function name and the first argument are in parenthesis. Think 
of it like glyph-flag being a function that returns a function.

> and wanted to call it by
> 
> \override Notehead #'stencil = #my-callback #'foo'

#(define-public ((my-callback string) grob)
  .....
)

\override Notehead #'stencil = #(my-callback 'foo)

Cheers,
Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org



reply via email to

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