lilypond-user
[Top][All Lists]
Advanced

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

getting a TextSpanner 'text


From: Graham Percival
Subject: getting a TextSpanner 'text
Date: Thu, 14 Apr 2011 08:47:48 +0100

How do you get values from a context property?  I'm trying to access
the left-bound text.  I know I can do it like this:
  (cdr (car (cdr (car (cdr (car (car (ly:context-property context
'TextSpanner)))))))))))
but that's kind-of ugly.

This code:

#(define (format-textspan engraver event)
   (let* ((context (ly:translator-context engraver))
          (moment (ly:context-current-moment context)))
     (display "\n")
     (display
          (ly:context-property context 'TextSpanner)
     )
))


produces the following (with linebreaks and indents added).  I'm
really confused about the multiple "bound-details", the multiple
"left/right" inside each bound-details, etc.  How can I make sure I
get the bound-details that I want, without using plain old (car ...) ?

(
  (bound-details
    (left (text . II) (stencil-align-dir-y . 0) (Y . 0) (padding .
0.25) (attach-dir . -1))
    (right (text #<procedure line-markup (layout props args)>
((#<procedure draw-line-markup (layout props dest)> (0 . -1))))
(padding . -1) (Y . 0) (padding . 0.25))
    (left (stencil-align-dir-y . 0) (Y . 0) (padding . 0.25) (attach-dir . -1))
    (right (padding . -1) (Y . 0) (padding . 0.25))
    (left (Y . 0) (padding . 0.25) (attach-dir . -1))
    (left-broken (end-on-note . #t))
    (right (Y . 0) (padding . 0.25))
  )
  (bound-details
    (right (text #<procedure line-markup (layout props args)>
((#<procedure draw-line-markup (layout props dest)> (0 . -1))))
(padding . -1) (Y . 0) (padding . 0.25))
    (left (stencil-align-dir-y . 0) (Y . 0) (padding . 0.25)
(attach-dir . -1))     (right (padding . -1) (Y . 0) (padding . 0.25))
    (left (Y . 0) (padding . 0.25) (attach-dir . -1))
    (left-broken (end-on-note . #t)) (right (Y . 0) (padding . 0.25))
  )
  (bound-details (left (stencil-align-dir-y . 0) (Y . 0) (padding .
0.25) (attach-dir . -1)) (right (padding . -1) (Y . 0) (padding .
0.25)) (left (Y . 0) (padding . 0.25) (attach-dir . -1)) (left-broken
(end-on-note . #t)) (right (Y . 0) (padding . 0.25)))

... and so on...


Cheers,
- Graham



reply via email to

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