Hi Klaus,


On Sat, Jan 10, 2015 at 7:03 PM, Klaus Blum <benbigno...@gmx.de> wrote:

> Hi David,
>
> thanks for your work - this is a really great tool.
>
> I often work with things like this:
> http://lsr.di.unimi.it/LSR/Item?id=960
> <http://lsr.di.unimi.it/LSR/Item?id=960>
> so what I found in this thread is very interesting for analysis purposes.
>
> I started to try some modifications on color, thickness, solid background
> etc:
> <http://lilypond.1069038.n5.nabble.com/file/n170307/boxer-attempt.png>
>

Now THAT looks cool!


>
> Unfortunately, I'm helpless with scheme, so I don't know how to get this to
> an end...
> I added two properties to the grob definition (and also made some additions
> to the drawing procedures):
>
> *
> #(add-grob-definition
>   'Box
>   `(
>      (stencil . ,box-stil)
>      (thickness . 0.1)  ; added by KB
>      (filled . #f)      ; added by KB
>      (meta . ((class . Item)
>               (interfaces . ())))))
> *
>
> Now I tried to modify these properties:
>
> *
> \override Score.Box.thickness = 0.5
> \override Score.Box.filled = ##t
> *
>
> Changing the "thickness" property works well, but changing "filled"
> obviously has no effect. Instead, I get this error:
> /Warnung: Eigenschafts-Typprüfung für »filled« (backend-type?) kann nicht
> gefunden werden.  vielleicht ein Tippfehler?
> Warnung: Zuweisung wird übersprungen/
> can't find property type-check for »filled« (backend-type?). perhaps a
> typing error?
> Warning: skipping assignment
>

You need to make LilyPond aware of the new property: what type does it
have? does it have a documentation string?  (The latter is important
because the documentation in the Internals Reference is generated
automatically.)

Add the following lines above the stencil function (make-box):

%%%%%%%%%%%
#(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))

  `(
    (filled ,boolean?
      "Should we fill in this box?")
; add more properties here
  ))

%%%%%%%%%%%%%

Now here is where you might run into a problem with the new grob.  Let's
say you decide to run a batch of files using this new grob:

>lilypond file1.ly file2.ly [...]

You'll get an error about "property redefined," but it will work.  (I
suppose you could remove the error warning in the definition above if the
errors in the log bother you.)

Hope this is helpful,
David
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to