Hi,

On Sun, Nov 22, 2015 at 3:00 PM, David Kastrup <d...@gnu.org> wrote:

> Simon Albrecht <simon.albre...@mail.de> writes:
>
> > On 22.11.2015 21:44, David Kastrup wrote:
> >> Thomas Morley <thomasmorle...@gmail.com> 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".
> >>
>
>
I don't know if this has anything to do with it,  but the grob-array
'all-elements doesn't appear to be consistently sorted by moment.

The following function gives each TextScript grobs on a line a number based
on its position within the 'all-elements array.  Each line should be
numbered 1-20 in order, but that's clearly not the case.  There's a binding
of texts which sorts grobs by moment.  Comment that back in and the problem
disappears.


\version "2.19.30"

#(define (number-me grob)
   (let* ((sys (ly:grob-system grob))
          (all-grobs (ly:grob-array->list (ly:grob-object sys
'all-elements)))
          (texts (filter (lambda (elt) (grob::has-interface elt
'text-script-interface))
                         all-grobs))
          ;(texts (sort texts (lambda (x y) (ly:moment<? (grob::when x)
(grob::when y)))))
          )
     (let loop ((t texts) (idx 1))
       (if (not (null? t))
           (begin
            (set! (ly:grob-property (car t) 'stencil)
                  (grob-interpret-markup (car t) (number->string idx)))
            (loop (cdr t) (1+ idx)))))))

{
  \repeat unfold 10 {
    \once\override NoteHead.after-line-breaking = #number-me
    \repeat unfold 20 c''4^"foo"
    \break
  }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to