lilypond-user
[Top][All Lists]
Advanced

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

Re: Shape of ties


From: Thomas Morley
Subject: Re: Shape of ties
Date: Mon, 28 Mar 2016 11:57:36 +0200

2016-03-28 2:22 GMT+02:00 Andrew Bernard <address@hidden>:

>  But a question for Thomas:
> sometimes the horizontal line of the tie finds its way to sit very close or
> directly on a staff line. Since these lines are straight and not curved,
> this can sometimes make them hard to read. Would it be possible to add a
> feature to be able to fine tune the vertical position of an individual tie
> to the function? I don’t mind issuing an override to do that manually where
> required.

Hi Andrew,

the function takes the default Tie.stencil as argument, calculating
the result relying on the extents of this default. So there is no need
for some extra feature. Just tweak the Tie as usual using
Tie.details.height-limit or with \shape.
Also, it's possble to change the custom-definition on the fly.

\version "2.19.38"

#(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))))

\layout {
        \context {
                \Voice
                \override Tie.stencil = #flare-tie
        }
}

\paper { ragged-right = ##f }

\relative c' {
        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
}

HTH,
  Harm



reply via email to

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