]> git.donarmstrong.com Git - lilypond.git/blob - input/test/piano-staff-distance.ly
* scripts/lilypond-book.py (do_file): do not overwrite input file.
[lilypond.git] / input / test / piano-staff-distance.ly
1
2 \header
3 {
4
5  texidoc = "It is possible to have different staff distances across
6 piano systems, but it requires some advanced magic. Kids don't try
7 this at home.  "
8
9 }
10
11 \version "2.1.26"
12
13 #(define ((futz-alignment-callback distance count) grob axis)
14
15    "Check if we're the system number COUNT, and if yes, set fixed distance to
16 DISTANCE; then call the original callback.  "
17    (let*
18        ((a (ly:grob-parent grob axis))
19         (o (ly:grob-original a))
20         (bs (if (ly:grob? o)
21                 (ly:spanner-broken-into o)
22                 #f))
23         )
24
25
26      (if (and (list? bs)
27               (< count (length bs))
28               (equal? (list-ref bs count) a)
29          )
30          (ly:grob-set-property! a 'forced-distance distance))
31      
32      (Align_interface::fixed_distance_alignment_callback grob axis)) )
33
34 \score {
35     \notes \relative c''  \context PianoStaff
36     \with {
37         verticalAlignmentChildCallback = #(futz-alignment-callback 20 1)
38
39         %% Every cross staff beam will trigger
40         %% alignment unless autokneeing is switched off 
41         \override Beam #'auto-knee-gap = #'()
42     } <<
43
44         \context Staff  = up {
45             
46             \time 2/4 
47             c8[
48                 \change Staff = down
49                 \once \override Stem #'direction = #UP
50                 c8
51                 \change Staff = up
52                 c c ](
53             |
54             \break
55             
56             c8[)
57                 \change Staff = down
58                 \once \override Stem #'direction = #UP
59                 c8
60                 \change Staff = up
61                 c c ](
62         }
63         \context Staff = down {
64             \skip 1 }
65
66     >>
67     \paper { raggedright = ##T } 
68 }