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-system-grob paper-system)
21 (ly:prob-property paper-system 'system-grob))
23 (define-public (paper-system-extent system axis)
24 (ly:stencil-extent (paper-system-stencil system) axis))
26 (define-public (paper-system-staff-extents ps)
27 (ly:prob-property ps 'refpoint-Y-extent '(0 . 0)))
29 (define-public (paper-system-annotate-last system layout)
31 ((bottomspace (ly:prob-property system 'bottom-space))
32 (y-extent (paper-system-extent system Y))
33 (x-extent (paper-system-extent system X))
34 (stencil (ly:prob-property system 'stencil))
36 (arrow (if (number? bottomspace)
37 (annotate-y-interval layout
39 (cons (- (car y-extent) bottomspace)
46 (ly:stencil-add stencil arrow)))
48 (set! (ly:prob-property system 'stencil)
52 (define-public (paper-system-annotate system layout)
53 "Add arrows and texts to indicate which lengths are set."
56 ((annotations (ly:make-stencil '() (cons 0 2) (cons 0 0)))
59 (ly:stencil-combine-at-edge a X RIGHT b 0.5 0)))
62 (lambda (name extent is-length?)
64 (append-stencil annotations
65 (annotate-y-interval layout
66 name extent is-length?)))))
68 (bbox-extent (paper-system-extent system Y))
69 (refp-extent (ly:prob-property system 'refpoint-Y-extent))
70 (next-space (ly:prob-property system 'next-space
71 (ly:output-def-lookup layout 'between-system-space)
73 (next-padding (ly:prob-property system 'next-padding
74 (ly:output-def-lookup layout 'between-system-padding)
78 (if (number-pair? bbox-extent)
80 (annotate-property "Y-extent"
82 (annotate-property "next-padding"
83 (interval-translate (cons (- next-padding) 0) (car bbox-extent))
86 ;; titles don't have a refpoint-Y-extent.
87 (if (number-pair? refp-extent)
89 (annotate-property "refpoint-Y-extent"
92 (annotate-property "next-space"
93 (interval-translate (cons (- next-space) 0) (car refp-extent))
96 (set! (ly:prob-property system 'stencil)
98 (ly:prob-property system 'stencil)
100 (ly:stencil-expr annotations)
101 (ly:stencil-extent empty-stencil X)
102 (ly:stencil-extent empty-stencil Y)