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