bug-lilypond
[Top][All Lists]
Advanced

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

Re: Strange output for Glissando.to-barline


From: Thomas Morley
Subject: Re: Strange output for Glissando.to-barline
Date: Thu, 31 May 2018 20:02:10 +0200

2018-05-31 14:40 GMT+02:00 David Kastrup <address@hidden>:
> Thomas Morley <address@hidden> writes:
>
>> 2018-05-31 14:13 GMT+02:00 Aaron Laws <address@hidden>:
>>> On Thu, May 31, 2018 at 7:10 AM, Thomas Morley <address@hidden>
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> 'to-barline does not work as expected for Glissandi.
>>>
>>>
>>> Pray pardon my ignorance; what are you expecting to happen? Are you wanting
>>> the glissando to point down to the c'1, but stop at the barline?
>>
>> Yes.
>> Similar as it's done at line-break:
>>
>> \paper { line-width = 60 }
>>
>> {
>>   \once \override Glissando.breakable = ##t
>>   \override Glissando.after-line-breaking = #'()
>>   f'1\glissando
>>   \break
>>   c'1
>> }
>>
>>> It looks
>>> like the glissando is pointing to the middle of the staff (or perhaps to
>>> c''1...).
>>
>> Which is wrong in almost every case.
>
> Huh.  So we'd need different right boundaries for X and for Y
> coordinates.  Or have glissando derive its slope from something other
> than its right spanner bound, assuming that that is what it does.
>
> --
> David Kastrup


In scheme I'd do something at the lines (some TODOs in it) of:

foo =
  \once \override Glissando.to-barline =
  #(lambda (grob)
     (let* ((bound-right (ly:spanner-bound grob RIGHT))
            (bound-left (ly:spanner-bound grob LEFT))
            (raw-left-Y
              (if (grob::has-interface bound-left 'note-head-interface)
                  (ly:grob-property bound-left 'staff-position)
                  0))
            (raw-right-Y
              (if (grob::has-interface bound-right 'note-head-interface)
                  (ly:grob-property bound-right 'staff-position)
                  0)))
       ;; TODO implement default 'after-line-breaking, i.e.
       ;; ly:spanner::kill-zero-spanned-time somewhere.
       ;;
       ;; take gradient of the line into account, to prevent the line being too
       ;; step?
       (ly:grob-set-property! grob 'after-line-breaking
         (lambda (grob)
           (let ((to-barline (ly:grob-property grob 'to-barline)))
             (if (eq? #t to-barline)
                 (begin
                   (ly:grob-set-nested-property! grob '(left-bound-info Y)
                     (/ raw-left-Y 2))
                   (ly:grob-set-nested-property! grob '(right-bound-info Y)
                     (/ raw-right-Y 2)))))))

       #t
       ))

\paper { line-width = 60 }

{
  \once \override Glissando.breakable = ##t
  \foo
  a'1\glissando
  \break
  s1
  \break
  s1
  a1
}

{
  \once \override Glissando.breakable = ##t
  \foo
  a'1\glissando
  \break
  s1
  a1
}

{
  \once \override Glissando.breakable = ##t
  \foo
  a'1\glissando
  a1
}

Though, I'm somewhat surprised the Y-values provided return nice output...


Cheers,
  Harm



reply via email to

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