[Top][All Lists]

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

Re: (tuplet . around) causes regtests to fail to compile

From: Neil Puttock
Subject: Re: (tuplet . around) causes regtests to fail to compile
Date: Wed, 3 Nov 2010 23:30:37 +0000

On 2 November 2010 07:41, Werner LEMBERG <address@hidden> wrote:

> Have you meanwhile found some time to ponder?  I'm quite curious...

Yes. :)

Here's the short answer:

chain_callback () returns SCM_UNDEFINED if the property data being
chained isn't a procedure or closure.


  78   else
  79     /*
  80       Data may be nonnumber. In that case, it is assumed to be
  81       undefined.
  82     */
  84     data = SCM_UNDEFINED;

In most situations, this isn't a problem since the procedure being
chained usually provides a sane return value.  Unfortunately, this
breaks down for TupletNumber when its 'Y-offset property is chained:
it has no default value, and the procedure it's chained to just passes
back the original value (i.e., the empty list, being the return value
for any grob property which isn't defined).

And the slightly longer version:

When an object to be avoided (an `extra-encompass') is acknowledged by
the Slur_engraver, its 'Y-offset property is chained to
ly:slur::outside-slur-callback if 'avoid-slur is set to 'around or
'outside.  For this callback to work properly, two things are

1) The grob must have a pointer to the slur being avoided (the
grob-object 'slur);
2) It must have a valid direction (i.e., not CENTER).

For TupletNumber, only the first criterion is satisfied (inside the
Slur_engraver); since its positioning relies on the coordinates
calculated for its parent TupletBracket (which of course, might not be
typeset), it has no use for 'direction.  This results in
ly:slur::outside-slur-callback simply returning the existing value.

A TupletNumber has no default for Y-offset, so in chaining its
non-existent value to the slur avoidance callback, chain_callback ()
ends up returning SCM_UNDEFINED, which causes compilation failure when
grob property typechecking is enabled.

Here are two snippets which work around the issue:

#(ly:set-option 'check-internal-types)

\relative c' {
  \override TupletNumber #'avoid-slur = #'around
  \override TupletNumber #'direction = #UP
  \times 2/3 {
    c2( d e)

-> bogus direction allows ly:slur::outside-slur-callback to return a
number; LilyPond complains about missing interface

#(ly:set-option 'check-internal-types)

\relative c' {
  \override TupletNumber #'avoid-slur = #'around
  \override TupletNumber #'Y-offset =
  #(lambda (grob)
  \times 2/3 {
    c2( d e)

-> making 'Y-offset a procedure prevents chain_callback () returning
SCM_UNDEFINED (in fact, this is currently the only way to override
'Y-offset for TupletNumber if 'avoid-slur is set to 'around or
'outside: if 'check-internal-types isn't set, compilation naturally
succeeds, but the value is discarded)


reply via email to

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