On Fri, 2023-12-08 at 22:55 +0100, Jean Abou Samra wrote:
> Yes, but it was not called for System specifically until
> 
> commit 782f5528e014cc3c7f705298a83f777306541e89
> Author: Jean Abou Samra <j...@abou-samra.fr>
> Date:   Mon Mar 21 21:21:28 2022 +0100
> 
>     Also call after-line-breaking/before-line-breaking/springs-and-
> rods on System
>     
>     This makes System consistent with other grobs and allows for
>     customizations and debugging.
> 
> 
> which appeared in 2.23.7.

Thanks for confirming.

> Please triple check that you are actually running 2.24.3.

*facepalm*

Somehow my up arrow got mixed up and was using lilypond instead of
./lilypond as I tested back to back.

> System.after-line-breaking not working hints at a pre-2.23.7 version,
> and 'when' being unbound means it's built with Guile 1 as opposed to
> Guile 2 or Guile 3, which is impossible in LilyPond 2.24.

GNU LilyPond 2.24.3 (running Guile 2.2)

I will pay more attention to that version string.

> #(define (dump-system-info sys)
>    (let* ((right (ly:spanner-bound sys RIGHT))
>           (time (ly:grob-property right 'when 0)))
>      (format #t "\nline break at ~f" (ly:moment-main time))))
> 
> \layout {
>   \context {
>     \Score
>     \override System.after-line-breaking = #dump-system-info
>   }
> }

I can confirm that this works now.  However, when I integrate it with
the other dump-spacetime output:

Drawing systems...
line break at 3.0
ly2video:    ( 12.1143247086614170, 13.4185367086614170) 0.00000
ly2video:    ( 14.8278751262453050, 16.1320871262453020) 0.25000
ly2video:    ( 17.5414255438291900, 18.8456375438291900) 0.50000
ly2video:    ( 20.2549759614130770, 21.5591879614130770) 0.75000
ly2video:    ( 23.9489604331111930, 25.2531724331111920) 1.00000
ly2videoBar: ( 22.8032482361398220, 22.9932482361398240) 1.00000
ly2video:    ( 26.6625108506950780, 27.9667228506950780) 1.25000
ly2video:    ( 29.3760612682789630, 30.6802732682789630) 1.50000
ly2video:    ( 32.0896116858628500, 33.3938236858628500) 1.75000
ly2video:    ( 35.7835961575609640, 37.0878081575609640) 2.00000
ly2videoBar: ( 34.6378839605895900, 34.8278839605895900) 2.00000
ly2video:    ( 38.4971465751448500, 39.8013585751448500) 2.25000
ly2video:    ( 41.2106969927287400, 42.5149089927287400) 2.50000
ly2video:    ( 43.9242474103126300, 45.2284594103126300) 2.75000
ly2videoBar: ( 46.4725196850393800, 46.6625196850393800) 3.00000
line break at 7.0

The line breaks come out before the rest of the measure does.  I would
expect the first line break print to appear after the third
ly2videoBar.  And I didn't show it, but there's no line break following
the end of the last bar.  So the number of breaks is correct, they are
all just shifted in the time that they are printed.

I guess the System.after-line-breaking is being called before all the
others (NoteHead, BarLine) which is not what I am expecting.  I thought
that putting it in \Staff context might change the behaviour, but no
prints came out.

Then I tried your other suggestion using NonMusicalPaperColumn:

#(define (dump-col-info col)
   (when (eqv? LEFT (ly:item-break-dir col))
     (let ((time (ly:grob-property col 'when 0)))
       (format #t "\nline break2 at ~f" (ly:moment-main time)))))

\layout {
  \context {
    \Score
    \override NonMusicalPaperColumn.after-line-breaking = #dump-col-
info
  }
}

And it prints before the last Bar:

Drawing systems...
line break at 3.0
ly2video:    ( 12.1143247086614170, 13.4185367086614170) 0.00000
ly2video:    ( 14.8278751262453050, 16.1320871262453020) 0.25000
ly2video:    ( 17.5414255438291900, 18.8456375438291900) 0.50000
ly2video:    ( 20.2549759614130770, 21.5591879614130770) 0.75000
ly2video:    ( 23.9489604331111930, 25.2531724331111920) 1.00000
ly2videoBar: ( 22.8032482361398220, 22.9932482361398240) 1.00000
ly2video:    ( 26.6625108506950780, 27.9667228506950780) 1.25000
ly2video:    ( 29.3760612682789630, 30.6802732682789630) 1.50000
ly2video:    ( 32.0896116858628500, 33.3938236858628500) 1.75000
ly2video:    ( 35.7835961575609640, 37.0878081575609640) 2.00000
ly2videoBar: ( 34.6378839605895900, 34.8278839605895900) 2.00000
ly2video:    ( 38.4971465751448500, 39.8013585751448500) 2.25000
ly2video:    ( 41.2106969927287400, 42.5149089927287400) 2.50000
ly2video:    ( 43.9242474103126300, 45.2284594103126300) 2.75000
line break2 at 3.0
ly2videoBar: ( 46.4725196850393800, 46.6625196850393800) 3.00000
line break at 7.0

if I change 
   (when (eqv? LEFT (ly:item-break-dir col))
to
   (when (eqv? RIGHT (ly:item-break-dir col))

I get:

Drawing systems...
line break at 3.0
line break2 at 0.0
...
ly2videoBar
line break at 7.0
line break2 at 3.0

Which is better, but there is no break for the last page and having
line break2 come out at the start with 0.0 isn't helpful.

So that's closer to what I want, but not exact.

Thanks,
Stef

Reply via email to