[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Slur position : "catching" Llilypond values...
From: |
David Nalesnik |
Subject: |
Re: Slur position : "catching" Llilypond values... |
Date: |
Mon, 14 Feb 2011 09:02:52 -0600 |
On 2/14/11, Dmytro O. Redchuk <address@hidden> wrote:
> Would be great it if allows to specify which grob's positions to alter, like
> this:
>
> \offsetPositions #"Arpeggio" #'(-2 . 2)
>
Hi, Dmytro --
I actually have been working on a snippet which generalizes another
function -- namely, the oft-cited snippet for applying 'extra-offset
to broken slurs.
http://www.lilypond.org/doc/v2.12/Documentation/user/lilypond/Difficult-tweaks#Difficult-tweaks
It should be easy to do a similar thing with the positions snippet.
Here is my function:
offsetBrokenSpanner =
#(define-music-function (parser location name offsets) (string? pair?)
#{
\overrideProperty $name #'after-line-breaking #(broken-spanner $offsets)
#}
)
#(define ((broken-spanner offsets) grob)
(let* (
; have we been split?
(orig (ly:grob-original grob))
; if yes, get the split pieces (our siblings)
(siblings (if (ly:grob? orig)
(ly:spanner-broken-into orig) '() )))
(if (and (>= (length siblings) 2)
(eq? (car (last-pair siblings)) grob))
(ly:grob-set-property! grob 'extra-offset offsets))))
To modify a slur:
\offsetBrokenSpanner #"Slur" #'(x . y)
To modify a grob in a higher context:
\offsetBrokenSpanner #"Staff.OttavaBracket" #'(x . y)
My only hesitation is this statement in the NR (section referenced above):
"When applying this trick, the new after-line-breaking callback should
also call the old one after-line-breaking, if there is one. For
example, if using this with Hairpin, ly:hairpin::after-line-breaking
should also be called."
I confess I don't fully understand this, and hence I'm unsure if my
function is overly simplifed. However, calling \offsetBrokenSpanner
#"Hairpin" #'(x . y) seems to work as expected.
[Note: the issue of contexts is why I used \overrideProperty instead
of \override. For some reason, \override will not accept
"Staff.OttavaBracket" as a valid grob name. I wonder if there is any
drawback to using \overrideProperty, since I've seen it so
infrequently.]
Best,
David
- Slur position : "catching" Llilypond values..., Éditions IN NOMINE, 2011/02/07
- Re: Slur position : "catching" Llilypond values..., Dmytro O. Redchuk, 2011/02/07
- Re: Slur position : "catching" Llilypond values..., David Nalesnik, 2011/02/08
- Re: Slur position : "catching" Llilypond values..., Xavier Scheuer, 2011/02/11
- Re: Slur position : "catching" Llilypond values..., David Nalesnik, 2011/02/11
- Re: Slur position : "catching" Llilypond values..., Phil Holmes, 2011/02/13
- Re: Slur position : "catching" Llilypond values..., Dmytro O. Redchuk, 2011/02/14
- Re: Slur position : "catching" Llilypond values...,
David Nalesnik <=
- Re: Slur position : "catching" Llilypond values..., Dmytro O. Redchuk, 2011/02/14
- Re: Slur position : "catching" Llilypond values..., Nick Payne, 2011/02/14
- Re: Slur position : "catching" Llilypond values..., David Nalesnik, 2011/02/14