]> git.donarmstrong.com Git - lilypond.git/blob - scm/paper.scm
patch::: 1.3.15.jcn3
[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
10
11 ;; Beams should be prevented to conflict with the stafflines, 
12 ;; especially at small slopes
13 ;;    ----------------------------------------------------------
14 ;;                                                   ########
15 ;;                                        ########
16 ;;                             ########
17 ;;    --------------########------------------------------------
18 ;;       ########
19 ;;
20 ;;       hang       straddle   sit        inter      hang
21
22 ;; inter seems to be a modern quirk, we don't use that
23
24 (define beam-normal-dy-quants
25   '(0 (/2 (+ beam-thickness staff-line) 2) (+ beam-thickness staff-line) 1))
26
27 ;; two popular veritcal beam quantings
28 ;; see params.ly: #'beam-vertical-quants
29 (define (beam-normal-y-quants multiplicity dy)
30   (let ((quants `(,beam-hang 1)))
31     (if (or (<= multiplicity 1) (>= (abs dy) (/ staff-line 2)))
32         (set! quants (cons beam-sit quants)))
33     (if (or (<= multiplicity 2) (>= (abs dy) (/ staff-line 2)))
34         (set! quants (cons beam-straddle quants)))
35     quants))
36
37 (define (beam-traditional-y-quants multiplicity dy)
38   (let ((quants '(1)))
39     (if (>= dy (/ staff-line -2))
40         (set! quants (cons beam-hang quants)))
41     (if (and (<= multiplicity 1) (<= dy (/ staff-line 2)))
42         (set! quants (cons beam-sit quants)))
43     (if (or (<= multiplicity 2) (>= (abs dy) (/ staff-line 2)))
44         (set! quants (cons beam-straddle quants)))
45     quants))
46
47
48 ;;; Default variables and settings
49
50 (define staff-line 0.10)
51 (define beam-thickness (* 0.52 (- 1 staff-line)))
52 (define beam-straddle 0)
53 (define beam-sit (/ (+ beam-thickness staff-line) 2))
54 (define beam-hang (- 1 (/ (- beam-thickness staff-line) 2)))
55
56 (define beam-height-quants beam-normal-dy-quants)
57 (define beam-vertical-position-quants beam-normal-y-quants)
58
59
60 ;; array index flag-2 (what a name!!), last if index>size
61 ;; unbeamed stems
62 (define stem-length '(3.5 3.5 3.5 4.5 5.0))
63 (define grace-length-factor 0.8)
64 (define grace-stem-length
65   (map (lambda (x) (* grace-length-factor x)) stem-length))
66
67 ;; array index multiplicity, last if index>size
68 ;; beamed stems
69 (define beamed-stem-shorten '(0.5))
70 (define beamed-stem-length '(0.0 2.5 2.0 1.5))
71 (define beamed-stem-minimum-length '(0.0 3.0 2.5 2.0))
72 (define grace-beamed-stem-minimum-length
73   (map (lambda (x) (* grace-length-factor x)) beamed-stem-minimum-length))
74
75 ;;  Stems in unnatural (forced) direction should be shortened,
76 ;;  according to [Roush & Gourlay].  Their suggestion to knock off
77 ;;  a whole staffspace seems a bit drastical: we'll do half.
78
79 ;; TODO
80 ;;  - take #forced stems into account (now done in C++)?
81 ;;  - take y-position of chord or beam into account
82
83 (define stem-shorten '(0.5))
84 (define grace-stem-shorten '(0.0))