]> git.donarmstrong.com Git - lilypond.git/blob - scm/slur.scm
patch::: 1.3.64.jcn3
[lilypond.git] / scm / slur.scm
1
2 (define (attached-to-stem slur dir)
3   (let* ((note-columns (get-pointer slur 'note-columns))
4          (col (if (= dir 1) (car note-columns) (car (reverse note-columns))))
5          (stem (get-pointer col 'stem)))
6     (and
7      (eq? col (get-bound slur dir))
8      stem
9      (get-pointer stem 'heads))))
10
11 (define slur-extremity-rules
12   '(
13     ((lambda (slur dir)
14        ;; urg, code dup
15        (let* ((note-columns (get-pointer slur 'note-columns))
16          (col (if (= dir 1) (car note-columns) (car (reverse note-columns))))
17          (stem (get-pointer col 'stem)))
18          (and stem
19               (not (= (get-property slur 'direction) 
20                       (get-property stem 'direction)))))) . head)
21
22     ((lambda (slur dir)
23        ;; if attached-to-stem
24        (and (attached-to-stem slur dir)
25             ;; and got beam
26             ;; urg, code dup
27             (let* ((note-columns (get-pointer slur 'note-columns))
28                    (col (if (= dir 1) (car note-columns) (car (reverse note-columns))))
29                    (stem (get-pointer col 'stem)))
30             (and stem
31                  (get-pointer stem 'beam)
32                  ;; and beam on same side as slur
33                  (let ((beaming (get-property stem 'beaming)))
34                    (if (pair? beaming)
35                        (>= 1
36                            (if (= dir -1) (car beaming) (cdr beaming)))
37                        #f)))))) . stem)
38
39     ((lambda (slur dir) (not (attached-to-stem slur dir))) . loose-end)
40
41     ;; default case, attach to head
42     ((lambda (x y) #t) . head)
43     ))
44
45
46 (define slur-extremity-offset-alist
47   '(
48     ((head 1 1) . (-0.25 . 0.2))
49     ((head 1 -1) . (-0.25 . -0.25))
50     ((head -1 1) . (-0.25 . 0.25))
51     ((head -1 -1) . (-0.85 . -0.2))
52
53     ((stem 1 1) . (0 . 0.5))
54     ((stem -1 -1) . (0 . -0.5))
55     ))