Re: WAS: SostenutoPedalLineSpanner and texts

2013-12-21 Thread Kieren MacMillan
Hi David,

> (This brings back bad memories of typesetting my composition dissertation 
> with Finale…)

Don’t remind me!

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

+1
Kieren.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


WAS: SostenutoPedalLineSpanner and texts

2013-12-21 Thread David Nalesnik
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  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
}

%%
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user