lilypond-user
[Top][All Lists]
Advanced

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

Re: How to catch the current height of a StaffGroup?


From: Thomas Morley
Subject: Re: How to catch the current height of a StaffGroup?
Date: Wed, 23 May 2012 21:57:36 +0200

2012/5/23 David Kastrup <address@hidden>:
> Thomas Morley <address@hidden> writes:
>
>> #(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))
>
> It is probably tiresome of me to point this out, but tampering with the
> global internal data structures of LilyPond is not a good idea since it
> means that in
>
> lilypond file1.ly file2.ly
>
> the output for file2 is no longer independent from what happens in
> file1.  So instead of making a fake "all-custom-grob-description"
> definition that is actually not used, but as a side-effect replaces the
> existing internals, maybe consider actually creating a separate modified
> copy and use \grobdescriptions to embed it in the Global context used in
> this file.
>
> --
> David Kastrup

Hi David,

sorry for that.
It was a copy/paste-error. Actually, I don't want to define a new
grob, only new properties.

The foolowing seems to be ok, or not?

\version "2.15.38"

#(define (define-grob-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)

#(map
  (lambda (x)
    (apply define-grob-property x))
    `(
      (marker ,symbol? "Marker in grob for function-call")
    ))

\relative c' {
        c1
        \override Staff.BarLine #'after-line-breaking =
         #(lambda (grob)
          (let ((xy (ly:grob-property grob 'marker)))
          (newline)(display xy)))
        d
        \override Staff.BarLine #'marker = #'foo
        e
}

-Harm



reply via email to

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