Flat ties: Difference between revisions
Appearance
mNo edit summary |
|||
| Line 1: | Line 1: | ||
The function takes the default <code>Tie.stencil</code> as an argument, calculating the result relying on the extents of this default. | The function takes the default <code>Tie.stencil</code> as an argument, calculating the result relying on the extents of this default. | ||
Further tweaking is possible by overriding <code>Tie.details.height-limit</code> or with <code>\shape</code>. It | Further tweaking is possible by overriding <code>Tie.details.height-limit</code> or with <code>\shape</code>. It is also possible to change the custom definition on the fly. | ||
<lilypond version="2.24"> | |||
#(define ((flared-tie coords) grob) | #(define ((flared-tie coords) grob) | ||
(define (pair-to-list pair) | |||
(list (car pair) (cdr pair))) | (list (car pair) (cdr pair))) | ||
| Line 60: | Line 57: | ||
} | } | ||
\paper { | \paper { | ||
ragged-right | ragged-right = ##f | ||
} | } | ||
| Line 70: | Line 66: | ||
a'4~a | a'4~a | ||
a'4~a | a'4~a | ||
<a,, c e a c e a c e>~ q | <a,, c e a c e a c e>~ q \break | ||
a'4~a | a'4~a | ||
\once \override Tie.details.height-limit = 14 | \once \override Tie.details.height-limit = 14 | ||
a4~a | a4~a \break | ||
a4~a | a4~a | ||
\once \override Tie.details.height-limit = 0.5 | \once \override Tie.details.height-limit = 0.5 | ||
a4~a | a4~a \break | ||
a4~a | a4~a | ||
\shape #'((0 . 0) (0 . 0.4) (0 . 0.4) (0 . 0)) Tie | \shape #'((0 . 0) (0 . 0.4) (0 . 0.4) (0 . 0)) Tie | ||
a4~a | a4~a \break | ||
a4~a | a4~a | ||
\once \override Tie.stencil = | \once \override Tie.stencil = | ||
#(flared-tie '((0 . 0)(0.1 . 0.4) (0.9 . 0.4) (1.0 . 0.0))) | #(flared-tie '((0 . 0)(0.1 . 0.4) (0.9 . 0.4) (1.0 . 0.0))) | ||
a4~a | a4~a | ||
a4~a | a4~a | ||
\once \override Tie.stencil = | \once \override Tie.stencil = | ||
#(flared-tie '((0 . 0)(0.06 . 0.1) (0.94 . 0.1) (1.0 . 0.0))) | #(flared-tie '((0 . 0)(0.06 . 0.1) (0.94 . 0.1) (1.0 . 0.0))) | ||
a4~a | a4~a | ||
| Line 104: | Line 92: | ||
</lilypond> | </lilypond> | ||
[[Category:Contemporary notation]] | |||
[[Category:Scheme]] | |||
[[Category:Staff notation]] | [[Category:Staff notation]] | ||
[[Category:Tweaks and overrides]] | [[Category:Tweaks and overrides]] | ||
[[Category:Included in the official documentation]] | [[Category:Included in the official documentation]] | ||
[[Category:Snippet]] | [[Category:Snippet]] | ||
Revision as of 12:13, 5 December 2025
The function takes the default Tie.stencil as an argument, calculating the result relying on the extents of this default.
Further tweaking is possible by overriding Tie.details.height-limit or with \shape. It is also possible to change the custom definition on the fly.
\version "2.24"
#(define ((flared-tie coords) grob)
(define (pair-to-list pair)
(list (car pair) (cdr pair)))
(define (normalize-coords goods x y dir)
(map
(lambda (coord)
;(coord-scale coord (cons x (* y dir)))
(cons (* x (car coord)) (* y dir (cdr coord))))
goods))
(define (my-c-p-s points thick)
(make-connected-path-stencil
points
thick
1.0
1.0
#f
#f))
;; outer let to trigger suicide
(let ((sten (ly:tie::print grob)))
(if (grob::is-live? grob)
(let* ((layout (ly:grob-layout grob))
(line-thickness (ly:output-def-lookup layout 'line-thickness))
(thickness (ly:grob-property grob 'thickness 0.1))
(used-thick (* line-thickness thickness))
(dir (ly:grob-property grob 'direction))
(xex (ly:stencil-extent sten X))
(yex (ly:stencil-extent sten Y))
(lenx (interval-length xex))
(leny (interval-length yex))
(xtrans (car xex))
(ytrans (if (> dir 0)(car yex) (cdr yex)))
(uplist
(map pair-to-list
(normalize-coords coords lenx (* leny 2) dir))))
(ly:stencil-translate
(my-c-p-s uplist used-thick)
(cons xtrans ytrans)))
'())))
#(define flare-tie
(flared-tie '((0 . 0)(0.1 . 0.2) (0.9 . 0.2) (1.0 . 0.0))))
\layout {
\context {
\Voice
\override Tie.stencil = #flare-tie
}
}
\paper {
ragged-right = ##f
}
\relative c' {
a4~a
\override Tie.height-limit = 4
a'4~a
a'4~a
<a,, c e a c e a c e>~ q \break
a'4~a
\once \override Tie.details.height-limit = 14
a4~a \break
a4~a
\once \override Tie.details.height-limit = 0.5
a4~a \break
a4~a
\shape #'((0 . 0) (0 . 0.4) (0 . 0.4) (0 . 0)) Tie
a4~a \break
a4~a
\once \override Tie.stencil =
#(flared-tie '((0 . 0)(0.1 . 0.4) (0.9 . 0.4) (1.0 . 0.0)))
a4~a
a4~a
\once \override Tie.stencil =
#(flared-tie '((0 . 0)(0.06 . 0.1) (0.94 . 0.1) (1.0 . 0.0)))
a4~a
}