lilypond-user
[Top][All Lists]
Advanced

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

Re: question about overrides within repeats


From: David Nalesnik
Subject: Re: question about overrides within repeats
Date: Mon, 23 Nov 2015 11:08:13 -0600



On Sun, Nov 22, 2015 at 2:44 PM, David Kastrup <address@hidden> wrote:
Thomas Morley <address@hidden> writes:

> Though, why it is that arbitrary?
>
> Look at this variation and the attached image:
>
> \version "2.19.29"
> #(define test-nmbrs
>   (let ((nmbrs (circular-list 1 2 3 4)))
>     (lambda (grob)
>       (let ((n (car nmbrs)))
>         (set! nmbrs (cdr nmbrs))
>         (grob-interpret-markup grob (number->string n))))))
>
> {
>   \repeat unfold 8 {
>     \once \override TextScript.stencil = #test-nmbrs
>     c''4^\markup "foo"
>   }
> }

Well, it is exactly 2 variants of 1, 2, 3, 4 each.  I suspect that the
order of grob evaluation at some point when a system is printed depends
on the order of memory addresses.

Find that point and you'll likely also have the culprit for various
other stuff behaving non-deterministically, like what is drawn on top of
what and other things frequently turning up in "make check".


Here's something interesting.

Setting the stencil during 'before-line-breaking or 'after-line-breaking works for the short example that Harm provided.  In longer examples, after-line-breaking goes astray after several lines.  Compare:

 \version "2.19.29"

#(define test-nmbrs
  (let ((nmbrs (circular-list 1 2 3 4)))
    (lambda (grob)
      (let ((n (car nmbrs)))
        (set! nmbrs (cdr nmbrs))
        (set! (ly:grob-property grob 'stencil)
              (grob-interpret-markup grob (number->string n)))))))

{
  \repeat unfold 200 {
    %% works:
    \once \override TextScript.before-line-breaking = #test-nmbrs
    %% jumbling after 3 lines:
    % \once \override TextScript.after-line-breaking = #test-nmbrs
    c''4^\markup ""
  }
}

%%%
In any case, the output of these variants is notably less screwed-up than the original, where jumbling happens almost immediately.

My question would be: when does the evaluation of a grob's stencil normally happen?  My guess is this normal evaluation is happening based on a haphazard input, that using 'before-line-breaking and 'after-line-breaking is forcing a later evaluation, at a time when grobs have been better arranged by timing.

(Please understand that this is largely a guess.  I'm finding the code incredible hard to follow.)

DN

reply via email to

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