lilypond-devel
[Top][All Lists]
Advanced

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

order of layout operations, and \shapeII


From: Keith E OHara
Subject: order of layout operations, and \shapeII
Date: Tue, 26 Nov 2013 20:53:04 -0800
User-agent: Opera Mail/12.16 (Win32)

There have been a couple bug-reports (3669 3677) coming from users wanting to 
access LilyPond's layout decisions, in order to adjust those decisions. The 
surprises come from LilyPond being at an intermediate stage in the 
decision-making process when the user function is activated.

Issue 3677 is adjusting the position of slurs with a callback function, reduced 
to a diagnostic print here :

#(define (callback-function grob)
   (let* ((bound (ly:spanner-bound grob LEFT))
           (ref (ly:grob-system bound)))
       ;; print the extent of the left NoteColumn relative to the system:
       (display (ly:grob-extent bound ref Y))
       '(0 . 0)))

{ \clef alto
  \override Slur #'positions = #callback-function
  R1 \break
  d'1( e')
}

The reference point 'ref' is the System, with origin usually the uppermost 
point in the System, so the output would normally be (-2 . -1).

If we remove the \break, however, the Staff seems not yet to have been placed 
in the System when #'positions is evaluated; the Staff reference point (the 
midline) seems to be at the reference point of the System, as the note-head is 
reported to span (0 . 1).

(Things get more complicated if there is a RehearsalMark, which inserts itself 
on the first Staff, probably moving that Staff down relative to System, when 
its property 'after-line-breaking = move-to-extremal-staff is evaluated.)

The layout in LilyPond is not driven by a procedure; the functions that make 
layout decisions call each other as needed (functional, rather than procedural, 
programming).  So callbacks generally should handle being called whenever the 
decision they support is requested.

My only suggestion right now is to try to write callback functions that are robust to 
being activated at different stages of layout.   Can anyone see a way to write the 
\shapeII function at 
<http://lists.gnu.org/archive/html/lilypond-user/2013-11/msg00832.html> so that 
it computes self-consistent positions for a slur using data either before, or after, 
LilyPond has placed each Staff relative to the System ?




reply via email to

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