[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Flared horizontal bracket ties
From: |
Andrew Bernard |
Subject: |
Flared horizontal bracket ties |
Date: |
Fri, 7 Aug 2020 20:13:18 +1000 |
Here is a wonderful function created for me by Thomas Morley, for
flared ties. It may be of interest to others, but my question is, how
can I modify this code to draw dashed lines, with controllable dash
period and dash fraction?
Andrew
%==================
%{
Flared horizontal bracket ties
by Thomas Morley
%}
#(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)
(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))
(yex (ly:stencil-extent sten Y))
(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))))
%}
#(define flare-tie
(flared-tie '((0 . 0) (0.1 . 0.3) (0.9 . 0.3) (1.0 . 0.0))))
- Flared horizontal bracket ties,
Andrew Bernard <=