lilypond-user
[Top][All Lists]
Advanced

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

Re: Hairpin endings


From: David Nalesnik
Subject: Re: Hairpin endings
Date: Fri, 21 Apr 2017 14:34:25 -0500

Hi Nathan,

On Fri, Apr 21, 2017 at 12:54 PM, Nathan Ho <address@hidden> wrote:
> On 2017-04-21 05:39, David Nalesnik wrote:
>>
>> Instead of using a markup, why not use ly:line-interface::line
>> (available from 2.19.27)? This gets thickness from the grob--and any
>> other line attributes you want, so you can create dashed hairpins,
>> whatever.  There's no need adjust thickness in this case.
>
>
> Hi David,
>
> Thanks for the info. I still prefer markups for this kind of thing because
> more people understand them and they're (somewhat) better documented. Less
> ly:foo stuff I have to look up, the better. Good to know the proper way
> though!
>

OK, I see.

Anyway, in case anyone wonders, here is how your function would look:

\version "2.19.59"

#(define ((open-hairpin left-open right-open) grob)
   (let* ((stencil (ly:hairpin::print grob))
          (X-ext (ly:stencil-extent stencil X))
          (Y-ext (ly:stencil-extent stencil Y))
          (width (interval-length X-ext))
          (height (interval-length Y-ext)))
     (ly:stencil-translate
      (ly:stencil-add
       (ly:line-interface::line
         grob
         0 (* height (- 0.5 (* 0.5 left-open)))
         width (* height (- 0.5 (* 0.5 right-open))))
       (ly:line-interface::line
        grob
        0 (* height (+ 0.5 (* 0.5 left-open)))
        width (* height (+ 0.5 (* 0.5 right-open)))))
     (cons 0 (interval-start Y-ext)))))

{
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
  c'1\> c'1 c'1\!
  \override Hairpin.style = #'dashed-line
  \once \override Hairpin.stencil = #(open-hairpin 1.0 0.5)
  c'1\> c'1 c'1\!
  \once \override Hairpin.stencil = #(open-hairpin 0.5 0.0)
  c'1-\tweak thickness 3 \> c'1 c'1\!
}

%%%

-David



reply via email to

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