Hi Kevin,

On Sat, Apr 27, 2013 at 6:54 AM, Kevin Patrick Barry <barr...@tcd.ie> wrote:

> Dear LilyPond users,
>
> I need help with a strange problem I have encountered.  I wanted to edit
> the control points of a phrasing slur that has a line break.  I found a
> page about this in the lilypond manual, from which I adapted the following
> code:
>
> #(define (my-callback 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 'control-points '((8.5 . 5) (11 . 7.5) (68 .
> 7) (70.33 . 2.75))))))
>
>
> When I added an \override PhrasingSlur #'after-line-breaking =
> #my-callback everything looked OK in Frescobaldi (2.08, running on Ubuntu
> 13.04), but when I engrave the file from the command line it engraves it
> without the override (the phrasing slur appears as it did before). I made
> sure to save changes. Even if I copy the command line from Frescobaldi it
> will not engrave correctly. Both Frescobaldi and the command line state
> that they are using 2.16.2 (which is the only version installed anyway).
>
>
> I haven't been able to reproduce the issue in a tiny example, but I have
> noticed that the override I used (I don't understand the scheme code) is
> very temperamental. For example I can only get it to work when the Bar
> number engraver is removed. In another test I was able to break it simply
> by adding the Horizontal bracket engraver to the voice context: I use lots
> of style files in my work (and the horizontal bracket engraver is included
> in them) and when preparing a stand-alone version of the file to attach I
> removed the \include and added the engraver explicity which immediately
> caused the override to stop working.
>
>
> If anyone has the patience to look into this I have attached a file which
> reproduces the problem (I'm sorry I couldn't pare it down; there must be
> some weird interactions that I don't understand going on). I had to leave
> the horizontal bracket engraver out.
>
>
>
I can't address the inconsistencies you describe, though...

You can get the function to work by overriding 'control-points instead of
'after-line-breaking.

So, you can keep your function as is and write:

\override PhrasingSlur #'control-points = #my-callback

However, if altering 'control-points with the above line, it would be
cleaner to have the callback return control points:

#(define (my-callback 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))
         '((8.5 . 5) (11 . 7.5) (68 . 7) (70.33 . 2.75)))))

BTW, are you aware that \shape can be used to alter broken curves as well?
 You might consider using it since it will reflect changes in spacing.

The syntax is different for 2.16 versus 2.17.  For 2.16, you'd write:

\shape PhrasingSlur '( () ((0 . 0) (0 . 2) (0 . 2) (0 . 0)) )

where () is equivalent to ((0 . 0) (0 . 0) (0 . 0) (0 . 0))
indicating no change.

You'll probably need to move the \shape override closer to the phrasing
slur, though.  (Can't remember the situation with 2.16, but in 2.17 it's a
\once \override)

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

Reply via email to