Hi Jean, Am Do., 1. Dez. 2022 um 09:48 Uhr schrieb Jean Abou Samra <j...@abou-samra.fr>:
> This is a widespread but bad coding pattern that I regularly advise > against on this list :-) you'll find a plethora of snippets in the archives using after-line-breaking authored by me. Likely starting in 2.12.3. > It seems that when people notice they can set grob properties > in after-line-breaking, they start using after-line-breaking > for anything and everything, while that is not its purpose. Well, the purpose of after-line-breaking was not well documented back those days. And in 2.23. IR still reads: "Dummy property, used to trigger callback for after-line-breaking." This is a collection of words making little sense, at least without further explanations. > The problem here is that after-line-breaking is run *just* after > line breaking. It happens before LilyPond has done page spacing, > i.e., layout out systems and staves vertically. This is not documented afaik. > For a cross-staff > arpeggio, the positions depend on the distance between the > two staves, so you are requesting 'positions earlier than LilyPond > can provide it to you. > > In general, cross-staff objects are treated specially. For > a normal arpeggio, LilyPond will request the arpeggio's > stencil, to build the staff's skylines, and stencil will > read positions. For a cross-staff arpeggio, which LilyPond > recognizes by its cross-staff property set to #t, LilyPond > refrains from reading the stencil before page layout is done, > knowing that it needs to depend on page layout. > > The proper solution is to stop assuming that positions is > available at a specific point, and instead write a callback > that computes it as soon as it is asked for: > > \version "2.23.82" > > \score { > << > \new PianoStaff << > \new Staff = "pianoRH" \pianoRH > \new Staff = "pianoLH" \pianoLH > >> > >> > \layout { > #(use-modules (ice-9 match)) > \context { > \Score > \override Arpeggio.positions = Furthermore, grob-transformer is not very old.... In older versions one had to code far more complex or use after-line-breaking - with its limitations. > #(grob-transformer > 'positions > (lambda (grob original) > (match original > ((a . b) (cons (- a 0.5) (+ b 1.0))) > (x x)))) > } > } > } > > > > Best, > Jean > > Ofcourse you're right advertising not to use after-line-breaking for all and everything. Though, I do understand why it's still in use. Just my 2 cents, Harm