bug-lilypond
[Top][All Lists]
Advanced

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

Re: alterBroken and ties


From: David Nalesnik
Subject: Re: alterBroken and ties
Date: Thu, 6 Oct 2016 18:06:39 -0500

Hi Simon,

On Thu, Oct 6, 2016 at 4:58 PM, Simon Albrecht <address@hidden> wrote:
> On 06.10.2016 23:46, Simon Albrecht wrote:
>>
>> Hello,
>>
>> in the following snippet
>>
>> %%%%%%%%%%%
>> \version "2.19.47"
>> {
>>   1-\alterBroken color #'(black red) ~ \break
>>   1
>> }

You can't use a literal list here (with overrides either).  Which
won't solve the problem, but see below...


>> %%%%%%%%%%%
>>
>> alterBroken has no effect; it gives a warning about ~ not being a spanner.
>> Which is wrong – isn’t it? _If_ it isn’t, we should at least add a ‘Known
>> issue’ in NR 5.5.5. Or we should anyway, even if it is a bug.
>
>

This is a problem easily solved.  When tweaking, \alterBroken
recognizes spanners by the property 'span-direction.  Unfortunately,
in the case of Ties, span direction.is not set.

Try this for a fix:

\version "2.19.46"


alterBroken =
#(define-music-function (property arg item)
  (key-list-or-symbol? list? key-list-or-music?)
  (_i "Override @var{property} for pieces of broken spanner @var{item}
with values @var{arg}.  @var{item} may either be music in the form of
a starting spanner event, or a symbol list in the form
@samp{Context.Grob} or just @samp{Grob}.  Iff @var{item} is in the
form of a spanner event, @var{property} may also have the form
@samp{Grob.property} for specifying a directed tweak.")
  (if (ly:music? item)
      (if (or (eq? (ly:music-property item 'span-direction) START)
              (music-is-of-type? item 'tie-event))
          (tweak property (value-for-spanner-piece arg) item)
          (begin
            (ly:music-warning item (_ "not a spanner"))
            item))
      (let* ((p (check-grob-path item (*location*)
                                 #:default 'Bottom
                                 #:min 2
                                 #:max 2))
             (name (and p (second p)))
             (description
              (and name (assoc-get name all-grob-descriptions))))
        (if (and description
                 (member 'spanner-interface
                         (assoc-get 'interfaces
                                    (assoc-get 'meta description))))
            (propertyOverride (append item (if (symbol? property)
                                       (list property)
                                       property))
                      (value-for-spanner-piece arg))
            (begin
              (ly:input-warning (*location*) (_ "not a spanner name,
`~a'") name)
              (make-music 'Music))))))

{
  1-\alterBroken color #`(,green ,red) ~ \break % or #(list green red)
  1
}

%%%%%%%%%%%%%%

HTH.

David



reply via email to

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