[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: |
Tue, 25 Oct 2016 17:07:25 -0500 |
On Tue, Oct 25, 2016 at 4:53 PM, Karol Majewski <address@hidden> wrote:
> I think I don't have to compare dot.staff-position and
> notehead.staff-position. I can simply check if Dots.direction is 1 or -1.
>
> Still I'm doing something wrong here:
Could you please provide your test example when you give code? I'm
assembling an example each time you provide code from bits and pieces
you've already given. Chances are, I will miss something that way.
>
> tweakTie =
> #(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))
> (flag
> (ly:grob-object stem 'flag))
> (dots
> (ly:grob-object notehead 'dot))
If there are no dots, the following will cause an error. You check
below if the dot is a grob, but you should do it before you query the
direction. In other words, request the dot direction after the check
for the Dot grob below.
> (dots-dir
> (ly:grob-property dots 'direction)))
> (if
> (>
> (length ties) 1)
> (begin
> (if
> (ly:grob? flag)
> (ly:grob-set-property! flag 'Y-extent
> (cons 4 0)))
> (for-each
> (lambda
> (tie)
> (ly:grob-set-nested-property! tie '(details skyline-padding) 5))
> ties)))
Note that the following two if clauses can be consolidated for more
economical and maintainable code. Direction can be used as a
multiplier, since it will be either -1 or 1: simply multiply -0.25 by
direction. The only "if" to check for is that there is a dot.
> (if
> (and
> (= dots-dir 1)
> (ly:grob? dots))
> (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))
> (if
> (and
> (= dots-dir -1)
> (ly:grob? dots))
> (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 = #tweakTie
> }
> }
>
>
- Re: Tie settings question, (continued)
- Re: Tie settings question, Karol Majewski, 2016/10/24
- Re: Tie settings question, Karol Majewski, 2016/10/25
- Re: Tie settings question, Karol Majewski, 2016/10/25
- Re: Tie settings question, Karol Majewski, 2016/10/25
- Re: Tie settings question, Karol Majewski, 2016/10/25
- Re: Tie settings question,
David Nalesnik <=
- Re: Tie settings question, Karol Majewski, 2016/10/25
- Re: Tie settings question, Karol Majewski, 2016/10/26
- Re: Tie settings question, Karol Majewski, 2016/10/26
- Re: Tie settings question, David Nalesnik, 2016/10/26