]> git.donarmstrong.com Git - lilypond.git/blob - input/test/count-systems.ly
08734485eadcab04f5f13e800d4b0d62d4728ad4
[lilypond.git] / input / test / count-systems.ly
1
2 \version "2.1.26"
3 \header{
4     
5     texidoc="@cindex Count Systems
6 After a line break, some function may called by overriding 
7 @code{after-line-breaking-callback}. This can be most useful to assertain 
8 that a piece uses a specified number of lines; typically the number of
9 lines (or systems) is not engraved, but it can be printed to console when 
10 generating the output. The number of lines may be associated either
11 to the number of systems or the system number of a grob.
12 " }
13
14 %% -- jcn:
15 %% See, e.g., input/mutopia/J.S.Bach/baerenreiter-sarabande.ly for
16 %% an application:
17
18 %% We want this to perfectly match the Baerenreiter spacing.
19 %% If we're not using 6 systems, there's definately a problem.
20 %% #(define (assert-system-count smob n) ...
21
22
23 #(define (display-systemno smob)
24   (let* ((this-system (ly:grob-system smob))
25          (systems (ly:spanner-broken-into
26                    (ly:grob-original this-system))))
27     (display smob)
28     (display (list-index systems this-system))
29     (newline)))
30   
31
32 #(define (display-system-count smob)
33   (display (length
34             (ly:spanner-broken-into
35              (ly:grob-original
36               (ly:grob-system smob))))))
37
38   
39   
40 \score{
41     \notes\relative c''{
42         \override NoteHead  #'after-line-breaking-callback
43         % = #display-system-count
44         = #display-systemno
45         c1
46         d
47     }
48     \paper{ indent = 0.0\mm
49             linewidth = 10.0\mm
50                 raggedright = ##t
51         }
52 }
53