]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/flat-ties.ly
Issue 5167/6: Changes: show \markup xxx = ... \etc assignments
[lilypond.git] / Documentation / snippets / flat-ties.ly
1 %% DO NOT EDIT this file manually; it is automatically
2 %% generated from LSR http://lsr.di.unimi.it
3 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
4 %% and then run scripts/auxiliar/makelsr.py
5 %%
6 %% This file is in the public domain.
7 \version "2.18.0"
8
9 \header {
10   lsrtags = "contemporary-notation, scheme-language, staff-notation, tweaks-and-overrides"
11
12   texidoc = "
13 The function takes the default @code{Tie.stencil} as an argument,
14 calculating the result relying on the extents of this default. Further
15 tweaking is possible by overriding @code{Tie.details.height-limit} or
16 with @code{\\shape}. It's also possible to change the custom-definition
17 on the fly.
18
19 "
20   doctitle = "Flat Ties"
21 } % begin verbatim
22
23 %% http://lsr.di.unimi.it/LSR/Item?id=1031
24
25 #(define ((flared-tie coords) grob)
26
27   (define (pair-to-list pair)
28      (list (car pair) (cdr pair)))
29
30   (define (normalize-coords goods x y dir)
31     (map
32       (lambda (coord)
33         ;(coord-scale coord (cons x (* y dir)))
34         (cons (* x (car coord)) (* y dir (cdr coord))))
35       goods))
36
37   (define (my-c-p-s points thick)
38     (make-connected-path-stencil
39       points
40       thick
41       1.0
42       1.0
43       #f
44       #f))
45
46   ;; outer let to trigger suicide
47   (let ((sten (ly:tie::print grob)))
48     (if (grob::is-live? grob)
49         (let* ((layout (ly:grob-layout grob))
50                (line-thickness (ly:output-def-lookup layout 'line-thickness))
51                (thickness (ly:grob-property grob 'thickness 0.1))
52                (used-thick (* line-thickness thickness))
53                (dir (ly:grob-property grob 'direction))
54                (xex (ly:stencil-extent sten X))
55                (yex (ly:stencil-extent sten Y))
56                (lenx (interval-length xex))
57                (leny (interval-length yex))
58                (xtrans (car xex))
59                (ytrans (if (> dir 0)(car yex) (cdr yex)))
60                (uplist
61                  (map pair-to-list
62                       (normalize-coords coords lenx (* leny 2) dir))))
63
64    (ly:stencil-translate
65        (my-c-p-s uplist used-thick)
66      (cons xtrans ytrans)))
67    '())))
68
69 #(define flare-tie
70   (flared-tie '((0 . 0)(0.1 . 0.2) (0.9 . 0.2) (1.0 . 0.0))))
71
72 \layout {
73   \context {
74     \Voice
75     \override Tie.stencil = #flare-tie
76   }
77 }
78
79 \paper { ragged-right = ##f }
80
81 \relative c' {
82   a4~a
83   \override Tie.height-limit = 4
84   a'4~a
85   a'4~a
86   <a,, c e a c e a c e>~ q
87
88   \break
89
90   a'4~a
91   \once \override Tie.details.height-limit = 14
92   a4~a
93
94   \break
95
96   a4~a
97   \once \override Tie.details.height-limit = 0.5
98   a4~a
99
100   \break
101
102   a4~a
103   \shape #'((0 . 0) (0 . 0.4) (0 . 0.4) (0 . 0)) Tie
104   a4~a
105
106   \break
107
108   a4~a
109   \once \override Tie.stencil =
110     #(flared-tie '((0 . 0)(0.1 . 0.4) (0.9 . 0.4) (1.0 . 0.0)))
111   a4~a
112
113   a4~a
114   \once \override Tie.stencil =
115     #(flared-tie '((0 . 0)(0.06 . 0.1) (0.94 . 0.1) (1.0 . 0.0)))
116   a4~a
117 }