Hi Gilberto,
On Sat, Dec 5, 2015 at 5:11 AM, Gilberto Agostinho <
[email protected]> wrote:
> Hi all,
>
> Is it possible to automatically change the text of a spanner so that if
> they
> last for more than one system they get parenthesized? I would like to apply
> this both to the ottava indications as well as for the mixed style of
> sustain pedalling (actually we don't show any text at all when Ped. lasts
> for more than one system).
>
It's not difficult to do this for ottava indications. Below I simply check
to see if the left-bound of the spanner is broken. If it is, I reset the
'text property, and call the print function to use the new value of that
property. Otherwise, we use the default stencil.
\version "2.18"
\paper {
ragged-right = ##t
}
{
\override Staff.OttavaBracket.stencil =
#(lambda (grob)
(let ((text (ly:grob-property grob 'text))
(lb (ly:spanner-bound grob LEFT)))
(if (= (ly:item-break-dir lb) CENTER)
(ly:ottava-bracket::print grob)
(begin
(set! (ly:grob-property grob 'text)
(make-concat-markup (list "(" text ")")))
(ly:ottava-bracket::print grob)))))
\ottava #1
\repeat unfold 100 {
c'''
}
}
> In the case of the ottava, the parenthesis in a new system are not
> required,
> but some authors do use them. But in the case of the pedalling, it makes
> the
> score much clearer in my opinion. See a faked version created on GIMP
> below:
>
> <http://lilypond.1069038.n5.nabble.com/file/n184494/18.png>
>
> This is even more evident when there is a page turn in between the systems.
>
> Would that be possible?
>
Probably. From my inspection of the code, though, this seems to be a
rather bigger enterprise than a modification of OttavaBracket. This should
be tackled in C++, and the code seems awfully convoluted, I can't put the
time in to figuring it out given such sparse comments, though your idea
would be useful for my own music.
A first step would be to have an actual SustainPedal grob at the broken
left-bound.
(I'm sure someone could come up with a stencil-replacement which would
redraw the bracket to get the parenthesized text, but this would be a lot
of trouble for a hack! I speak from experience: you can see a relevant
example at http://www.mail-archive.com/lilypond-user%40gnu.org/msg97099.html
)
>
>
> --
> View this message in context:
> http://lilypond.1069038.n5.nabble.com/Spanner-text-in-parenthesis-on-a-new-system-tp184494.html
> Sent from the User mailing list archive at Nabble.com.
>
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user