lilypond-user
[Top][All Lists]
Advanced

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

Re: Tie settings question


From: David Nalesnik
Subject: Re: Tie settings question
Date: Wed, 26 Oct 2016 11:03:45 -0500

On Wed, Oct 26, 2016 at 9:59 AM, Karol Majewski <address@hidden> wrote:
> OK, I resign. But stil I don't get something in the code you posted yesterday:
>
> %%%%%%%%%%%%%%%%%%%%%
>
> raiseTie =
> #(lambda (grob)
>   (let* ((ties (ly:grob-array->list (ly:grob-object grob 'ties)))
>          (notehead (ly:spanner-bound (car ties) LEFT))
>          (stem (ly:grob-object notehead 'stem))
>          (stem-dir (ly:grob-property stem 'direction))
>          (flag (ly:grob-object stem 'flag))
>          (dot (ly:grob-object notehead 'dot)))
>     (if (and (= stem-dir 1)(ly:grob? dot))
>         (for-each
>          (lambda (tie)
>            (let ((tie-dir (ly:grob-property tie 'direction)))
>              (if (= tie-dir 1)
>                  (begin
>                   (ly:grob-set-nested-property! tie '(details 
> skyline-padding) 5)
>                   (ly:grob-set-property! tie 'Y-offset -0.25)))))
>          ties))))
>
> \layout {
>  \context {
>    \Score
>    \override TieColumn.before-line-breaking = #raiseTie
>  }
> }
>
> {
>  \time 3/8 \voiceOne
>  g'4~ g'8~
>  g'4~ g'8~
>  g'4.~
>  g'4~ g'8
> }
>
> %%%%%%%%%%%%%%%%%%%%%%%%%
>
> Now, remove 'voiceOne' and a tie disappears. It seems that something is wrong 
> with (let ((tie-dir (ly:grob-property tie 'direction)))). Is it possible to 
> fix this?

When requesting the tie's direction by ly:grob-property, Lilypond will
simply read the value there -- if it has been set -- or it will
calculate it by invoking the callback that Tie.direction is set to --
ly:tie::calc-direction.

The difference in behavior that you are noticing arises because the
explicit voice commands set Tie direction.  ly:grob-property then
reads the value stored under 'direction.  No side-effects.

When 'direction hasn't been set (remove the \voiceOne), the callback
is invoked.  Side-effects.

I have no solution for this, unless you want to try to duplicate the
logic that LilyPond uses to determine tie direction yourself.

But how will this help if you have no reliable way of detecting a
dot's position?
.
David



reply via email to

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