Hi David,

2011/10/3 David Nalesnik <david.nales...@gmail.com>

>
> After your suggestion, I experimented some with creating my own interface
> and adding it to the interface-list of various grobs.  This creates an
> interface with a single property ('markers), and then adds it to every
> grob's description.
>
> #(define add-custom-interface! (ly:add-interface 'grob-marker-interface
> "Marker for grob" '(markers)))
>
> #(define all-custom-grob-descriptions
>    (for-each
>      (lambda (x)
>        (let ((interfaces
>                (ly:assoc-get 'interfaces
>                  (ly:assoc-get 'meta
>                    (cdr x)))))
>          (set! interfaces (append! interfaces '(grob-marker-interface)))))
>      all-grob-descriptions))
>
> I don't know enough about the inner workings of LilyPond to understand the
> benefits of making an interface.  Is it so that, in this case, I could limit
> which grobs are able to be tagged with the 'markers property?
>
 I'm only a musician and music-teacher without any previous
programming-experience, trying to learn scheme and to dive into
lilypond-internals deeper and deeper. So excuse me if I remark some
moonshine. :)

Regarding the idea of defining custom-properties I thought: What could be
done with such a property? After defining a name, the needed type of
argument and the description - give it functionality. At first, I thought
about rebuilding an existent renamed property. But how?


\version "2.14.2"

#(define (define-grob-custom-property symbol type? description)
  (if (not (equal? (object-property symbol 'backend-doc) #f))
      (ly:error (_ "symbol ~S redefined") symbol))

  (set-object-property! symbol 'backend-type? type?)
  (set-object-property! symbol 'backend-doc description)
  symbol)

#(define all-user-grob-custom-properties
  (map
   (lambda (x)
     (apply define-grob-custom-property x))

   `(
     (x-y-offset ,pair? "Rebuild extra-offset")
     )))

     \relative c' {
             \override TextScript #'x-y-offset = #'(1 . 1)
    c1-"hello"
     }

This does nothing (of course not)!

Maybe I'm wrong, but I thought adding an interface could be the solution. If
not, how to do?

I also don't know if it's possible to limit the grobs to be tagged with the
'markers property when using the 'grob-marker-interface, but probably it
could be examinated.


 Many thanks for all the fine functions you've created!!

Best,

Harm
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to