lilypond-user
[Top][All Lists]
Advanced

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

WAS: SostenutoPedalLineSpanner and texts


From: David Nalesnik
Subject: WAS: SostenutoPedalLineSpanner and texts
Date: Sat, 21 Dec 2013 11:02:58 -0600

Hi,

This question came in reference to a workaround given for repeating texts on a broken pedal line:

On Fri, Dec 20, 2013 at 1:42 AM, Simon Bailey <address@hidden> wrote:
Could this be adapted to solve this problem: http://lists.gnu.org/archive/html/lilypond-user/2013-12/msg00839.html ? I'd be willing to offer a bounty if it can be done.



The aim is to repeat "1." "a2" and the like when a solo or unison passage is split across a page break.  (This brings back bad memories of typesetting my composition dissertation with Finale...)

The workaround (given below) can't be applied to partcombine texts, since CombineTextScript objects aren't spanners.  If they were, it would be pretty straightforward to repeat their stencil with a different appearance if broken across lines.  (This is done, for example, with MeasureCounter spanners.)  As far as only repeating them if there's a page break (and not simply for every system break), I'm not sure.

My question would be: is there any reason why the part combiner shouldn't create spanners?

--David

________________________________
The workaround:

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

\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
}

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


reply via email to

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