lilypond-user
[Top][All Lists]
Advanced

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

Flat flared hairpins


From: Andrew Bernard
Subject: Flat flared hairpins
Date: Mon, 31 Dec 2018 16:00:31 +1100

I need some special flat, flared ended hairpins to indicate pulsing in a string quartet I am setting for a friend. So far, I managed to adapt a textspanner to do the job. It's fiddly but OK. However, because I use a custom graphic path markup for the spanner, the code does not deal with line breaks. It's best to refer to the attached image to see what I mean. I'll put my code here. Would anybody be willing to help out on this? Line break continuation code in lilypond has always been outside my grasp and skill level.

Alternatively, if there is a more nice way to achieve this, I'd be really grateful to hear it.

Andrew

%====

\version "2.19.82"

% dench style flat hairpins with flared ends
% by acb

% Make custom hairpins out of text spanner.

startHpinFlatFlared =
#(define-event-function (type left-pad right-pad)
   (symbol? (number? 2.5) (number? 1.8))
   "Make flat hairpin out of a text spanner with flares at left or
   right or both ends.
   "
   (cond
    ((eq? type 'left)
     (begin
      ;(dbg "left - do left part")
      #{
        \tweak TextSpanner.staff-padding #4
        \tweak TextSpanner.style #'line
        \tweak TextSpanner.thickness #1.5
        \tweak TextSpanner.bound-details.left.padding #left-pad
        \tweak TextSpanner.bound-details.right.padding #right-pad
        \tweak TextSpanner.bound-details.left.text
        \markup {
          \path #0.15 #'((moveto 0 0)
                         (lineto -1 1)
                         (moveto 0 0)
                         (lineto -1 -1)
                         (closepath))
        }
        \startTextSpan
      #}
      ))
    ((eq? type 'right)
     (begin
      ;(dbg "right - do right part")
      #{
        \tweak TextSpanner.staff-padding #4
        \tweak TextSpanner.style #'line
        \tweak TextSpanner.thickness #1.5
        \tweak TextSpanner.bound-details.left.padding #left-pad
        \tweak TextSpanner.bound-details.right.padding #right-pad
        \tweak TextSpanner.bound-details.right.text
        \markup {
          \path #0.15 #'((moveto 0 0)
                         (lineto 1 1)
                         (moveto 0 0)
                         (lineto 1 -1)
                         (closepath))
        }
        \startTextSpan
      #}
      ))
    ((eq? type 'both)
     (begin
      ;(dbg "both - do both parts")
      #{
        \tweak TextSpanner.staff-padding #4
        \tweak TextSpanner.style #'line
        \tweak TextSpanner.thickness #1.5
        \tweak TextSpanner.bound-details.left.padding #left-pad
        \tweak TextSpanner.bound-details.right.padding #right-pad
        \tweak TextSpanner.bound-details.right.text
        \markup {
          \path #0.15 #'((moveto 0 0)
                         (lineto 1 1)
                         (moveto 0 0)
                         (lineto 1 -1)
                         (closepath))
        }
        \tweak TextSpanner.bound-details.left.text
        \markup {
          \path #0.15 #'((moveto 0 0)
                         (lineto -1 1)
                         (moveto 0 0)
                         (lineto -1 -1)
                         (closepath))
        }
        \startTextSpan
      #}
      ))))

stopHpin = \stopTextSpan

%====






Attachment: hairpin-thingys.png
Description: PNG image


reply via email to

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