Oops, mistakenly sent this only to the OP...

---------- Forwarded message ----------
From: David Nalesnik <[email protected]>
Date: Fri, Dec 20, 2013 at 9:01 AM
Subject: Re: SostenutoPedalLineSpanner and texts
To: Simon Bailey <[email protected]>


Hi Simon,


On Fri, Dec 20, 2013 at 1:42 AM, Simon Bailey <[email protected]> wrote:

> Hi,
>
> I'd like the SostenutoLine to be prefixed with "(Sost.)" after a line
> break. Is there a possibility to get the SostenutoPedalLineSpanner to
> support the following definition?
>
> \override SostenutoPedalLineSpanner.bound-details.left-broken.text =
> "(Sost.)"
>

Hmm.  I'm a little surprised that this doesn't exist.

In case it doesn't in some form or another, try this:

 \version "2.17.95"

#(define broken-stil
   (lambda (grob)
     (let* ((orig (ly:grob-original grob))
             (siblings (ly:spanner-broken-into orig))
             (broken? (pair? siblings))
             (default-stil (ly:piano-pedal-bracket::print grob))
             (first? (or (not broken?)
                           (eq? grob (first siblings)))))
       (if (and broken? (not first?))
           (let*
            ((text
              #{
                \markup \italic "(Sost.)"
              #})
             (default-stil-ext-X (ly:stencil-extent default-stil X))
             (line-length (interval-length default-stil-ext-X))
             (text-stil (grob-interpret-markup grob text))
             (text-ext-X (ly:stencil-extent text-stil X))
             (text-length (interval-length text-ext-X))
             (text-padding 1.0)
             (scaled-line
              (ly:stencil-scale
               default-stil
               (/ (- line-length (+ text-length text-padding)) line-length)
               1)))

            (ly:stencil-add
             (ly:stencil-translate-axis text-stil (/ text-length 2) X)
             (ly:stencil-translate-axis scaled-line (+ text-length
text-padding) X)))
           ; If we have the first piece (or unbroken) return default
           default-stil))))

{
  \override Staff.PianoPedalBracket.stencil = #broken-stil
  c4\sostenutoOn d e f
  \repeat unfold 20 { c4 d e f }
  c4 d e f\sostenutoOff
}


%%%%%%%%%%%%%%%

HTH,
David
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to