lilypond-devel
[Top][All Lists]
Advanced

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

event listener and engraver properties


From: Graham Percival
Subject: event listener and engraver properties
Date: Wed, 1 Jun 2011 20:31:55 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

Hi all,

I'm looking at my
  Event listener to extract (some) music events
  http://codereview.appspot.com/4373046/
patch.  Neil and Han-Wen suggested that I avoid the music
typesetting process and hook into the even listener directly.

However, I'm confused/concerned about getting the text value of
text spanners.  I'm currently doing:

#(define (format-textspan engraver event)
   (let* ((context (ly:translator-context engraver))
          (moment (ly:context-current-moment context))
          (spanner-props (ly:context-property context TextSpanner))
          (details (chain-assoc-get 'bound-details spanner-props))
          (left-props (assoc-get 'left details '()))
          (left-text (assoc-get 'text left-props '())))
     (print-line engraver
                 "set_string"
                 (ly:event-property event 'span-direction)
                 left-text)))

which uses the engraver.  I couldn't see any event-specific way to
get the text of a text spanner -- the information appears to exist
on the engraver level only.

Am I missing anything obvious?

If I'm not missing anything, then I think it would be cleaner in
the long run just to leave everything as it is (i.e. after the
whole typesetting process -- IMHO this would also make it easier
for other researchers to modify the script, since they could get
whatever engraver properties they wanted to get).

Cheers,
- Graham



reply via email to

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