lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom tie vertical offsets


From: Andrew Bernard
Subject: Custom tie vertical offsets
Date: Fri, 9 Oct 2020 18:20:48 +1100

Some time ago Harm developed custom flared tie code for me. Because
these ties are flat and not curved, they very often come so close to
staff lines that they can be hard to read. I can manually compensate
for that with

\once \override Tie.Y-offset = #n

but this is tedious with hundreds of ties. Here's the existing code.
Is it possible to include a vertical offset of a small amount such as
0.5 that intelligently takes account of the tie direction?

Andrew

%=====

  Flared horizontal bracket ties
  by Thomas Morley

  New version, supports grob properties so allows dashed lines etc.
%}

#(define ((flared-tie coords) grob)

   (define (normalize-coords goods x y dir)
     (map
      (lambda (coord) (cons (* x (car coord)) (* y dir (cdr coord))))
      goods))

   (if (grob::is-live? grob)
       (let* ((sten (ly:tie::print grob))
              (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 (normalize-coords coords lenx (* leny 2) dir)))

         (ly:stencil-translate
          (make-connected-line uplist grob)
          (cons xtrans ytrans)))
       '()))

#(define flare-tie
   (flared-tie '((0 . 0) (0.1 . 0.3) (0.9 . 0.3) (1.0 . 0.0))))

%=====



reply via email to

[Prev in Thread] Current Thread [Next in Thread]