lilypond-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Fix for bug #218 (center staccato over stem instead of noteh


From: Neil Puttock
Subject: Re: [PATCH] Fix for bug #218 (center staccato over stem instead of notehead)
Date: Mon, 8 Dec 2008 00:03:37 +0000

2008/12/7 Maximilian Albert <address@hidden>:
> Hi Neil,
>
> thanks a lot for your further very helpful ideas. Attached is a patch
> for a new approach which implements your suggestion to define a new
> property. It's called 'shifted-towards-stem and can take any real
> value, where 0.0 means to keep the default position (centered on the
> note-head) and 1.0 means centered on the stem (intermediate values are
> of course possible). I also added a check whether the grob in question
> actually possesses a stem, so it works well for skips, too (perhaps
> there is a more Lilypond-ish way of doing things but as far as I could
> test, it works).

This seems to work fine. :)

I've run regtests with and without a default for staccati, and both
compile without any problems (see the attached image for the expected
change in staccato-pos.ly when 'shifted-towards-stem  is set to 0.5 in
script.scm).

+     (shifted-towards-stem ,number? "Amount by which scripts are shifted

Since LilyPond uses American English for docs/properties,
shifted-toward-stem is probably better.

+  (let* ((shift (ly:grob-property grob 'shifted-towards-stem))

If you set a default value here, then you won't have to check whether
it's null later:

 (let* ((shift (ly:grob-property grob 'shifted-towards-stem 0.0))

> Since Reinhold said it would be best to make the shifting optional and
> off by default, I didn't set any properties in script.scm. But the
> shifting can of course be overridden in the .ly file itself (see
> attached example). My only question is, how can I set the property for
> individual script types instead of all scripts at once, i.e. what
> would I need to write instead of
>
>  \override Script #'shifted-towards-stem = #'1.0
>
> if I wanted to enable shifting only for staccato marks, say?

Something like this should do it:

#(define ((shift-articulation type amount) grob)
  (let ((artic (ly:event-property
                 (ly:grob-property grob 'cause)
                 'articulation-type)))
    (if (equal? type artic)
      amount
      0)))

\override Script #'shifted-towards-stem = #(shift-articulation "staccato" 1)

> P.S.: In case this gets approved in one form or the other, what would
> be necessary to document it properly? Add a LSR example, a regression
> test, something else? Anything I need to keep in mind when writing
> these?

A regression test and documentation using an LSR snippet should
suffice (as a new feature, it would go in input/new rather than LSR
directly).

Regards,
Neil

Attachment: lily-fe894752.compare.jpeg
Description: JPEG image


reply via email to

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