2 ;; paper-system.scm -- implement paper-system objects.
4 ;; source file of the GNU LilyPond music typesetter
6 ;; (c) 2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
9 (define-module (scm paper-system))
13 (define-public (paper-system-title? system)
14 (equal? #t (ly:prob-property system 'is-title)
17 (define-public (paper-system-stencil system)
18 (ly:prob-property system 'stencil))
20 (define-public (paper-system-extent system axis)
21 (ly:stencil-extent (paper-system-stencil system) axis))
23 (define-public (paper-system-staff-extents ps)
24 (ly:prob-property ps 'refpoint-Y-extent '(0 . 0)))
26 (define-public (paper-system-annotate-last system layout)
28 ((bottomspace (ly:prob-property system 'bottom-space))
29 (y-extent (paper-system-extent system Y))
30 (x-extent (paper-system-extent system X))
31 (stencil (ly:prob-property system 'stencil))
33 (arrow (if (number? bottomspace)
34 (annotate-y-interval layout
36 (cons (- (car y-extent) bottomspace)
43 (ly:stencil-add stencil arrow)))
45 (set! (ly:prob-property system 'stencil)
49 (define-public (paper-system-annotate system layout)
50 "Add arrows and texts to indicate which lengths are set."
53 ((annotations (ly:make-stencil '() (cons 0 2) (cons 0 0)))
56 (ly:stencil-combine-at-edge a X RIGHT b 0.5 0)))
59 (lambda (name extent is-length?)
61 (append-stencil annotations
62 (annotate-y-interval layout
63 name extent is-length?)))))
65 (bbox-extent (paper-system-extent system Y))
66 (refp-extent (ly:prob-property system 'refpoint-Y-extent))
67 (next-space (ly:prob-property system 'next-space
68 (ly:output-def-lookup layout 'between-system-space)
70 (next-padding (ly:prob-property system 'next-padding
71 (ly:output-def-lookup layout 'between-system-padding)
75 (if (number-pair? bbox-extent)
77 (annotate-property "Y-extent"
79 (annotate-property "next-padding"
80 (interval-translate (cons (- next-padding) 0) (car bbox-extent))
83 ;; titles don't have a refpoint-Y-extent.
84 (if (number-pair? refp-extent)
86 (annotate-property "refpoint-Y-extent"
89 (annotate-property "next-space"
90 (interval-translate (cons (- next-space) 0) (car refp-extent))
93 (set! (ly:prob-property system 'stencil)
95 (ly:prob-property system 'stencil)
97 (ly:stencil-expr annotations)
98 (ly:stencil-extent empty-stencil X)
99 (ly:stencil-extent empty-stencil Y)