]> git.donarmstrong.com Git - lilypond.git/blob - scm/paper.scm
patch::: 1.3.15.jcn2
[lilypond.git] / scm / paper.scm
1 ;;; paper.scm -- scm paper variables and functions
2 ;;;
3 ;;;  source file of the GNU LilyPond music typesetter
4 ;;; 
5 ;;; (c) 1999 Jan Nieuwenhuizen <janneke@gnu.org>
6
7 ;;; All dimensions are measured in staff-spaces
8
9 ;; TODO
10 ;;  - make easily customisable from mudela
11 ;;  - take #forced stems into account (now done in C++)
12 ;;  - take y-position of chord or beam into account
13 (define (stem-shorten flags) 0.5)
14 (define (beamed-stem-shorten multiplicity) 0.5)
15
16
17 ;; Beams should be prevented to conflict with the stafflines, 
18 ;; especially at small slopes
19 ;;    ----------------------------------------------------------
20 ;;                                                   ########
21 ;;                                        ########
22 ;;                             ########
23 ;;    --------------########------------------------------------
24 ;;       ########
25 ;;
26 ;;       hang       straddle   sit        inter      hang
27
28 ;; inter seems to be a modern quirk, we don't use that
29
30 (define beam-normal-dy-quants
31   '(0 (/2 (+ beam-thickness staff-line) 2) (+ beam-thickness staff-line) 1))
32
33 ;; two popular veritcal beam quantings
34 ;; see params.ly: #'beam-vertical-quants
35 (define (beam-normal-y-quants multiplicity dy)
36   (let ((quants `(,beam-hang 1)))
37     (if (or (<= multiplicity 1) (>= (abs dy) (/ staff-line 2)))
38         (set! quants (cons beam-sit quants)))
39     (if (or (<= multiplicity 2) (>= (abs dy) (/ staff-line 2)))
40         (set! quants (cons beam-straddle quants)))
41     quants))
42
43 (define (beam-traditional-y-quants multiplicity dy)
44   (let ((quants '(1)))
45     (if (>= dy (/ staff-line -2))
46         (set! quants (cons beam-hang quants)))
47     (if (and (<= multiplicity 1) (<= dy (/ staff-line 2)))
48         (set! quants (cons beam-sit quants)))
49     (if (or (<= multiplicity 2) (>= (abs dy) (/ staff-line 2)))
50         (set! quants (cons beam-straddle quants)))
51     quants))
52
53
54 ;;; Default variables and settings
55
56 (define staff-line 0.10)
57 (define beam-thickness (* 0.52 (- 1 staff-line)))
58 (define beam-straddle 0)
59 (define beam-sit (/ (+ beam-thickness staff-line) 2))
60 (define beam-hang (- 1 (/ (- beam-thickness staff-line) 2)))
61
62 (define beam-height-quants beam-normal-dy-quants)
63 (define beam-vertical-position-quants beam-normal-y-quants)
64
65